This class represents the global memory (DDR) resource management and data
transfer between AI Engine and global
memory (DDR). The input_gmio
object manages data
transfer from global memory (DDR) to AI Engine or
read from global memory (DDR) operation. The output_gmio
object manages data transfer from AI Engine to global memory or write to global memory (DDR) operation.
Base Class Member Functions
static void* malloc(size_t size);
malloc
method allocates
contiguous physical memory space and returns the corresponding virtual address. It
accepts a parameter, size
, to specify how many
bytes to be allocated. If successful, the pointer to the allocated memory space is
returned. nullptr
is returned in the event of a
failure.static void free(void* address);
free
method frees memory space
allocated by GMIO::malloc
.return_code wait();
wait
method blocks until all the
previously issued transactions are complete. This method is only applicable for
GMIO
objects connected to AI Engine.input_gmio
and output_gmio
classes are derived from GMIO base
class. Functions malloc()
, free()
, and wait()
are declared in the GMIO base class.input_gmio Member Functions
create(std::string logical_name, size_t burst_length, size_t bandwidth);
The above port specification is used to connect DDR memory
to AI Engine kernels. logical_name
is the name of the port. The burst_length
is the length of DDR memory burst transaction (can be 64,
128 or 256 bytes), and the bandwidth
is the
average expected throughput in MB/s.
create(size_t burst_length, size_t bandwidth);
burst_length
is the length of DDR memory burst
transaction (can be 64, 128 or 256 bytes), and the bandwidth
is the average expected throughput in
MB/s.return_code gm2aie_nb(const void* address, size_t transaction_size);
gm2aie_nb
method initiates a DDR to
AI Engine transfer. The memory
space for the transaction is specified by the address pointer and the
transaction_size parameter (in bytes). The transaction memory space needs to be
within the total memory space allocated by the GMIO::malloc
method. It is a non-blocking function in that it does not
wait for the read transaction to
complete.return_code gm2aie(void* address, size_t transaction_size);
The gm2aie
method is a blocking
version of gm2aie_nb
. It blocks until the AI Engine–DDR read transaction completes.
output_gmio Member Functions
create(std::string logical_name, size_t burst_length, size_t bandwidth);
logical_name
is the name of the port. The burst_length
is the length of DDR memory burst transaction (can be 64,
128 or 256 bytes), and the bandwidth
is the
average expected throughput in
MB/s.create(size_t burst_length, size_t bandwidth);
burst_length
is the length of DDR memory burst
transaction (can be 64, 128 or 256 bytes), and the bandwidth
is the average expected throughput in
MB/s.return_code aie2gm_nb(void* address, size_t transaction_size);
aie2gm_nb
method initiates an AI Engine to DDR transfer. The memory space
for the transaction is specified by the address pointer and the transaction_size
parameter (in bytes). The transaction memory space needs to be within the total
memory space allocated by the GMIO::malloc
method.
It is a non-blocking function in that it does not wait for the write transaction to
complete.return_code aie2gm(void* address, size_t transaction_size);
The aie2gm
method is a blocking
version of aie2gm_nb
. It blocks until the AI Engine–DDR write transaction completes.
GMIO::malloc()
and GMIO::free()
to manage DDR memory resources.