SWDEV-343160 - correct mutual exclusive flags
- flags passed should be only one type at a time Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: I3e56f036e51d8cc84fe5c18c06cfa11cf785233f
Este commit está contenido en:
@@ -565,13 +565,23 @@ hipError_t hipSetDeviceFlags ( unsigned int flags ) {
|
||||
|
||||
constexpr uint32_t supportedFlags =
|
||||
hipDeviceScheduleMask | hipDeviceMapHost | hipDeviceLmemResizeToMax;
|
||||
constexpr uint32_t mutualExclusiveFlags =
|
||||
hipDeviceScheduleSpin | hipDeviceScheduleYield | hipDeviceScheduleBlockingSync;
|
||||
// Only one scheduling flag allowed a time
|
||||
uint32_t scheduleFlag = flags & hipDeviceScheduleMask;
|
||||
|
||||
if (((scheduleFlag & mutualExclusiveFlags) != hipDeviceScheduleSpin) && ((scheduleFlag & mutualExclusiveFlags) != hipDeviceScheduleYield)
|
||||
&& ((scheduleFlag & mutualExclusiveFlags) != hipDeviceScheduleBlockingSync)
|
||||
&& ((scheduleFlag & hipDeviceScheduleAuto) != hipDeviceScheduleAuto)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
if (flags & ~supportedFlags) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
amd::Device* device = hip::getCurrentDevice()->devices()[0];
|
||||
switch (flags & hipDeviceScheduleMask) {
|
||||
switch (scheduleFlag) {
|
||||
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()) {
|
||||
|
||||
Referencia en una nueva incidencia
Block a user