AMD_DBGAPI  0.46.0
Data Structures | Macros | Enumerations | Functions
Queues

Operations related to AMD GPU queues. More...

Data Structures

struct  amd_dbgapi_queue_id_t
 Opaque queue handle. More...
 

Macros

#define AMD_DBGAPI_QUEUE_NONE   ((amd_dbgapi_queue_id_t){ 0 })
 The NULL queue handle. More...
 

Enumerations

enum  amd_dbgapi_queue_info_t {
  AMD_DBGAPI_QUEUE_INFO_AGENT = 1, AMD_DBGAPI_QUEUE_INFO_PROCESS = 2, AMD_DBGAPI_QUEUE_INFO_ARCHITECTURE = 3, AMD_DBGAPI_QUEUE_INFO_TYPE = 4,
  AMD_DBGAPI_QUEUE_INFO_STATE = 5, AMD_DBGAPI_QUEUE_INFO_ERROR_REASON = 6, AMD_DBGAPI_QUEUE_INFO_ADDRESS = 7, AMD_DBGAPI_QUEUE_INFO_SIZE = 8,
  AMD_DBGAPI_QUEUE_INFO_OS_ID = 9
}
 Queue queries that are supported by amd_dbgapi_queue_get_info. More...
 
enum  amd_dbgapi_queue_state_t { AMD_DBGAPI_QUEUE_STATE_VALID = 1, AMD_DBGAPI_QUEUE_STATE_ERROR = 2 }
 Queue state. More...
 
enum  amd_dbgapi_queue_error_reason_t {
  AMD_DBGAPI_QUEUE_ERROR_REASON_NONE = 0ULL, AMD_DBGAPI_QUEUE_ERROR_REASON_INVALID_PACKET = (1ULL << 0), AMD_DBGAPI_QUEUE_ERROR_REASON_MEMORY_VIOLATION = (1ULL << 1), AMD_DBGAPI_QUEUE_ERROR_REASON_ASSERT_TRAP = (1ULL << 2),
  AMD_DBGAPI_QUEUE_ERROR_REASON_WAVE_ERROR = (1ULL << 3), AMD_DBGAPI_QUEUE_ERROR_REASON_RESERVED = (1ULL << 63)
}
 A bit mask of the reasons that a queue is in error. More...
 

Functions

amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_queue_get_info (amd_dbgapi_queue_id_t queue_id, amd_dbgapi_queue_info_t query, size_t value_size, void *value) AMD_DBGAPI_VERSION_0_41
 Query information about a queue. More...
 
amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_process_queue_list (amd_dbgapi_process_id_t process_id, size_t *queue_count, amd_dbgapi_queue_id_t **queues, amd_dbgapi_changed_t *changed) AMD_DBGAPI_VERSION_0_41
 Return the list of queues. More...
 
amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_queue_packet_list (amd_dbgapi_queue_id_t queue_id, amd_dbgapi_os_queue_packet_id_t *read_packet_id, amd_dbgapi_os_queue_packet_id_t *write_packet_id, size_t *packets_byte_size, void **packets_bytes) AMD_DBGAPI_VERSION_0_41
 Return the packets for a queue. More...
 

Detailed Description

Operations related to AMD GPU queues.

Queues are user mode data structures that allow packets to be inserted that control the AMD GPU agents. The dispatch packet is used to initiate the execution of a grid of waves.

Macro Definition Documentation

◆ AMD_DBGAPI_QUEUE_NONE

#define AMD_DBGAPI_QUEUE_NONE   ((amd_dbgapi_queue_id_t){ 0 })

The NULL queue handle.

Enumeration Type Documentation

◆ amd_dbgapi_queue_error_reason_t

A bit mask of the reasons that a queue is in error.

Enumerator
AMD_DBGAPI_QUEUE_ERROR_REASON_NONE 

If none of the bits are set, then the queue is not in the error state.

AMD_DBGAPI_QUEUE_ERROR_REASON_INVALID_PACKET 

A packet on the queue is invalid.

AMD_DBGAPI_QUEUE_ERROR_REASON_MEMORY_VIOLATION 

A wave on the queue had a memory violation.

AMD_DBGAPI_QUEUE_ERROR_REASON_ASSERT_TRAP 

A wave on the queue had an assert trap.

AMD_DBGAPI_QUEUE_ERROR_REASON_WAVE_ERROR 

A wave on the queue executed an instruction that caused an error.

