Skip to content

Commit 3980491

Browse files
committed
[L0] Fix Device Info Reporting for vector width to match spec
- Given device has a lack of fp64 or fp16 support, return 0 as the vector width. Signed-off-by: Neil R. Spruit <[email protected]>
1 parent f3e96d3 commit 3980491

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

source/adapters/level_zero/device.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,15 @@ ur_result_t urDeviceGetInfo(
654654
return ReturnValue(Device->ZeDeviceProperties->physicalEUSimdWidth / 4);
655655
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE:
656656
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE:
657+
// Must return 0 for *vector_width_double* if the device does not have fp64.
658+
if (!(Device->ZeDeviceModuleProperties->flags & ZE_DEVICE_MODULE_FLAG_FP64))
659+
return ReturnValue(uint32_t{0});
657660
return ReturnValue(Device->ZeDeviceProperties->physicalEUSimdWidth / 8);
658661
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF:
659662
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF:
663+
// Must return 0 for *vector_width_half* if the device does not have fp16.
664+
if (!(Device->ZeDeviceModuleProperties->flags & ZE_DEVICE_MODULE_FLAG_FP16))
665+
return ReturnValue(uint32_t{0});
660666
return ReturnValue(Device->ZeDeviceProperties->physicalEUSimdWidth / 2);
661667
case UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS: {
662668
// Max_num_sub_Groups = maxTotalGroupSize/min(set of subGroupSizes);

0 commit comments

Comments
 (0)