DynamicDataFlow#

Fully qualified name: cupva::DynamicDataFlow

Defined in src/host/cpp_api/include/cupva_host.hpp

Classes#

Node

Node is the internal object provides one load/store unit.

class DynamicDataFlow : public cupva::BaseDataFlow#

The DynamicDataFlow (deprecated) provides a dynamic load/store ability for memories other than VMEM.

Deprecated:

This class is deprecated. Use cupva::GatherScatterDataFlow or cupva::SequenceDataFlow instead.

The VPU hardware lacks the ability to access external memory (DRAM/SRAM) dynamically in the runtime. The DynamicDataFlow provides a pseudo dynamic load/store unit to the VPU enables the VPU access the external memory with the address just calculated. The basic load/store unit is a Node in the DynamicDataFlow. It transfers a tile with different size, address, padding information, .etc by each call from VPU. Each DynamicDataFlow supporting multiple Nodes inside it, widening the parallelism of this software-level load/store unit. Up to 32 Nodes are supported and grouped in 8 lanes.

All DataFlows should be created by invoking methods on cupva::CmdProgram. DataFlows are owned by CmdProgram objects. User should only operate on DataFlows via non-owning references returned by CmdProgram objects.

Public Functions

void init(
const Parameter &pmt,
int32_t const nodeCount = 1,
int32_t const laneCount = 1,
)#

Initialize a new Dynamic DataFlow object.

With laneCount = 1, device side DDF scalar APIs: for instance, cupvaDDFOpen(), cupvaDDFClose(), cupvaDDFSync() and cupvaDDFTrig() should be used to avoid mismatches between host and VPU code.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • pmt – The pointer to the DynamicDataFlow configuration table in the VMEM. Only the device pointer to the VMEM is valid.

  • nodeCount – The count of node per-lane (Maximum is 4).

  • laneCount – The count of lanes (Maximum is 8).

Throws:
  • cupva::Exception(InvalidArgument) – The node count is out-of-range

  • cupva::Exception(InvalidArgument) – The lane count is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Node &at(int32_t const nodeIdx = 0, int32_t const laneIdx = 0)#

Index the nodes in DynamicDataFlow.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: Yes

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • nodeIdx – The index of the node in the lane.

  • laneIdx – The index of the lane.

Throws:
  • cupva::Exception(InvalidArgument) – The node index is out-of-range

  • cupva::Exception(InvalidArgument) – The lane index is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The indexed node.

class Node : public cupva::DynamicStorage<impl::Node>#

Node is the internal object provides one load/store unit.

Nodes should be created by invoking methods on cupva::DynamicDataFlow. Nodes are owned by DynamicDataFlow objects. User should only operate on Nodes via non-owning references returned by DynamicDataFlow objects.

Public Functions

Node &bpp(int32_t const bpp)#

Set Node’s byte-per-pixel.

The pixel of a Node can be standard data type or user-defined-struct (class object is not acceptable)

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:

bpp – The number of byte per pixel

Throws:
  • cupva::Exception(InvalidArgument) – The bpp value is not supported

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object

Node &padDim(PadDirType const dir, int32_t const dim)#

Initialize Node’s pad direction and size.

It just give the initial configurations to the node. The VPU code can change the configurations in the runtime.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • dir – The pad direction, can be left or right, top or bottom.

  • dim – The pad size in T-typed pixel.

Throws:
  • cupva::Exception(InvalidArgument) – The padding direction is invalid

  • cupva::Exception(InvalidArgument) – The padding size is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &padVal(PadModeType const mode, int32_t const val = 0) noexcept#

Initialize Node’s pad mode and value.

It just give the initial configurations to the node. The VPU code can change the configurations in the runtime.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • mode – The pad mode, can be either PAD_BPE or PAD_CONST

  • val – The pad value, only valid when the mode is PAD_CONST.

Throws:

cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &tile(int32_t const width, int32_t const height = 1)#

Initialize Node’s tile size.

It just give the initial configurations to the node. The VPU code can change the configurations in the runtime.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • width – The width of the tile in T-typed pixel.

  • height – The height of the tile in T-typed pixel.

Throws:
  • cupva::Exception(InvalidArgument) – The tile size is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &src(const void *const ptr, int32_t const linePitch)#

Initialize the source information.

It just give the initial configurations to the node. The VPU code can change the configurations in the runtime. Note that one of source or destination should points to VMEM. Load/store between DRAM-DRAM or DRAM-SRAM is not valid.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • ptr – The initial pointer to the source.

  • linePitch – The initial source line pitch.

Throws:
  • cupva::Exception(InvalidArgument) – If the pointer is invalid

  • cupva::Exception(InvalidArgument) – The buffer line-pitch is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &src(
OffsetPointer<void const> const op,
int32_t const linePitch,
)#

Initialize the source information with OffsetPointer.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Template Parameters:

T – The type of source. Only standard type is acceptable.

Parameters:
  • op – The OffsetPointer of the source.

  • linePitch – The initial source line pitch.

Throws:
  • cupva::Exception(InvalidArgument) – If the pointer is invalid

  • cupva::Exception(InvalidArgument) – sizeof(T) is not supported

  • cupva::Exception(InvalidArgument) – The buffer line-pitch is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &dst(void *const ptr, int32_t const linePitch)#

Initialize the destination information.

It just give the initial configurations to the node. The VPU code can change the configurations in the runtime. Note that one of source or destination should points to VMEM. Load/store between DRAM-DRAM or DRAM-SRAM is not valid.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Parameters:
  • ptr – The initial pointer to the destination.

  • linePitch – The initial destination line pitch.

Throws:
  • cupva::Exception(InvalidArgument) – If the pointer is invalid

  • cupva::Exception(InvalidArgument) – The buffer line-pitch is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.

Node &dst(OffsetPointer<void> const op, int32_t const linePitch)#

Initialize the destination information with OffsetPointer.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: Yes

    • Runtime: No

    • De-Init: No

Template Parameters:

T – The type of destination. Only standard type is acceptable.

Parameters:
  • op – The OffsetPointer of the destination.

  • linePitch – The initial destination line pitch.

Throws:
  • cupva::Exception(InvalidArgument) – If the pointer is invalid

  • cupva::Exception(InvalidArgument) – sizeof(T) is not supported

  • cupva::Exception(InvalidArgument) – The buffer line-pitch is out-of-range

  • cupva::Exception(InvalidState) – The object is not instantiated correctly

Returns:

Node& The reference to current object.