Skip to content

Commit 31c8e4f

Browse files
committed
formatting fixed
1 parent 1d5edf0 commit 31c8e4f

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

include/ur_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,7 @@ typedef enum ur_device_info_t {
16561656
UR_DEVICE_INFO_USM_POOL_SUPPORT = 119, ///< [::ur_bool_t] return true if the device supports USM pooling. Pertains
16571657
///< to the `USMPool` entry points and usage of the `pool` parameter of the
16581658
///< USM alloc entry points.
1659+
UR_DEVICE_INFO_NUM_COMPUTE_UNITS = 120, ///< [uint32_t] the number of compute units for specific backend.
16591660
UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP = 0x1000, ///< [::ur_bool_t] Returns true if the device supports the use of
16601661
///< command-buffers.
16611662
UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP = 0x1001, ///< [::ur_device_command_buffer_update_capability_flags_t] Command-buffer
@@ -1719,7 +1720,6 @@ typedef enum ur_device_info_t {
17191720
UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP = 0x2021, ///< [::ur_bool_t] returns true if the device supports low-power events.
17201721
UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP = 0x2022, ///< [::ur_exp_device_2d_block_array_capability_flags_t] return a bit-field
17211722
///< of Intel GPU 2D block array capabilities
1722-
UR_DEVICE_INFO_NUM_COMPUTE_UNITS = 0x2023, ///< [uint32_t] the number of compute units for specific backend
17231723
/// @cond
17241724
UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
17251725
/// @endcond

include/ur_print.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,9 +2291,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
22912291
case UR_DEVICE_INFO_MAX_COMPUTE_UNITS:
22922292
os << "UR_DEVICE_INFO_MAX_COMPUTE_UNITS";
22932293
break;
2294-
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS:
2295-
os << "UR_DEVICE_INFO_NUM_COMPUTE_UNITS";
2296-
break;
22972294
case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS:
22982295
os << "UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS";
22992296
break;
@@ -2642,6 +2639,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
26422639
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
26432640
os << "UR_DEVICE_INFO_USM_POOL_SUPPORT";
26442641
break;
2642+
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS:
2643+
os << "UR_DEVICE_INFO_NUM_COMPUTE_UNITS";
2644+
break;
26452645
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
26462646
os << "UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP";
26472647
break;
@@ -2805,18 +2805,6 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info
28052805

28062806
os << ")";
28072807
} break;
2808-
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: {
2809-
const uint32_t *tptr = (const uint32_t *)ptr;
2810-
if (sizeof(uint32_t) > size) {
2811-
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")";
2812-
return UR_RESULT_ERROR_INVALID_SIZE;
2813-
}
2814-
os << (const void *)(tptr) << " (";
2815-
2816-
os << *tptr;
2817-
2818-
os << ")";
2819-
} break;
28202808
case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: {
28212809
const uint32_t *tptr = (const uint32_t *)ptr;
28222810
if (sizeof(uint32_t) > size) {
@@ -4175,6 +4163,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info
41754163

41764164
os << ")";
41774165
} break;
4166+
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: {
4167+
const uint32_t *tptr = (const uint32_t *)ptr;
4168+
if (sizeof(uint32_t) > size) {
4169+
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")";
4170+
return UR_RESULT_ERROR_INVALID_SIZE;
4171+
}
4172+
os << (const void *)(tptr) << " (";
4173+
4174+
os << *tptr;
4175+
4176+
os << ")";
4177+
} break;
41784178
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP: {
41794179
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
41804180
if (sizeof(ur_bool_t) > size) {

scripts/core/device.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ etors:
443443
desc: "[$x_bool_t] return true if the device supports the `EnqueueDeviceGlobalVariableWrite` and `EnqueueDeviceGlobalVariableRead` entry points."
444444
- name: USM_POOL_SUPPORT
445445
desc: "[$x_bool_t] return true if the device supports USM pooling. Pertains to the `USMPool` entry points and usage of the `pool` parameter of the USM alloc entry points."
446+
- name: NUM_COMPUTE_UNITS
447+
desc: "[uint32_t] the number of compute units for specific backend."
446448
--- #--------------------------------------------------------------------------
447449
type: function
448450
desc: "Retrieves various information about device"

source/adapters/level_zero/device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ ur_result_t urDeviceGetInfo(
322322

323323
return ReturnValue(uint32_t{MaxComputeUnits});
324324
}
325-
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS:{
326-
uint32_t NumComputeUnits =
325+
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: {
326+
uint32_t NumComputeUnits =
327327
Device->ZeDeviceProperties->numSubslicesPerSlice *
328328
Device->ZeDeviceProperties->numSlices;
329329
return ReturnValue(uint32_t{NumComputeUnits});

source/adapters/opencl/device.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -827,30 +827,37 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
827827
case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: {
828828
return ReturnValue(false);
829829
}
830-
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS:{
831-
830+
case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: {
831+
832832
bool ExtensionSupported = false;
833833
UR_RETURN_ON_FAILURE(cl_adapter::checkDeviceExtensions(
834834
cl_adapter::cast<cl_device_id>(hDevice),
835835
{"cl_intel_device_attribute_query"}, ExtensionSupported));
836-
836+
837837
cl_device_type CLType;
838838
CL_RETURN_ON_FAILURE(
839839
clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_TYPE,
840840
sizeof(cl_device_type), &CLType, nullptr));
841-
841+
842842
cl_uint NumComputeUnits;
843843
if (ExtensionSupported && (CLType & CL_DEVICE_TYPE_GPU)) {
844844
cl_uint SliceCount = 0;
845-
cl_uint SubSlicePerSliceCount =0;
846-
CL_RETURN_ON_FAILURE(clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_NUM_SLICES_INTEL, sizeof(cl_uint), &SliceCount, nullptr));
847-
CL_RETURN_ON_FAILURE(clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL, sizeof(cl_uint), &SubSlicePerSliceCount, nullptr));
848-
NumComputeUnits = SliceCount*SubSlicePerSliceCount;
849-
}else{
850-
CL_RETURN_ON_FAILURE(clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &NumComputeUnits, nullptr));
845+
cl_uint SubSlicePerSliceCount = 0;
846+
CL_RETURN_ON_FAILURE(clGetDeviceInfo(
847+
cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_NUM_SLICES_INTEL,
848+
sizeof(cl_uint), &SliceCount, nullptr));
849+
CL_RETURN_ON_FAILURE(
850+
clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice),
851+
CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL,
852+
sizeof(cl_uint), &SubSlicePerSliceCount, nullptr));
853+
NumComputeUnits = SliceCount * SubSlicePerSliceCount;
854+
} else {
855+
CL_RETURN_ON_FAILURE(clGetDeviceInfo(
856+
cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_MAX_COMPUTE_UNITS,
857+
sizeof(cl_uint), &NumComputeUnits, nullptr));
851858
}
852-
853-
return ReturnValue(static_cast<size_t>(NumComputeUnits));
859+
860+
return ReturnValue(static_cast<uint32_t>(NumComputeUnits));
854861
}
855862
case UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP: {
856863
return ReturnValue(false);

tools/urinfo/urinfo.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
337337
std::cout << prefix;
338338
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_USM_POOL_SUPPORT);
339339
std::cout << prefix;
340+
printDeviceInfo<uint32_t>(hDevice, UR_DEVICE_INFO_NUM_COMPUTE_UNITS);
341+
std::cout << prefix;
340342
printDeviceInfo<ur_bool_t>(hDevice,
341343
UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP);
342344
std::cout << prefix;

0 commit comments

Comments
 (0)