Fix test_spir not checking for the required extension (#2454)

`clGetDeviceInfo` should fail with `CL_INVALID_VALUE` when queried for
`CL_DEVICE_SPIR_VERSIONS` on devices that do not claim to support the
extension that provides it, `cl_khr_spir`.

Following this change, the test is skipped instead of failing on devices
that do not support `cl_khr_spir`.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2025-07-24 18:43:03 +01:00
committed by GitHub
parent d918b41657
commit 82508f709a

View File

@@ -6911,12 +6911,13 @@ int main (int argc, const char* argv[])
cl_device_id device = get_platform_device(device_type, choosen_device_index, choosen_platform_index); cl_device_id device = get_platform_device(device_type, choosen_device_index, choosen_platform_index);
printDeviceHeader(device); printDeviceHeader(device);
REQUIRE_EXTENSION("cl_khr_spir");
std::vector<Version> versions; std::vector<Version> versions;
get_spir_version(device, versions); get_spir_version(device, versions);
if (!is_extension_available(device, "cl_khr_spir") if (std::find(versions.begin(), versions.end(), Version{ 1, 2 })
|| (std::find(versions.begin(), versions.end(), Version{ 1, 2 }) == versions.end())
== versions.end()))
{ {
log_info("Spir extension version 1.2 is not supported by the device\n"); log_info("Spir extension version 1.2 is not supported by the device\n");
return 0; return 0;