Skip to content

Commit dd8b470

Browse files
author
Konrad Kusiak
committed
Made hip use non-blocking stream by default
1 parent de7c66e commit dd8b470

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/adapters/hip/queue.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ urQueueCreate(ur_context_handle_t hContext, ur_device_handle_t hDevice,
117117
try {
118118
std::unique_ptr<ur_queue_handle_t_> QueueImpl{nullptr};
119119

120-
unsigned int Flags = 0;
120+
unsigned int Flags = hipStreamNonBlocking;
121121
ur_queue_flags_t URFlags = 0;
122122
int Priority = 0; // Not guaranteed, but, in ROCm 5.0-6.0, 0 is the default
123-
124123
if (pProps && pProps->stype == UR_STRUCTURE_TYPE_QUEUE_PROPERTIES) {
125124
URFlags = pProps->flags;
125+
if (URFlags == UR_QUEUE_FLAG_USE_DEFAULT_STREAM) {
126+
Flags = hipStreamDefault;
127+
} else if (URFlags == UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) {
128+
Flags = 0;
129+
}
130+
126131
if (URFlags & UR_QUEUE_FLAG_PRIORITY_HIGH) {
127132
ScopedContext Active(hDevice);
128133
UR_CHECK_ERROR(hipDeviceGetStreamPriorityRange(nullptr, &Priority));
@@ -143,7 +148,7 @@ urQueueCreate(ur_context_handle_t hContext, ur_device_handle_t hDevice,
143148

144149
QueueImpl = std::unique_ptr<ur_queue_handle_t_>(new ur_queue_handle_t_{
145150
std::move(ComputeHipStreams), std::move(TransferHipStreams), hContext,
146-
hDevice, Flags, pProps ? pProps->flags : 0, Priority});
151+
hDevice, Flags, URFlags, Priority});
147152

148153
*phQueue = QueueImpl.release();
149154

0 commit comments

Comments
 (0)