The AMD_DBGAPI_WAVE_INFO_STOP_REASON query can be used on the waves of the queue to determine the exact reason.

AMD_DBGAPI_QUEUE_ERROR_REASON_RESERVED 

A reserved value only present to ensure that the underlying representation of this enumeration type is uint64_t.

◆ amd_dbgapi_queue_info_t

Queue queries that are supported by amd_dbgapi_queue_get_info.

Each query specifies the type of data returned in the value argument to amd_dbgapi_queue_get_info.

Enumerator
AMD_DBGAPI_QUEUE_INFO_AGENT 

Return the agent to which this queue belongs.

The type of this attribute is amd_dbgapi_agent_id_t.

AMD_DBGAPI_QUEUE_INFO_PROCESS 

Return the process to which this queue belongs.

The type of this attribute is amd_dbgapi_process_id_t.

AMD_DBGAPI_QUEUE_INFO_ARCHITECTURE 

Return the architecture of this queue.

The type of this attribute is amd_dbgapi_architecture_id_t.

AMD_DBGAPI_QUEUE_INFO_TYPE 

Return the queue type.

The type of this attribute is uint32_t with values from amd_dbgapi_os_queue_type_t.

AMD_DBGAPI_QUEUE_INFO_STATE 

Return the queue state.

The type of this attribute is uint32_t with values from amd_dbgapi_queue_state_t.

AMD_DBGAPI_QUEUE_INFO_ERROR_REASON 

Return the reason the queue is in error as a bit set.

If the queue is not in the error state then AMD_DBGAPI_QUEUE_ERROR_REASON_NONE is returned. The type of this attribute is uint64_t with values defined by amd_dbgapi_queue_error_reason_t.

AMD_DBGAPI_QUEUE_INFO_ADDRESS 

Return the base address of the memory holding the queue packets.

The type of this attribute is amd_dbgapi_global_address_t.

AMD_DBGAPI_QUEUE_INFO_SIZE 

Return the size in bytes of the memory holding the queue packets.

The type of this attribute is amd_dbgapi_size_t.

AMD_DBGAPI_QUEUE_INFO_OS_ID 

Native operating system queue ID.

The type of this attribute is amd_dbgapi_os_queue_id_t.

◆ amd_dbgapi_queue_state_t

Queue state.

Enumerator
AMD_DBGAPI_QUEUE_STATE_VALID 

Queue is in a valid state.

AMD_DBGAPI_QUEUE_STATE_ERROR 

Queue is in an error state.

When a queue enters the error state, a wave stop event will be created for all non-stopped waves. All waves of the queue will include the AMD_DBGAPI_WAVE_STOP_REASON_QUEUE_ERROR stop reason.

Function Documentation

◆ amd_dbgapi_process_queue_list()

amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_process_queue_list ( amd_dbgapi_process_id_t  process_id,
size_t *  queue_count,
amd_dbgapi_queue_id_t **  queues,
amd_dbgapi_changed_t changed 
)

Return the list of queues.

The order of the queue handles in the list is unspecified and can vary between calls.

Parameters
[in]process_idIf AMD_DBGAPI_PROCESS_NONE then the queue list for all processes is requested. Otherwise, the queue list of process process_id is requested.
[out]queue_countThe number of queues accessed by the process.
[out]queuesIf changed is not NULL and the queues list of all of the processes requested have not changed since the last call(s) to amd_dbgapi_process_queue_list for each of them, then return NULL. Otherwise, return a pointer to an array of amd_dbgapi_queue_id_t with queue_count elements. It is allocated by the amd_dbgapi_callbacks_s::allocate_memory callback and is owned by the client.
[in,out]changedIf NULL then left unaltered. If non-NULL, set to AMD_DBGAPI_CHANGED_NO if the list of queues for each requested process is the same as when amd_dbgapi_process_queue_list was last called for them. Otherwise set to AMD_DBGAPI_CHANGED_YES.
Return values
AMD_DBGAPI_STATUS_SUCCESSThe function has been executed successfully and the result is stored in changed, queue_count, and queues.
AMD_DBGAPI_STATUS_FATALA fatal error occurred. The library is left uninitialized; and queue_count, queues, and changed are unaltered.
AMD_DBGAPI_STATUS_ERROR_NOT_INITIALIZEDThe library is not initialized. The library is left uninitialized; and queue_count, queues, and changed are unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_PROCESS_IDprocess_id is invalid. queue_count, queues, and changed are unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENTqueue_count or queues are NULL, or changed is invalid. queue_count, queues, and changed are unaltered.
AMD_DBGAPI_STATUS_ERROR_CLIENT_CALLBACKThis will be reported if the amd_dbgapi_callbacks_s::allocate_memory callback used to allocate queues returns NULL. queue_count, queues, and changed are unaltered.

