Accessing PCIe port on the Xavier AGX via a C++ application

I am making an application in which an FPGA Hardware (end point) device is going to send a large amount of data to my Xavier AGX(root complex) using the PCIe port. After receiving the data via a C++ application, the application than passes the data to the GPU of the AGX device for further processing.
Can the Xavier port be accessed via C++ or other drivers ?? If so, is there any example or tutorial regarding this ?

The way this generally works in Linux, is that you develop a driver (loadable kernel module) that configures the PCIe hardware and DMA/IOMMU for the transfer, and uses the kernel-level control of the bus to talk to your ASIC.

The user-space C++ application will then use whatever API you choose to develop in your driver, to refer to the data. Typically you will want your driver to allocate mappable memory that you can read/write directly, without having to copy it in/out using read/write syscalls; typically in turn this will be set up using a series of IOCTL calls. You can look at the Video4Linux2 API to see one example where this is done. (V4L2 also defines read/write variants of the I/O protocol.)

On a unified-memory device like the Xavier, you really want the GPU to use the same memory that you DMA into directly, so you’ll want to figure out how to hand off the memory-mapped buffers from your driver to the GPU API. It may be that the best way to go about this, is for the API for your driver to have the application configure the buffers to use, and the application can in turn ask CUDA for the buffers in question, and then it’s up to the application to receive notification from your driver, that it can forward to the GPU.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.