Make HSA_QUEUE_TYPE_COOPERATIVE a queue type value

- Correct defintion of HSA_QUEUE_TYPE_COOPERATIVE to be a queue type
  and not a bit mask.
- Correct implementation of hsa_queue_type_t to treat is as an
  enumeration type and not a bit mask. In particular
  HSA_QUEUE_TYPE_COOPERATIVE is a distinct queue type that uses the
  multi producer protocol, and is not a bit set value.

Change-Id: I9415be8853671e5511e16e306caf16020e8c84af


[ROCm/ROCR-Runtime commit: bccb25fc33]
This commit is contained in:
Tony committed 2020-05-07 19:24:19 -04:00
1 förälder b5f6574895
incheckning fbb4e4c2c3
4 files changed
+26 -30

No files matched your search

@@ -309,7 +309,7 @@ AqlQueue::~AqlQueue() {
}
void AqlQueue::Destroy() {
if (amd_queue_.hsa_queue.type & HSA_QUEUE_TYPE_COOPERATIVE) {
if (amd_queue_.hsa_queue.type == HSA_QUEUE_TYPE_COOPERATIVE) {
agent_->GWSRelease();
return;
}
@@ -598,7 +598,7 @@ void GpuAgent::InitGWS() {
if (status != HSAKMT_STATUS_SUCCESS)
throw AMD::hsa_exception(HSA_STATUS_ERROR_OUT_OF_RESOURCES, "GWS allocation failed.");
queue->amd_queue_.hsa_queue.type = HSA_QUEUE_TYPE_COOPERATIVE | HSA_QUEUE_TYPE_MULTI;
queue->amd_queue_.hsa_queue.type = HSA_QUEUE_TYPE_COOPERATIVE;
gws_queue_.ref_ct_ = 0;
return queue.release();
});
@@ -933,7 +933,7 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type,
uint32_t group_segment_size,
core::Queue** queue) {
// Handle GWS queues.
if (queue_type & HSA_QUEUE_TYPE_COOPERATIVE) {
if (queue_type == HSA_QUEUE_TYPE_COOPERATIVE) {
ScopedAcquire<KernelMutex> lock(&gws_queue_.lock_);
auto ret = (*gws_queue_.queue_).get();
if (ret != nullptr) {
@@ -700,13 +700,8 @@ hsa_status_t hsa_queue_create(
agent->GetInfo(HSA_AGENT_INFO_QUEUE_TYPE, &agent_queue_type);
assert(HSA_STATUS_SUCCESS == status);
if (agent_queue_type == HSA_QUEUE_TYPE_SINGLE &&
((type & HSA_QUEUE_TYPE_SINGLE) != HSA_QUEUE_TYPE_SINGLE)) {
return HSA_STATUS_ERROR_INVALID_QUEUE_CREATION;
}
if ((type & HSA_QUEUE_TYPE_COOPERATIVE) &&
((type & HSA_QUEUE_TYPE_SINGLE) != HSA_QUEUE_TYPE_MULTI)) {
if ((agent_queue_type == HSA_QUEUE_TYPE_SINGLE) &&
(type != HSA_QUEUE_TYPE_SINGLE)) {
return HSA_STATUS_ERROR_INVALID_QUEUE_CREATION;
}