Skip to content

Commit a5606c3

Browse files
authored
[UR][Offload] Add some default returns for device info queries. (#19623)
Typically these are cribbed from the CUDA + Hip adapters, but only when it makes sense as a default for l0 as well (or pertains to something we're already reporting no support for in the case of the device partition stuff).
1 parent 824692b commit a5606c3

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

unified-runtime/source/adapters/offload/device.cpp

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
107107
}
108108
// Unimplemented features
109109
case UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS:
110+
case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS:
110111
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
111112
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
112113
case UR_DEVICE_INFO_IMAGE_SUPPORT:
113114
case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT:
114115
case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
116+
case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORT:
115117
// TODO: Atomic queries in Offload
116118
case UR_DEVICE_INFO_ATOMIC_64:
117119
case UR_DEVICE_INFO_IMAGE_SRGB:
@@ -134,6 +136,71 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
134136
}
135137
return UR_RESULT_SUCCESS;
136138
}
139+
case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: {
140+
return ReturnValue(0u);
141+
}
142+
case UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: {
143+
return ReturnValue(0u);
144+
}
145+
case UR_DEVICE_INFO_PARTITION_TYPE: {
146+
if (pPropSizeRet) {
147+
*pPropSizeRet = 0;
148+
}
149+
return UR_RESULT_SUCCESS;
150+
}
151+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: {
152+
return ReturnValue(1u);
153+
}
154+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: {
155+
return ReturnValue(1u);
156+
}
157+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: {
158+
return ReturnValue(1u);
159+
}
160+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: {
161+
return ReturnValue(1u);
162+
}
163+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: {
164+
return ReturnValue(1u);
165+
}
166+
case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: {
167+
return ReturnValue(1u);
168+
}
169+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: {
170+
return ReturnValue(1u);
171+
}
172+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: {
173+
return ReturnValue(1u);
174+
}
175+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: {
176+
return ReturnValue(1u);
177+
}
178+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: {
179+
return ReturnValue(1u);
180+
}
181+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: {
182+
return ReturnValue(1u);
183+
}
184+
case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: {
185+
return ReturnValue(1u);
186+
}
187+
case UR_DEVICE_INFO_SINGLE_FP_CONFIG:
188+
case UR_DEVICE_INFO_DOUBLE_FP_CONFIG: {
189+
// This minimal set of flags will at least signal to sycl that we support
190+
// the basic FP types.
191+
ur_device_fp_capability_flags_t SupportedFlags =
192+
UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN |
193+
UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST;
194+
return ReturnValue(SupportedFlags);
195+
}
196+
case UR_DEVICE_INFO_AVAILABLE: {
197+
return ReturnValue(ur_bool_t{true});
198+
}
199+
case UR_DEVICE_INFO_BUILT_IN_KERNELS: {
200+
// An empty string is returned if no built-in kernels are supported by the
201+
// device.
202+
return ReturnValue("");
203+
}
137204
default:
138205
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
139206
}

0 commit comments

Comments
 (0)