SequenceDataFlow API#
SequenceDataFlow Device APIs.
Macros#
- VMEM_SEQDF_HANDLER
Declare SequenceDataFlow handler in VMEM.
Enumerations#
- MemType
Possible memory source/destination types.
Functions#
- void cupvaSQDFClose(SequenceDataFlowHandler &handler)
Close the SequenceDataFlow.
- void cupvaSQDFFlushAndTrig(SequenceDataFlowHandler &handler)
Apply any pending updates and trigger the SequenceDataFlow.
- void cupvaSQDFOpen(SequenceDataFlowHandler &handler)
Open the Sequence DataFlow.
- void cupvaSQDFSync(SequenceDataFlowHandler &handler)
Sync the SequenceDataFlow.
- void cupvaSQDFSync(SequenceDataFlowHandler **handlers, uint32_t num_handlers)
Sync multiple SequenceDataFlow handlers simultaneously.
- void cupvaSQDFTrig(SequenceDataFlowHandler &handler)
Trigger the SequenceDataFlow.
- void cupvaSQDFUpdateAddr(SequenceDataFlowHandler &handler, uint8_t const transferIdx, uint64_t const srcAddr, MemType const srcMemType, uint64_t const dstAddr, MemType const dstMemType)
Update transfer addresses.
- void cupvaSQDFUpdateAddr(SequenceDataFlowHandler &handler, uint8_t const transferIdx, uint64_t const srcAddr, MemType const srcMemType, uint16_t const srcLp, uint64_t const dstAddr, MemType const dstMemType, uint16_t const dstLp)
Update transfer addresses and line pitches.
- void cupvaSQDFUpdateTileSize(SequenceDataFlowHandler &handler, uint8_t const transferIdx, uint16_t const tx, uint16_t const ty)
Update transfer tile size.
Data Structures#
- SequenceDataFlowHandler
Handle to use with SequenceDataFlow methods in device code.
Enumerations#
-
enum class cupva::MemType : uint32_t
Specify the memory types.
The CUPVA application can allocate the data in DRAM (off-chip), SRAM (on-chip) and VMEM(on-chip). The VMEM is tight-coupled-memory which can be accessed by VPU load/store instructions directly. For DRAM and SRAM, the CUPVA dataflows are needed to transfer the data from/to VMEM. SRAM provides the lower-latency memory-accessing than DRAM.
Values:
-
enumerator DRAM
MemType - Dynamic RAM
-
enumerator SRAM
MemType - Static RAM
-
enumerator VMEM
MemType - VPU Memory
-
enumerator DRAM
Functions#
-
inline void cupvaSQDFClose(SequenceDataFlowHandler &handler)#
Close the SequenceDataFlow.
Close the SequenceDataFlow. Must be called for each SequenceDataFlow before exiting device code.
No further operations on the SequenceDataFlow are permitted after calling this API.
This API may only be called when a SequenceDataFlow is idle. A SequenceDataFlow is idle immediately after calling cupvaSQDFOpen() before it is triggered, or if the sequence has been fully triggered to completion.
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handler – The handler declared with VMEM_SEQDF_HANDLER and specified in host APIs.
-
inline void cupvaSQDFFlushAndTrig(SequenceDataFlowHandler &handler)#
Apply any pending updates and trigger the SequenceDataFlow.
After calling this API, the following will occur asynchronously: 1) All updates queued with cupvaSQDFUpdate* APIs will be flushed. 2) The queue of updates will be reset. 3) The first trigger of the sequence will be asserted.
The next SequenceDataFlow API call after this API should be cupvaSQDFSync(). No updates may be added until the call to cupvaSQDFSync() immediately following this call.
This API may only be called when a SequenceDataFlow is idle. A SequenceDataFlow is idle immediately after calling cupvaSQDFOpen() before it is triggered, or if the sequence has been fully triggered to completion.
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handler – The handler declared with VMEM_SEQDF_HANDLER and specified in host APIs.
-
inline void cupvaSQDFOpen(SequenceDataFlowHandler &handler)#
Open the Sequence DataFlow.
Called once for each SequenceDataFlow. Must be called before other SequenceDataFlow APIs may be used. Failure to follow this restriction will lead to unpredictable behavior.
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handler – The handler declared with VMEM_SEQDF_HANDLER and associated with a SequenceDataFlow in host APIs.
-
inline void cupvaSQDFSync(SequenceDataFlowHandler &handler)#
Sync the SequenceDataFlow.
Synchronizes the transfer. Within a sequence, the number of calls to cupvaSQDFSync should match the number of calls to cupvaSQDFTrig() plus the call to cupvaSQDFFlushAndTrig() (if it was used).
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handler – The handler declared with VMEM_SEQDF_HANDLER and specified in host APIs.
- inline void cupvaSQDFSync(
- SequenceDataFlowHandler **handlers,
- uint32_t num_handlers,
Sync multiple SequenceDataFlow handlers simultaneously.
This version allows synchronizing multiple handlers in a single operation, which can be more efficient than synchronizing them individually.
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handlers – Array of pointers to handlers declared with VMEM_SEQDF_HANDLER
num_handlers – Number of handlers in the handlers array
-
inline void cupvaSQDFTrig(SequenceDataFlowHandler &handler)#
Trigger the SequenceDataFlow.
This API should be used for transfers which require triggers. This API can be used to commence an iteration of the sequence, provided no updates need to be applied to the sequence. If updates are needed, use cupvaSQDFFlushAndTrig() instead.
Refer to cupva::TransferModeType for more information on sequencing.
- Parameters:
handler – The handler declared with VMEM_SEQDF_HANDLER and specified in host APIs.
- inline void cupvaSQDFUpdateAddr(
- SequenceDataFlowHandler &handler,
- uint8_t const transferIdx,
- uint64_t const srcAddr,
- MemType const srcMemType,
- uint64_t const dstAddr,
- MemType const dstMemType,
Update transfer addresses.
Queues an update to a SequenceDataFlow which updates the addresses associated with a transfer. The update will be flushed during the next call to cupvaSQDFFlushAndTrig(). This API may not be called between cupvaSQDFFlushAndTrig() and the next call to cupvaSQDFSync().
If the transfer is not CONTINUOUS, the src and dst memory types must match those originally configured in host code. Passing a different memory type to a triggered transfer may lead to unpredictable triggering behavior.
If the transfer is CONTINUOUS, srcMemType and dstMemType can be reconfigured provided they do not introduce any new data transfer directions which were not part of the cupva::SequenceDataFlowTransfer objects in the cupva::SequenceDataFlow configured with host APIs. For example, if all cupva::SequenceDataFlowTransfer objects were configured as reads to VMEM, this API must not be used to configure a write from VMEM. Similarly, if all transfers were writes from VMEM, this API must not be used to configure a read to VMEM.
For each call to cupvaSQDFFlushAndTrig(), this API may be called a maximum of one time per transfer in the sequence.
- Parameters:
handler – The handler, declared with VMEM_SEQDF_HANDLER, which owns the target transfer.
transferIdx – Zero-based index to a transfer. The index matches the order in which transfers were added on host side using cupva::SequenceDataFlow::addTransfer()
srcAddr – New source address for the transfer. Should be an architecture address from an ExtMemPointer object, cupvaGetL2Base, cupvaSurfaceAddress2D or cupvaGetVmemAddress.
srcMemType – Memory type of srcAddr
dstAddr – New destination address for the transfer. Should be an architecture address from an ExtMemPointer object, cupvaGetL2Base, cupvaSurfaceAddress2D or cupvaGetVmemAddress.
dstMemType – Memory type of dstAddr
- inline void cupvaSQDFUpdateAddr(
- SequenceDataFlowHandler &handler,
- uint8_t const transferIdx,
- uint64_t const srcAddr,
- MemType const srcMemType,
- uint16_t const srcLp,
- uint64_t const dstAddr,
- MemType const dstMemType,
- uint16_t const dstLp,
Update transfer addresses and line pitches.
Queues an update to a SequenceDataFlow which updates the addresses and line pitches associated with a transfer. The update will be flushed during the next call to cupvaSQDFFlushAndTrig(). This API may not be called between cupvaSQDFFlushAndTrig() and the next call to cupvaSQDFSync().
If the transfer is not CONTINUOUS, the src and dst memory types must match those originally configured in host code. Passing a different memory type to a triggered transfer may lead to unpredictable triggering behavior.
For each call to cupvaSQDFFlushAndTrig(), this API may be called a maximum of one time per transfer in the sequence.
- Parameters:
handler – The handler, declared with VMEM_SEQDF_HANDLER, which owns the target transfer.
transferIdx – Zero-based index to a transfer. The index matches the order in which transfers were added on host side using cupva::SequenceDataFlow::addTransfer()
srcAddr – New source address for the transfer. Should be an architecture address from an ExtMemPointer object, cupvaGetL2Base, cupvaSurfaceAddress2D or cupvaGetVmemAddress.
srcMemType – Memory type of srcAddr
srcLp – New source line pitch for the transfer.
dstAddr – New destination address for the transfer. Should be an architecture address from an ExtMemPointer object, cupvaGetL2Base, cupvaSurfaceAddress2D or cupvaGetVmemAddress.
dstMemType – Memory type of dstAddr
dstLp – New destination line pitch for the transfer.
- inline void cupvaSQDFUpdateTileSize(
- SequenceDataFlowHandler &handler,
- uint8_t const transferIdx,
- uint16_t const tx,
- uint16_t const ty,
Update transfer tile size.
Queues an update to a SequenceDataFlow which updates the tile dimensions associated with a transfer. The update will be flushed during the next call to cupvaSQDFFlushAndTrig(). This API may not be called between cupvaSQDFFlushAndTrig() and the next call to cupvaSQDFSync().
Tx=Ty=0 is a “dummy” transfer which must be triggered as normal but will read and write no data.
For each call to cupvaSQDFFlushAndTrig(), this API may be called a maximum of one time per transfer in the sequence.
- Parameters:
handler – The handler, declared with VMEM_SEQDF_HANDLER, which owns the target transfer.
transferIdx – Zero-based index to a transfer. The index matches the order in which transfers were added on host side using cupva::SequenceDataFlow::addTransfer()
tx – New tx in bytes
ty – New ty in rows of bytes