gem5 v24.0.0.0
|
Classes | |
struct | hsa_queue_s |
User mode queue. More... | |
Typedefs | |
typedef uint32_t | hsa_queue_type32_t |
A fixed-size type used to represent hsa_queue_type_t constants. | |
typedef struct hsa_queue_s | hsa_queue_t |
User mode queue. | |
Enumerations | |
enum | hsa_queue_type_t { HSA_QUEUE_TYPE_MULTI = 0 , HSA_QUEUE_TYPE_SINGLE = 1 } |
Queue type. More... | |
enum | hsa_queue_feature_t { HSA_QUEUE_FEATURE_KERNEL_DISPATCH = 1 , HSA_QUEUE_FEATURE_AGENT_DISPATCH = 2 } |
Queue features. More... | |
Functions | |
hsa_status_t HSA_API | hsa_queue_create (hsa_agent_t agent, uint32_t size, hsa_queue_type32_t type, void(*callback)(hsa_status_t status, hsa_queue_t *source, void *data), void *data, uint32_t private_segment_size, uint32_t group_segment_size, hsa_queue_t **queue) |
Create a user mode queue. | |
hsa_status_t HSA_API | hsa_soft_queue_create (hsa_region_t region, uint32_t size, hsa_queue_type32_t type, uint32_t features, hsa_signal_t doorbell_signal, hsa_queue_t **queue) |
Create a queue for which the application or a kernel is responsible for processing the AQL packets. | |
hsa_status_t HSA_API | hsa_queue_destroy (hsa_queue_t *queue) |
Destroy a user mode queue. | |
hsa_status_t HSA_API | hsa_queue_inactivate (hsa_queue_t *queue) |
Inactivate a queue. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_load_read_index_acquire (const hsa_queue_t *queue) |
uint64_t HSA_API | hsa_queue_load_read_index_scacquire (const hsa_queue_t *queue) |
Atomically load the read index of a queue. | |
uint64_t HSA_API | hsa_queue_load_read_index_relaxed (const hsa_queue_t *queue) |
Atomically load the read index of a queue. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_load_write_index_acquire (const hsa_queue_t *queue) |
uint64_t HSA_API | hsa_queue_load_write_index_scacquire (const hsa_queue_t *queue) |
Atomically load the write index of a queue. | |
uint64_t HSA_API | hsa_queue_load_write_index_relaxed (const hsa_queue_t *queue) |
Atomically load the write index of a queue. | |
void HSA_API | hsa_queue_store_write_index_relaxed (const hsa_queue_t *queue, uint64_t value) |
Atomically set the write index of a queue. | |
void HSA_API HSA_DEPRECATED | hsa_queue_store_write_index_release (const hsa_queue_t *queue, uint64_t value) |
void HSA_API | hsa_queue_store_write_index_screlease (const hsa_queue_t *queue, uint64_t value) |
Atomically set the write index of a queue. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_cas_write_index_acq_rel (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
uint64_t HSA_API | hsa_queue_cas_write_index_scacq_screl (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
Atomically set the write index of a queue if the observed value is equal to the expected value. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_cas_write_index_acquire (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
uint64_t HSA_API | hsa_queue_cas_write_index_scacquire (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
Atomically set the write index of a queue if the observed value is equal to the expected value. | |
uint64_t HSA_API | hsa_queue_cas_write_index_relaxed (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
Atomically set the write index of a queue if the observed value is equal to the expected value. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_cas_write_index_release (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
uint64_t HSA_API | hsa_queue_cas_write_index_screlease (const hsa_queue_t *queue, uint64_t expected, uint64_t value) |
Atomically set the write index of a queue if the observed value is equal to the expected value. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_add_write_index_acq_rel (const hsa_queue_t *queue, uint64_t value) |
uint64_t HSA_API | hsa_queue_add_write_index_scacq_screl (const hsa_queue_t *queue, uint64_t value) |
Atomically increment the write index of a queue by an offset. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_add_write_index_acquire (const hsa_queue_t *queue, uint64_t value) |
uint64_t HSA_API | hsa_queue_add_write_index_scacquire (const hsa_queue_t *queue, uint64_t value) |
Atomically increment the write index of a queue by an offset. | |
uint64_t HSA_API | hsa_queue_add_write_index_relaxed (const hsa_queue_t *queue, uint64_t value) |
Atomically increment the write index of a queue by an offset. | |
uint64_t HSA_API HSA_DEPRECATED | hsa_queue_add_write_index_release (const hsa_queue_t *queue, uint64_t value) |
uint64_t HSA_API | hsa_queue_add_write_index_screlease (const hsa_queue_t *queue, uint64_t value) |
Atomically increment the write index of a queue by an offset. | |
void HSA_API | hsa_queue_store_read_index_relaxed (const hsa_queue_t *queue, uint64_t value) |
Atomically set the read index of a queue. | |
void HSA_API HSA_DEPRECATED | hsa_queue_store_read_index_release (const hsa_queue_t *queue, uint64_t value) |
void HSA_API | hsa_queue_store_read_index_screlease (const hsa_queue_t *queue, uint64_t value) |
Atomically set the read index of a queue. | |
typedef struct hsa_queue_s hsa_queue_t |
User mode queue.
The queue structure is read-only and allocated by the HSA runtime, but agents can directly modify the contents of the buffer pointed by base_address, or use HSA runtime APIs to access the doorbell signal.
typedef uint32_t hsa_queue_type32_t |
A fixed-size type used to represent hsa_queue_type_t constants.
enum hsa_queue_feature_t |
enum hsa_queue_type_t |
Queue type.
Intended to be used for dynamic queue protocol determination.
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_acq_rel | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_acquire | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API hsa_queue_add_write_index_relaxed | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_add_write_index_release | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API hsa_queue_add_write_index_scacq_screl | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API hsa_queue_add_write_index_scacquire | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API hsa_queue_add_write_index_screlease | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically increment the write index of a queue by an offset.
[in] | queue | Pointer to a queue. |
[in] | value | Value to add to the write index. |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_acq_rel | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_acquire | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API hsa_queue_cas_write_index_relaxed | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_cas_write_index_release | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API hsa_queue_cas_write_index_scacq_screl | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API hsa_queue_cas_write_index_scacquire | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
uint64_t HSA_API hsa_queue_cas_write_index_screlease | ( | const hsa_queue_t * | queue, |
uint64_t | expected, | ||
uint64_t | value ) |
Atomically set the write index of a queue if the observed value is equal to the expected value.
The application can inspect the returned value to determine if the replacement was done.
[in] | queue | Pointer to a queue. |
[in] | expected | Expected value. |
[in] | value | Value to assign to the write index if expected matches the observed write index. Must be greater than expected . |
hsa_status_t HSA_API hsa_queue_create | ( | hsa_agent_t | agent, |
uint32_t | size, | ||
hsa_queue_type32_t | type, | ||
void(* | callback )(hsa_status_t status, hsa_queue_t *source, void *data), | ||
void * | data, | ||
uint32_t | private_segment_size, | ||
uint32_t | group_segment_size, | ||
hsa_queue_t ** | queue ) |
Create a user mode queue.
The HSA runtime creates the queue structure, the underlying packet buffer, the completion signal, and the write and read indexes. The initial value of the write and read indexes is 0. The type of every packet in the buffer is initialized to HSA_PACKET_TYPE_INVALID.
The application should only rely on the error code returned to determine if the queue is valid.
[in] | agent | Agent where to create the queue. |
[in] | size | Number of packets the queue is expected to hold. Must be a power of 2 between 1 and the value of HSA_AGENT_INFO_QUEUE_MAX_SIZE in agent . The size of the newly created queue is the maximum of size and the value of HSA_AGENT_INFO_QUEUE_MIN_SIZE in agent . |
[in] | type | Type of the queue. If the value of HSA_AGENT_INFO_QUEUE_TYPE in agent is HSA_QUEUE_TYPE_SINGLE, then type must also be HSA_QUEUE_TYPE_SINGLE. |
[in] | callback | Callback invoked by the HSA runtime for every asynchronous event related to the newly created queue. May be NULL. The HSA runtime passes three arguments to the callback: a code identifying the event that triggered the invocation, a pointer to the queue where the event originated, and the application data. |
[in] | data | Application data that is passed to callback on every iteration. May be NULL. |
[in] | private_segment_size | Hint indicating the maximum expected private segment usage per work-item, in bytes. There may be performance degradation if the application places a kernel dispatch packet in the queue and the corresponding private segment usage exceeds private_segment_size . If the application does not want to specify any particular value for this argument, private_segment_size must be UINT32_MAX. If the queue does not support kernel dispatch packets, this argument is ignored. |
[in] | group_segment_size | Hint indicating the maximum expected group segment usage per work-group, in bytes. There may be performance degradation if the application places a kernel dispatch packet in the queue and the corresponding group segment usage exceeds group_segment_size . If the application does not want to specify any particular value for this argument, group_segment_size must be UINT32_MAX. If the queue does not support kernel dispatch packets, this argument is ignored. |
[out] | queue | Memory location where the HSA runtime stores a pointer to the newly created queue. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_OUT_OF_RESOURCES | The HSA runtime failed to allocate the required resources. |
HSA_STATUS_ERROR_INVALID_AGENT | The agent is invalid. |
HSA_STATUS_ERROR_INVALID_QUEUE_CREATION | agent does not support queues of the given type. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | size is not a power of two, size is 0, type is an invalid queue type, or queue is NULL. |
hsa_status_t HSA_API hsa_queue_destroy | ( | hsa_queue_t * | queue | ) |
Destroy a user mode queue.
When a queue is destroyed, the state of the AQL packets that have not been yet fully processed (their completion phase has not finished) becomes undefined. It is the responsibility of the application to ensure that all pending queue operations are finished if their results are required.
The resources allocated by the HSA runtime during queue creation (queue structure, ring buffer, doorbell signal) are released. The queue should not be accessed after being destroyed.
[in] | queue | Pointer to a queue created using hsa_queue_create. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_QUEUE | The queue is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | queue is NULL. |
hsa_status_t HSA_API hsa_queue_inactivate | ( | hsa_queue_t * | queue | ) |
Inactivate a queue.
Inactivating the queue aborts any pending executions and prevent any new packets from being processed. Any more packets written to the queue once it is inactivated will be ignored by the packet processor.
[in] | queue | Pointer to a queue. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_INVALID_QUEUE | The queue is invalid. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | queue is NULL. |
uint64_t HSA_API HSA_DEPRECATED hsa_queue_load_read_index_acquire | ( | const hsa_queue_t * | queue | ) |
Atomically load the read index of a queue.
[in] | queue | Pointer to a queue. |
queue
. uint64_t HSA_API hsa_queue_load_read_index_relaxed | ( | const hsa_queue_t * | queue | ) |
Atomically load the read index of a queue.
[in] | queue | Pointer to a queue. |
queue
. uint64_t HSA_API hsa_queue_load_read_index_scacquire | ( | const hsa_queue_t * | queue | ) |
Atomically load the read index of a queue.
[in] | queue | Pointer to a queue. |
queue
. uint64_t HSA_API HSA_DEPRECATED hsa_queue_load_write_index_acquire | ( | const hsa_queue_t * | queue | ) |
Atomically load the write index of a queue.
[in] | queue | Pointer to a queue. |
queue
. uint64_t HSA_API hsa_queue_load_write_index_relaxed | ( | const hsa_queue_t * | queue | ) |
Atomically load the write index of a queue.
[in] | queue | Pointer to a queue. |
queue
. uint64_t HSA_API hsa_queue_load_write_index_scacquire | ( | const hsa_queue_t * | queue | ) |
Atomically load the write index of a queue.
[in] | queue | Pointer to a queue. |
queue
. void HSA_API hsa_queue_store_read_index_relaxed | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the read index of a queue.
Modifications of the read index are not allowed and result in undefined behavior if the queue is associated with an agent for which only the corresponding packet processor is permitted to update the read index.
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the read index. |
void HSA_API HSA_DEPRECATED hsa_queue_store_read_index_release | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the read index of a queue.
Modifications of the read index are not allowed and result in undefined behavior if the queue is associated with an agent for which only the corresponding packet processor is permitted to update the read index.
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the read index. |
void HSA_API hsa_queue_store_read_index_screlease | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the read index of a queue.
Modifications of the read index are not allowed and result in undefined behavior if the queue is associated with an agent for which only the corresponding packet processor is permitted to update the read index.
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the read index. |
void HSA_API hsa_queue_store_write_index_relaxed | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the write index of a queue.
It is recommended that the application uses this function to update the write index when there is a single agent submitting work to the queue (the queue type is HSA_QUEUE_TYPE_SINGLE).
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the write index. |
void HSA_API HSA_DEPRECATED hsa_queue_store_write_index_release | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the write index of a queue.
It is recommended that the application uses this function to update the write index when there is a single agent submitting work to the queue (the queue type is HSA_QUEUE_TYPE_SINGLE).
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the write index. |
void HSA_API hsa_queue_store_write_index_screlease | ( | const hsa_queue_t * | queue, |
uint64_t | value ) |
Atomically set the write index of a queue.
It is recommended that the application uses this function to update the write index when there is a single agent submitting work to the queue (the queue type is HSA_QUEUE_TYPE_SINGLE).
[in] | queue | Pointer to a queue. |
[in] | value | Value to assign to the write index. |
hsa_status_t HSA_API hsa_soft_queue_create | ( | hsa_region_t | region, |
uint32_t | size, | ||
hsa_queue_type32_t | type, | ||
uint32_t | features, | ||
hsa_signal_t | doorbell_signal, | ||
hsa_queue_t ** | queue ) |
Create a queue for which the application or a kernel is responsible for processing the AQL packets.
The application can use this function to create queues where AQL packets are not parsed by the packet processor associated with an agent, but rather by a unit of execution running on that agent (for example, a thread in the host application).
The application is responsible for ensuring that all the producers and consumers of the resulting queue can access the provided doorbell signal and memory region. The application is also responsible for ensuring that the unit of execution processing the queue packets supports the indicated features (AQL packet types).
When the queue is created, the HSA runtime allocates the packet buffer using region
, and the write and read indexes. The initial value of the write and read indexes is 0, and the type of every packet in the buffer is initialized to HSA_PACKET_TYPE_INVALID. The value of the size, type, features, and doorbell_signal fields in the returned queue match the values passed by the application.
[in] | region | Memory region that the HSA runtime should use to allocate the AQL packet buffer and any other queue metadata. |
[in] | size | Number of packets the queue is expected to hold. Must be a power of 2 greater than 0. |
[in] | type | Queue type. |
[in] | features | Supported queue features. This is a bit-field of hsa_queue_feature_t values. |
[in] | doorbell_signal | Doorbell signal that the HSA runtime must associate with the returned queue. The signal handle must not be 0. |
[out] | queue | Memory location where the HSA runtime stores a pointer to the newly created queue. The application should not rely on the value returned for this argument but only in the status code to determine if the queue is valid. Must not be NULL. |
HSA_STATUS_SUCCESS | The function has been executed successfully. |
HSA_STATUS_ERROR_NOT_INITIALIZED | The HSA runtime has not been initialized. |
HSA_STATUS_ERROR_OUT_OF_RESOURCES | The HSA runtime failed to allocate the required resources. |
HSA_STATUS_ERROR_INVALID_ARGUMENT | size is not a power of two, size is 0, type is an invalid queue type, the doorbell signal handle is 0, or queue is NULL. |