Skip to content

Commit 48b841a

Browse files
committed
Add DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT device info query.
This gates support for the EnqueueDeviceGlobalVariableRead and Write operations. The CTS tests for these now check for support before running, and all adapters report their support correctly.
1 parent f29de93 commit 48b841a

File tree

9 files changed

+865
-2297
lines changed

9 files changed

+865
-2297
lines changed

include/ur_api.h

Lines changed: 403 additions & 958 deletions
Large diffs are not rendered by default.

include/ur_print.hpp

Lines changed: 438 additions & 1338 deletions
Large diffs are not rendered by default.

scripts/core/device.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ etors:
439439
desc: "[$x_device_handle_t[]] The set of component devices contained by this composite device."
440440
- name: COMPOSITE_DEVICE
441441
desc: "[$x_device_handle_t] The composite device containing this component device."
442+
- name: GLOBAL_VARIABLE_SUPPORT
443+
desc: "[$x_bool_t] return true if the device supports the `EnqueueDeviceGlobalVariableWrite` and `EnqueueDeviceGlobalVariableRead` entry points."
442444
--- #--------------------------------------------------------------------------
443445
type: function
444446
desc: "Retrieves various information about device"

source/adapters/cuda/device.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10741074
case UR_DEVICE_INFO_COMPOSITE_DEVICE:
10751075
// These two are exclusive of L0.
10761076
return ReturnValue(0);
1077+
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
1078+
return ReturnValue(true);
10771079
case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS:
10781080
case UR_DEVICE_INFO_GPU_EU_COUNT:
10791081
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:

source/adapters/hip/device.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
843843
return ReturnValue(0);
844844
case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS:
845845
return ReturnValue(false);
846-
846+
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
847+
return ReturnValue(false);
847848
// TODO: Investigate if this information is available on HIP.
848849
case UR_DEVICE_INFO_GPU_EU_COUNT:
849850
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:

source/adapters/level_zero/device.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
863863
return ReturnValue(result);
864864
}
865865

866+
<<<<<<< HEAD
866867
<<<<<<< HEAD
867868
case UR_DEVICE_INFO_COMPONENT_DEVICES: {
868869
ze_device_handle_t DevHandle = Device->ZeDevice;
@@ -968,6 +969,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
968969
case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP:
969970
case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS:
970971
return ReturnValue(false);
972+
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
973+
return ReturnValue(true);
971974

972975
default:
973976
logger::error("Unsupported ParamName in urGetDeviceInfo");

source/adapters/opencl/device.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
806806
{"cl_intel_program_scope_host_pipe"}, Supported));
807807
return ReturnValue(Supported);
808808
}
809+
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT: {
810+
bool Supported = false;
811+
CL_RETURN_ON_FAILURE(cl_adapter::checkDeviceExtensions(
812+
cl_adapter::cast<cl_device_id>(hDevice),
813+
{"cl_intel_global_variable_access"}, Supported));
814+
return ReturnValue(Supported);
815+
}
809816
case UR_DEVICE_INFO_QUEUE_PROPERTIES:
810817
case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES:
811818
case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES:

test/conformance/testing/include/uur/fixtures.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,13 @@ struct urGlobalVariableTest : uur::urKernelExecutionTest {
14811481
UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY,
14821482
metadataData.size(), metadata_value});
14831483
UUR_RETURN_ON_FATAL_FAILURE(uur::urKernelExecutionTest::SetUp());
1484+
bool global_var_support = false;
1485+
ASSERT_SUCCESS(urDeviceGetInfo(
1486+
device, UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT,
1487+
sizeof(global_var_support), &global_var_support, nullptr));
1488+
if (!global_var_support) {
1489+
GTEST_SKIP() << "Global variable access is not supported";
1490+
}
14841491
}
14851492

14861493
/* We pad the first 8 bytes of the metadata since they are ignored */

tools/urinfo/urinfo.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
334334
std::cout << prefix;
335335
printDeviceInfo<ur_bool_t>(
336336
hDevice, UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP);
337+
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT);
337338
std::cout << prefix;
338339
printDeviceInfo<ur_bool_t>(hDevice,
339340
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP);

0 commit comments

Comments
 (0)