@@ -38,8 +38,8 @@ hipStream_t ur_queue_handle_t_::getNextComputeStream(uint32_t *StreamToken) {
38
38
// The second check is done after mutex is locked so other threads can not
39
39
// change NumComputeStreams after that
40
40
if (NumComputeStreams < ComputeStreams.size ()) {
41
- UR_CHECK_ERROR (hipStreamCreateWithFlags (
42
- &ComputeStreams[NumComputeStreams++], Flags));
41
+ UR_CHECK_ERROR (hipStreamCreateWithPriority (
42
+ &ComputeStreams[NumComputeStreams++], Flags, Priority ));
43
43
}
44
44
}
45
45
Token = ComputeStreamIdx++;
@@ -97,8 +97,8 @@ hipStream_t ur_queue_handle_t_::getNextTransferStream() {
97
97
// The second check is done after mutex is locked so other threads can not
98
98
// change NumTransferStreams after that
99
99
if (NumTransferStreams < TransferStreams.size ()) {
100
- UR_CHECK_ERROR (hipStreamCreateWithFlags (
101
- &TransferStreams[NumTransferStreams++], Flags));
100
+ UR_CHECK_ERROR (hipStreamCreateWithPriority (
101
+ &TransferStreams[NumTransferStreams++], Flags, Priority ));
102
102
}
103
103
}
104
104
uint32_t Stream_i = TransferStreamIdx++ % TransferStreams.size ();
@@ -119,6 +119,19 @@ urQueueCreate(ur_context_handle_t hContext, ur_device_handle_t hDevice,
119
119
}
120
120
121
121
unsigned int Flags = 0 ;
122
+ ur_queue_flags_t URFlags = 0 ;
123
+ int Priority = 0 ; // Not guaranteed, but, in ROCm 5.7, 0 is the default
124
+
125
+ if (pProps && pProps->stype == UR_STRUCTURE_TYPE_QUEUE_PROPERTIES) {
126
+ URFlags = pProps->flags ;
127
+ if (URFlags & UR_QUEUE_FLAG_PRIORITY_HIGH) {
128
+ ScopedContext Active (hContext->getDevice ());
129
+ UR_CHECK_ERROR (hipDeviceGetStreamPriorityRange (nullptr , &Priority));
130
+ } else if (URFlags & UR_QUEUE_FLAG_PRIORITY_LOW) {
131
+ ScopedContext Active (hContext->getDevice ());
132
+ UR_CHECK_ERROR (hipDeviceGetStreamPriorityRange (&Priority, nullptr ));
133
+ }
134
+ }
122
135
123
136
const bool IsOutOfOrder =
124
137
pProps ? pProps->flags & UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE
@@ -131,7 +144,7 @@ urQueueCreate(ur_context_handle_t hContext, ur_device_handle_t hDevice,
131
144
132
145
QueueImpl = std::unique_ptr<ur_queue_handle_t_>(new ur_queue_handle_t_{
133
146
std::move (ComputeHipStreams), std::move (TransferHipStreams), hContext,
134
- hDevice, Flags, pProps ? pProps->flags : 0 });
147
+ hDevice, Flags, pProps ? pProps->flags : 0 , Priority });
135
148
136
149
*phQueue = QueueImpl.release ();
137
150
0 commit comments