Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,9 @@ typedef enum ur_device_info_t {
///< version than older devices.
UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT = 114, ///< [::ur_bool_t] return true if the device supports virtual memory.
UR_DEVICE_INFO_ESIMD_SUPPORT = 115, ///< [::ur_bool_t] return true if the device supports ESIMD.
UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT = 116, ///< [::ur_bool_t] return true if the device supports the
///< `EnqueueDeviceGlobalVariableWrite` and
///< `EnqueueDeviceGlobalVariableRead` entry points.
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP = 0x2000, ///< [::ur_bool_t] returns true if the device supports the creation of
///< bindless images
UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001, ///< [::ur_bool_t] returns true if the device supports the creation of
Expand Down
15 changes: 15 additions & 0 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2401,6 +2401,9 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value) {
case UR_DEVICE_INFO_ESIMD_SUPPORT:
os << "UR_DEVICE_INFO_ESIMD_SUPPORT";
break;
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
os << "UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT";
break;
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP:
os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP";
break;
Expand Down Expand Up @@ -3809,6 +3812,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info

os << ")";
} break;
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
Expand Down
2 changes: 2 additions & 0 deletions scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ etors:
desc: "[$x_bool_t] return true if the device supports virtual memory."
- name: ESIMD_SUPPORT
desc: "[$x_bool_t] return true if the device supports ESIMD."
- name: GLOBAL_VARIABLE_SUPPORT
desc: "[$x_bool_t] return true if the device supports the `EnqueueDeviceGlobalVariableWrite` and `EnqueueDeviceGlobalVariableRead` entry points."
--- #--------------------------------------------------------------------------
type: function
desc: "Retrieves various information about device"
Expand Down
2 changes: 2 additions & 0 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
return ReturnValue(true);
case UR_DEVICE_INFO_ESIMD_SUPPORT:
return ReturnValue(false);
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
return ReturnValue(true);
case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS:
case UR_DEVICE_INFO_GPU_EU_COUNT:
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
Expand Down
3 changes: 2 additions & 1 deletion source/adapters/hip/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
return ReturnValue(false);
case UR_DEVICE_INFO_ESIMD_SUPPORT:
return ReturnValue(false);

case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
return ReturnValue(false);
// TODO: Investigate if this information is available on HIP.
case UR_DEVICE_INFO_GPU_EU_COUNT:
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
Expand Down
3 changes: 3 additions & 0 deletions source/adapters/level_zero/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
return ReturnValue(result);
}

case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
return ReturnValue(true);

default:
urPrint("Unsupported ParamName in urGetDeviceInfo\n");
urPrint("ParamName=%d(0x%x)\n", ParamName, ParamName);
Expand Down
7 changes: 7 additions & 0 deletions source/adapters/opencl/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
{"cl_intel_program_scope_host_pipe"}, Supported));
return ReturnValue(Supported);
}
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT: {
bool Supported = false;
CL_RETURN_ON_FAILURE(cl_adapter::checkDeviceExtensions(
cl_adapter::cast<cl_device_id>(hDevice),
{"cl_intel_global_variable_access"}, Supported));
return ReturnValue(Supported);
}
case UR_DEVICE_INFO_QUEUE_PROPERTIES:
case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES:
case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES:
Expand Down
7 changes: 7 additions & 0 deletions test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,13 @@ struct urGlobalVariableTest : uur::urKernelExecutionTest {
program_name = "device_global";
global_var = {"_Z7dev_var", 0};
UUR_RETURN_ON_FATAL_FAILURE(uur::urKernelExecutionTest::SetUp());
bool global_var_support = false;
ASSERT_SUCCESS(urDeviceGetInfo(
device, UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT,
sizeof(global_var_support), &global_var_support, nullptr));
if (!global_var_support) {
GTEST_SKIP() << "Global variable access is not supported";
}
}

GlobalVar<int> global_var;
Expand Down
2 changes: 2 additions & 0 deletions tools/urinfo/urinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
std::cout << prefix;
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_ESIMD_SUPPORT);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(hDevice,
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP);
std::cout << prefix;
Expand Down