CycleCount

#include <poplar/CycleCount.hpp>
namespace poplar

Poplar classes and functions.

A VectorList is a list of vectors with a specific layout and with the usage semantics of a 2D vector.

A 1D vector must be laid out in a contiguous memory region. A 2D vector is a vector of 1D vectors. Each of these 1D vectors that make up a 2D vector is called a “sub-vector” for the remainder of this document. The elements of a 2D vector can be accessed by indexing the 2D vector along the outer and inner dimensions as A[outer][inner].

The following two categories of layouts are supported:

  1. VectorListLayout::DELTANELEMENTS is a memory efficient 2D vector layout. For legacy systems VectorListLayout::DELTAN served a similar purpose. Each sub-vector must be laid out as a contiguous memory region but the sub-vectors may may not be laid out contiguous with respect to each other in memory. Each sub-vector may have a different length.

  2. VectorListLayout::ONE_PTR and other VectorListLayout layouts that are prefixed by SCALED_PTR are for Poplar runtime use only.

Functions

poplar::Tensor cycleCount(poplar::Graph &graph, poplar::program::Sequence &prog, unsigned tile, SyncType syncType, const DebugContext &debugContext = {})

Time the program for a given a sequence program type.

The result is returned as a 64-bit value in a tensor of two unsigned integers. The first element of the tensor is the lower 32 bits and the second element is the upper 32 bits. The sequence is timed by adding sync and timing programs around the original sequence. You must also specify the tile on which the program is to be timed.

Parameters
  • graph – The Poplar graph.

  • prog – The program sequence to time.

  • tile – The tile on which the program is timed.

  • syncType – The type of synchronisation to wrap the original sequence in.

  • debugContext – Optional debug context.

Returns

An unsigned integer tensor of length 2.

poplar::Tensor cycleStamp(poplar::Graph &graph, poplar::program::Sequence &prog, unsigned tile, SyncType syncType, const DebugContext &debugContext = {})

Add a sequence program to record an absolute hardware cycle stamp on a given tile.

The stamp is a snapshot of a continuously running hardware counter on a tile. For consistent results, measurements must be done on the same tile.

The result is a tensor containing two 32-bit elements of a 64-bit snapshot of the hardware counter. The first element of the tensor is the lower 32 bits and the second the upper 32 bits.

The timestamp is added after a sync is executed.

Parameters
  • graph – The Poplar graph.

  • prog – The program sequence to which the time stamp is added.

  • tile – The tile on which the time stamp is added.

  • syncType – The type of synchronisation to perform before stamping.

  • debugContext – Optional debug context.

Returns

An unsigned integer tensor of length 2.

std::vector<poplar::Tensor> cycleStamp(poplar::Graph &graph, poplar::program::Sequence &prog, const std::vector<unsigned> &tiles, SyncType syncType, const DebugContext &debugContext = {})

Add a compute set to record an absolute hardware cycle stamp on the specified tiles.

Parameters
  • graph – The Poplar graph.

  • prog – The program sequence to which the time stamp is added.

  • tiles – The tiles on which the time stamp is added.

  • syncType – The type of synchronisation to perform before stamping.

  • debugContext – Optional debug context.

Returns

A vector of tensors of 2 integers.