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.
- Functions for interaction with the kernel module which issues hardware-specific commands to the device
- Functions for allocating memory accessible to the device
- Create context, see dmp_dv_context_create.
- Allocate memory for input/output and weights, see dmp_dv_mem_alloc.
- Map memory to user virtual address space, see dmp_dv_mem_map.
- Fill weights:
- Call dmp_dv_mem_sync_start
- Fill weights buffer with packed weights (pack them in advance with the tool or at runtime using Driver API)
- Call dmp_dv_mem_sync_end.
- Optionally unmap weights buffer from user virtual address space, see dmp_dv_mem_unmap.
- Create command list, see dmp_dv_cmdlist_create.
- Add the commands to command list with dmp_dv_cmdlist_add_raw.
- Commit command list, see dmp_dv_cmdlist_commit.
- Fill input:
- Call dmp_dv_mem_sync_start
- Fill the input in WHC8 format: {width, height, first 8 channels}, {width, height, second 8 channels}, ...
- Call dmp_dv_mem_sync_end.
- Execute command list, see dmp_dv_cmdlist_exec.
- Wait for the command list completion, see dmp_dv_cmdlist_wait.
- Read output:
- Call dmp_dv_mem_sync_start
- Examine an output (will be in WHC8 format)
- Call dmp_dv_mem_sync_end.
- Process next input if needed: step 9.
- Release command list, see dmp_dv_cmdlist_release.
- Release allocated memory, see dmp_dv_mem_release.
- Release context, see dmp_dv_context_release.
#include <dmpdv.h>
- Link with:
- if using C++:
-ldmpdv
- if using C:
-ldmpdv -lstdc++
- if using C++: