CYNQ  0.3.0
Framework to develop FPGA applications in C++ with the easiness of PYNQ
cynq::XRTDataMover Class Reference

XRTDataMover class Provides the API to interact with the data buffers responsible for memory operations making use of the Xilinx Runtime (XRT). More...

#include <datamover.hpp>

Inheritance diagram for cynq::XRTDataMover:
Collaboration diagram for cynq::XRTDataMover:

Public Member Functions

 XRTDataMover (const uint64_t addr, std::shared_ptr< HardwareParameters > hwparams)
 Construct a new XRTDataMover object. More...
 
 XRTDataMover ()=delete
 Default constructor. More...
 
virtual ~XRTDataMover ()
 ~XRTDataMover destructor method Destroy the XRTDataMover object.
 
std::shared_ptr< IMemoryGetBuffer (const size_t size, const int memory_bank=0, const MemoryType type=MemoryType::Dual) override
 GetBuffer method This method allocates a memory buffer. Depending on the MemoryType, it allocates memory in a contiguous or memory region (non-pageable) or non contiguous memory region depending on the Memory. The memory can be mirrored with pageable memory for its use in the host (or CPU). More...
 
Status Upload (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype) override
 Upload method. More...
 
Status Download (const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype) override
 Download method. More...
 
Status Sync (const SyncType type) override
 Sync method. More...
 
DeviceStatus GetStatus () override
 GetStatus method Returns the status of the data mover in terms of transactions. More...
 
- Public Member Functions inherited from cynq::IDataMover
virtual ~IDataMover ()=default
 ~IDataMover destructor method Destroy the IDataMover object.
 
virtual Status Upload (std::shared_ptr< IExecutionGraph > graph, const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)
 Upload method (asynchronous) Please, refer to IDataMover::Upload for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 
virtual Status Download (std::shared_ptr< IExecutionGraph > graph, const std::shared_ptr< IMemory > mem, const size_t size, const size_t offset, const ExecutionType exetype)
 Download method (asynchronous) Please, refer to IDataMover::Download for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 
virtual Status Sync (std::shared_ptr< IExecutionGraph > graph, const SyncType type)
 Sync method (asynchronous) Please, refer to IDataMover::Sync for reference. This overload performs an asynchronous execution of the function based on a graph of operations. It returns as soon as the operation is scheduled. More...
 

Additional Inherited Members

- Public Types inherited from cynq::IDataMover
enum  Type { None = 0 , DMA , XRT }
 Type Type of runtime supported by the IDataMover. More...
 
- Static Public Member Functions inherited from cynq::IDataMover
static std::shared_ptr< IDataMoverCreate (IDataMover::Type impl, const uint64_t addr, std::shared_ptr< HardwareParameters > hwparams)
 Create method Factory method used for creating specific subclasses of IDataMover. More...
 

Detailed Description

XRTDataMover class Provides the API to interact with the data buffers responsible for memory operations making use of the Xilinx Runtime (XRT).

Constructor & Destructor Documentation

◆ XRTDataMover() [1/2]

cynq::XRTDataMover::XRTDataMover ( const uint64_t  addr,
std::shared_ptr< HardwareParameters hwparams 
)

Construct a new XRTDataMover object.

This constructs a data mover that uses XRT to execute the transfers between the host and the device. Moreover, it uses XRT buffer object as memory buffers.

Parameters
addrXRT address in the physical memory map
hwparamsHardware-specific params

◆ XRTDataMover() [2/2]

cynq::XRTDataMover::XRTDataMover ( )
delete

Default constructor.

The default constructor is deleted since the address is mandatory for the XRT transfer.

Member Function Documentation

◆ Download()

Status cynq::XRTDataMover::Download ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
overridevirtual

Download method.

This method moves the data from the device to the host using a XRT engine. In the case of XRT-based allocators. It invokes the IMemory::Sync if execution type is ExecutionType::Sync

Parameters
memIMemory instance to download.
sizeSize in bytes of data being downloaded from the memory device by making use of the buffer.
offsetOffset in bytes where the device pointer should start
exetypeThe execution type to use for the download, this is either sync (synchronous) or async (asynchronous) execution.
Returns
Status

Implements cynq::IDataMover.

◆ GetBuffer()

std::shared_ptr< IMemory > cynq::XRTDataMover::GetBuffer ( const size_t  size,
const int  memory_bank = 0,
const MemoryType  type = MemoryType::Dual 
)
overridevirtual

GetBuffer method This method allocates a memory buffer. Depending on the MemoryType, it allocates memory in a contiguous or memory region (non-pageable) or non contiguous memory region depending on the Memory. The memory can be mirrored with pageable memory for its use in the host (or CPU).

Parameters
sizeSize in bytes of the buffer.
typeOne of the values in the MemoryType enum class which can be one of the following:
  • Dual (DIMM memory)
  • Cacheable (cache)
  • Host (Memory from the host)
  • Device (Memory from the device to be mapped)
Parameters
memory_bankMemory bank corresponding to the memory to be allocated. Use the IAccelerator::GetMemoryBank(pos) to query the corresponding memory bank
Returns
std::shared_ptr<IMemory>

Implements cynq::IDataMover.

◆ GetStatus()

DeviceStatus cynq::XRTDataMover::GetStatus ( )
overridevirtual

GetStatus method Returns the status of the data mover in terms of transactions.

Returns
DeviceStatus

Implements cynq::IDataMover.

◆ Sync()

Status cynq::XRTDataMover::Sync ( const SyncType  type)
overridevirtual

Sync method.

Synchronizes data movements in case of asynchronous Upload/Download.

Parameters
typesync type. Depending on the transaction, it will trigger sync
Returns
Status

Implements cynq::IDataMover.

◆ Upload()

Status cynq::XRTDataMover::Upload ( const std::shared_ptr< IMemory mem,
const size_t  size,
const size_t  offset,
const ExecutionType  exetype 
)
overridevirtual

Upload method.

This method moves the data from the host to the device using a XRT engine. In the case of XRT-based allocators. It invokes the IMemory::Sync if execution type is ExecutionType::Sync

Parameters
memXRTMemory instance to upload.
sizeSize in bytes of data being uploaded in the memory device by making use of the buffer.
offsetOffset in bytes where the device pointer should start
exetypeThe execution type to use for the upload, this is either sync (synchronous) or async (asynchronous) execution.
Returns
Status

Implements cynq::IDataMover.


The documentation for this class was generated from the following files: