1. About This Book
  2. Licenses
  3. 1. Hardware
    1. 1.1. Cache
  4. 2. Using the gpu
  5. 3. Buffer Object Metadata
  6. 4. DRM
    1. 4.1. flush
    2. 4.2. mmap
    3. 4.3. ioctl
    4. 4.4. poll
    5. 4.5. read
    6. 4.6. /proc/*/fdinfo/*
    7. 4.7. GEM objects
    8. 4.8. Command Submission
    9. 4.9. Modesetting
    10. 4.10. UserQ
  7. 5. KFD
    1. 5.1. ioctl
    2. 5.2. mmap
    3. 5.3. Opening KFD
    4. 5.4. Device Apertures
    5. 5.5. Tiling/Swizzling Mode
    6. 5.6. Preparing for memory operations
    7. 5.7. Allocating and releasing GPU aware memory
    8. 5.8. Mapping memory to GPU's address space
    9. 5.9. Sharing memory between processes
    10. 5.10. Shared Virtual Memory (SVM)
    11. 5.11. Scheduling commands to gpus with User Queues
    12. 5.12. Syncronizing with gpu via Events
    13. 5.13. Monitoring for system events with System Management Interface (SMI)
    14. 5.14. Profiling gpus
    15. 5.15. Handling device traps and debugging other processes
    16. 5.16. Checkpoint Restore In Userspace (CRIU)
    17. 5.17. Compute Wave Store Resume (CWSR)
  8. 6. Monitoring gpu state
    1. 6.1. Tools
  9. 7. Useful tips
  10. 8. Dictionary

Unofficial Amdgpu Documentation

IOCTLs

Add AMDKFD_IOC_ to each to get C definitions.

For more info look into kernel/include/uapi/linux/kfd_ioctl.h

Implementation can be found in kernel/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

On errors

AMDGPU driver doesn't have a clear error api. A lot of them get propagated through internal calls, which makes it hard to know which error values to expect.

But these errors should be a part of stable ABI.

Uncategorized

  • GET_VERSION
  • SET_MEMORY_POLICY
  • GET_CLOCK_COUNTERS
  • SVM
  • SET_XNACK_MODE
  • CRIU_OP
  • SMI_EVENTS

Query devices

  • GET_PROCESS_APERTURES
  • GET_PROCESS_APERTURES_NEW

Queues

  • CREATE_QUEUE
  • UPDATE_QUEUE
  • DESTROY_QUEUE
  • SET_CU_MASK
  • GET_QUEUE_WAVE_STATE
  • ALLOC_QUEUE_GWS

Memory operations

  • ACQUIRE_VM
  • AVAILABLE_MEMORY
  • ALLOC_MEMORY_OF_GPU
  • FREE_MEMORY_OF_GPU
  • MAP_MEMORY_TO_GPU
  • UNMAP_MEMORY_FROM_GPU
  • SET_SCRATCH_BACKING_VA
  • GET_TILE_CONFIG

DMABUF

  • GET_DMABUF_INFO
  • IMPORT_DMABUF
  • EXPORT_DMABUF

Events

  • CREATE_EVENT
  • DESTROY_EVENT
  • SET_EVENT
  • RESET_EVENT
  • WAIT_EVENTS

Debug

  • SET_TRAP_HANDLER
  • RUNTIME_ENABLE
  • DBG_TRAP

Deprecated

  • DBG_REGISTER_DEPRECATED
  • DBG_UNREGISTER_DEPRECATED
  • DBG_ADDRESS_WATCH_DEPRECATED
  • DBG_WAVE_CONTROL_DEPRECATED