Merge "SWDEV-193956 - [hipclang-vdi-rocm][perf]" into amd-master-next
[ROCm/clr commit: a083dc8547]
Этот коммит содержится в:
@@ -50,6 +50,9 @@ void init() {
|
||||
amd::Context* context = new amd::Context(device, amd::Context::Info());
|
||||
if (!context) return;
|
||||
|
||||
// Enable active wait on the device by default
|
||||
devices[i]->SetActiveWait(true);
|
||||
|
||||
if (context && CL_SUCCESS != context->create(nullptr)) {
|
||||
context->release();
|
||||
} else {
|
||||
|
||||
@@ -491,16 +491,34 @@ hipError_t hipSetDevice ( int device ) {
|
||||
hipError_t hipSetDeviceFlags ( unsigned int flags ) {
|
||||
HIP_INIT_API(hipSetDeviceFlags, flags);
|
||||
|
||||
/* FIXME */
|
||||
/* Not all of Ctx may be implemented */
|
||||
|
||||
unsigned supportedFlags =
|
||||
constexpr uint32_t supportedFlags =
|
||||
hipDeviceScheduleMask | hipDeviceMapHost | hipDeviceLmemResizeToMax;
|
||||
|
||||
if (flags & (~supportedFlags)) {
|
||||
if (flags & ~supportedFlags) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user