Merge "SWDEV-193956 - [hipclang-vdi-rocm][perf]" into amd-master-next

[ROCm/clr commit: a083dc8547]
Этот коммит содержится в:
German Andryeyev
2020-03-04 18:04:52 -05:00
коммит произвёл Gerrit Code Review
родитель 6ea8286d14 597bf599ad
Коммит 28fb4e50bb
2 изменённых файлов: 26 добавлений и 5 удалений
+3
Просмотреть файл
@@ -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 {
+23 -5
Просмотреть файл
@@ -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);
}