◆ amd_dbgapi_queue_get_info()

amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_queue_get_info ( amd_dbgapi_queue_id_t  queue_id,
amd_dbgapi_queue_info_t  query,
size_t  value_size,
void *  value 
)

Query information about a queue.

amd_dbgapi_queue_info_t specifies the queries supported and the type returned using the value argument.

Parameters
[in]queue_idThe handle of the queue being queried.
[in]queryThe query being requested.
[out]valuePointer to memory where the query result is stored.
[in]value_sizeSize of the memory pointed to by value. Must be equal to the byte size of the query result.
Return values
AMD_DBGAPI_STATUS_SUCCESSThe function has been executed successfully and the result is stored in value.
AMD_DBGAPI_STATUS_FATALA fatal error occurred. The library is left uninitialized and value is unaltered.
AMD_DBGAPI_STATUS_ERROR_NOT_INITIALIZEDThe library is not initialized. The library is left uninitialized and value is unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_QUEUE_IDqueue_id is invalid. value is unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENTvalue is NULL or query is invalid. value is unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENT_COMPATIBILITYvalue_size does not match the size of the query result. value is unaltered.
AMD_DBGAPI_STATUS_ERROR_CLIENT_CALLBACKThis will be reported if the amd_dbgapi_callbacks_s::allocate_memory callback used to allocate value returns NULL. value is unaltered.

◆ amd_dbgapi_queue_packet_list()

amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_queue_packet_list ( amd_dbgapi_queue_id_t  queue_id,
amd_dbgapi_os_queue_packet_id_t read_packet_id,
amd_dbgapi_os_queue_packet_id_t write_packet_id,
size_t *  packets_byte_size,
void **  packets_bytes 
)

Return the packets for a queue.

Since the AMD GPU is asynchronously reading the packets this is only a snapshot of the packets present in the queue, and only includes the packets that the producer has made available to the queue. In obtaining the snapshot the library may pause the queue processing in order to get a consistent snapshot.

The queue packets are returned as a byte block that the client must interpret according to the packet ABI determined by the queue type available using the ::AMD_DBGAPI_QUEUE_TYPE query. See amd_dbgapi_os_queue_type_t.

Parameters
[in]queue_idThe queue for which the packet list is requested.
[out]read_packet_idThe packet ID for the next packet to be read from the queue. It corresponds to the first packet in packets_bytes. If packets_byte_size is zero, then the packet ID for the next packet added to the queue.
[out]write_packet_idThe packet ID for the next packet to be written to the queue. It corresponds to the next packet after the last packet in packets_bytes. If packets_byte_size is zero, then the packet ID for the next packet added to the queue.
[out]packets_byte_sizeThe number of bytes of packets on the queue.
[out]packets_bytesIf non-NULL, it references a pointer to an array of packets_byte_size bytes which is allocated by the amd_dbgapi_callbacks_s::allocate_memory callback and is owned by the client. If NULL, the packet bytes are not returned, just packets_byte_size.
Return values
AMD_DBGAPI_STATUS_SUCCESSThe function has been executed successfully and the result is stored in read_packet_id, write_packet_id, packets_byte_size and packets_bytes.
AMD_DBGAPI_STATUS_FATALA fatal error occurred. The library is left uninitialized; and read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.
AMD_DBGAPI_STATUS_ERROR_NOT_INITIALIZEDThe library is not initialized. The library is left uninitialized; and read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.
AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENTread_packet_id, write_packet_id, or packets_byte_size are NULL. read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.
AMD_DBGAPI_STATUS_ERROR_NOT_SUPPORTEDqueue_id has a queue type that is not supported. read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.
AMD_DBGAPI_STATUS_ERRORAn error was encountered when attempting to access the queue queue_id. For example, the queue may be corrupted. read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.
AMD_DBGAPI_STATUS_ERROR_CLIENT_CALLBACKThis will be reported if the amd_dbgapi_callbacks_s::allocate_memory callback used to allocate packets_bytes returns NULL. read_packet_id, write_packet_id, packets_byte_size and packets_bytes are unaltered.