From ff9676f8785599445ee3a520d94033439c5a2e12 Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 9 Dec 2020 11:06:30 -0500 Subject: [PATCH] Fix build_with_il on devices older than 2.1 (#1065) The get_device_il_version_string() function throws an exception if the device does not support the CL_DEVICE_IL_VERSION query, so don't call this unless the version is recent enough. --- .../test_unload_platform_compiler.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test_conformance/compiler/test_unload_platform_compiler.cpp b/test_conformance/compiler/test_unload_platform_compiler.cpp index a180a58d..039d4720 100644 --- a/test_conformance/compiler/test_unload_platform_compiler.cpp +++ b/test_conformance/compiler/test_unload_platform_compiler.cpp @@ -262,13 +262,20 @@ public: const cl_device_id device) : build_base{ context, device } { + /* Disable build_with_il if neither core nor extension functionality is + * available */ + m_enabled = false; + Version version = get_device_cl_version(device); - std::string sILVersion = get_device_il_version_string(device); - if ((version >= Version(2, 1) && version < Version(3, 0)) - || (version >= Version(3, 0) && !sILVersion.empty())) + if (version >= Version(2, 1)) { + std::string sILVersion = get_device_il_version_string(device); + if (version < Version(3, 0) || !sILVersion.empty()) + { + m_enabled = true; + } + m_CreateProgramWithIL = clCreateProgramWithIL; - m_enabled = true; } else if (is_extension_available(device, "cl_khr_il_program")) { @@ -282,12 +289,6 @@ public: } m_enabled = true; } - else - { - /* Disable build_with_il if neither core nor extension functionality - * is available */ - m_enabled = false; - } cl_uint address_bits{}; const cl_int err =