Merge "SWDEV-193956 - [hipclang-vdi-rocm][perf]" into amd-master-next
[ROCm/clr commit: a083dc8547]
This commit is contained in:
commit
28fb4e50bb
2 files changed
+26
-5
No files matched your search
@@ -50,6 +50,9 @@ void init() {
|
|||||||
amd::Context* context = new amd::Context(device, amd::Context::Info());
|
amd::Context* context = new amd::Context(device, amd::Context::Info());
|
||||||
if (!context) return;
|
if (!context) return;
|
||||||
|
|
||||||
|
// Enable active wait on the device by default
|
||||||
|
devices[i]->SetActiveWait(true);
|
||||||
|
|
||||||
if (context && CL_SUCCESS != context->create(nullptr)) {
|
if (context && CL_SUCCESS != context->create(nullptr)) {
|
||||||
context->release();
|
context->release();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -491,16 +491,34 @@ hipError_t hipSetDevice ( int device ) {
|
|||||||
hipError_t hipSetDeviceFlags ( unsigned int flags ) {
|
hipError_t hipSetDeviceFlags ( unsigned int flags ) {
|
||||||
HIP_INIT_API(hipSetDeviceFlags, flags);
|
HIP_INIT_API(hipSetDeviceFlags, flags);
|
||||||
|
|
||||||
/* FIXME */
|
constexpr uint32_t supportedFlags =
|
||||||
/* Not all of Ctx may be implemented */
|
|
||||||
|
|
||||||
unsigned supportedFlags =
|
|
||||||
hipDeviceScheduleMask | hipDeviceMapHost | hipDeviceLmemResizeToMax;
|
hipDeviceScheduleMask | hipDeviceMapHost | hipDeviceLmemResizeToMax;
|
||||||
|
|
||||||
if (flags & (~supportedFlags)) {
|
if (flags & ~supportedFlags) {
|
||||||
HIP_RETURN(hipErrorInvalidValue);
|
HIP_RETURN(hipErrorInvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
amd::Device* device = hip::getCurrentDevice()->devices()[0];
|
||||||
|
switch (flags & hipDeviceScheduleMask) {
|
||||||
|
case hipDeviceScheduleAuto:
|
||||||
|
// Current behavior is different from the spec, due to MT usage in runtime
|
||||||
|
if (hip::host_device->devices().size() >= std::thread::hardware_concurrency()) {
|
||||||
|
device->SetActiveWait(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Fall through for active wait...
|
||||||
|
case hipDeviceScheduleSpin:
|
||||||
|
case hipDeviceScheduleYield:
|
||||||
|
// The both options falls into yield, because MT usage in runtime
|
||||||
|
device->SetActiveWait(true);
|
||||||
|
break;
|
||||||
|
case hipDeviceScheduleBlockingSync:
|
||||||
|
device->SetActiveWait(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
HIP_RETURN(hipSuccess);
|
HIP_RETURN(hipSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user