User Space Driver - DigitalMediaProfessionals/dv-sdk GitHub Wiki

This chapter describes low-level User-space API for working with AI processor, for high level API for inference of neural networks trained using Caffe or Keras see the Tool.

User-space driver API provides:

  • Functions for interaction with the kernel module which issues hardware-specific commands to the device
  • Functions for allocating memory accessible to the device

User Application -> Driver Interface -> Kernel Module -> FPGA

Application workflow example:

  1. Create context, see dmp_dv_context_create.
  2. Allocate memory for input/output and weights, see dmp_dv_mem_alloc.
  3. Map memory to user virtual address space, see dmp_dv_mem_map.
  4. Fill weights:
  5. Optionally unmap weights buffer from user virtual address space, see dmp_dv_mem_unmap.
  6. Create command list, see dmp_dv_cmdlist_create.
  7. Add the commands to command list with dmp_dv_cmdlist_add_raw.
  8. Commit command list, see dmp_dv_cmdlist_commit.
  9. Fill input:
  10. Execute command list, see dmp_dv_cmdlist_exec.
  11. Wait for the command list completion, see dmp_dv_cmdlist_wait.
  12. Read output:
  13. Process next input if needed: step 9.
  14. Release command list, see dmp_dv_cmdlist_release.
  15. Release allocated memory, see dmp_dv_mem_release.
  16. Release context, see dmp_dv_context_release.

Compiling applications:

  1. #include <dmpdv.h>
  2. Link with:
    • if using C++: -ldmpdv
    • if using C: -ldmpdv -lstdc++
⚠️ **GitHub.com Fallback** ⚠️