diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 08fddadd00..4d8956907d 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -748,7 +748,7 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne size_t minorVersionPos = ilVersion.find('.'); if (majorVersionPos != std::string::npos && minorVersionPos != std::string::npos) { - uint32_t majorSpirvVersion = static_cast(std::stoul(ilVersion.substr(majorVersionPos + 1))); + uint32_t majorSpirvVersion = static_cast(std::stoul(ilVersion.substr(majorVersionPos + 1, minorVersionPos))); uint32_t minorSpirvVersion = static_cast(std::stoul(ilVersion.substr(minorVersionPos + 1))); pKernelProperties->spirvVersionSupported = ZE_MAKE_VERSION(majorSpirvVersion, minorSpirvVersion); } else { diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index 70ce9e5397..138d91e32b 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -145,7 +145,6 @@ class ClDevice : public BaseObject<_cl_device_id> { void initializeCaps(); void initializeExtensionsWithVersion(); void initializeOpenclCAllVersions(); - void initializeILsWithVersion(); void initializeOsSpecificCaps(); void initGTPinHelper(); void setupFp64Flags(); diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 7413a60cfe..de713dbc8d 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -31,6 +31,7 @@ namespace NEO { static std::string vendor = "Intel(R) Corporation"; static std::string profile = "FULL_PROFILE"; static std::string spirVersions = "1.2 "; +static std::string spirvName = "SPIR-V"; const char *latestConformanceVersionPassed = "v2023-05-16-00"; #define QTR(a) #a #define TOSTR(b) QTR(b) @@ -141,7 +142,8 @@ void ClDevice::initializeCaps() { initializeOpenclCAllVersions(); deviceInfo.platformLP = (hwInfo.capabilityTable.supportsOcl21Features == false); deviceInfo.spirVersions = spirVersions.c_str(); - initializeILsWithVersion(); + deviceInfo.ilsWithVersion[0].version = CL_MAKE_VERSION(1, 2, 0); + strcpy_s(deviceInfo.ilsWithVersion[0].name, CL_NAME_VERSION_MAX_NAME_SIZE, spirvName.c_str()); deviceInfo.independentForwardProgress = hwInfo.capabilityTable.supportsIndependentForwardProgress; deviceInfo.maxNumOfSubGroups = 0; @@ -456,25 +458,6 @@ void ClDevice::initializeOpenclCAllVersions() { } } -void ClDevice::initializeILsWithVersion() { - std::stringstream ilsStringStream{device.getDeviceInfo().ilVersion}; - std::vector ilsVector{ - std::istream_iterator{ilsStringStream}, std::istream_iterator{}}; - deviceInfo.ilsWithVersion.reserve(ilsVector.size()); - for (auto &il : ilsVector) { - size_t majorVersionPos = il.find_last_of('_'); - size_t minorVersionPos = il.find_last_of('.'); - if (majorVersionPos != std::string::npos && minorVersionPos != std::string::npos) { - cl_name_version ilWithVersion; - uint32_t majorVersion = static_cast(std::stoul(il.substr(majorVersionPos + 1))); - uint32_t minorVersion = static_cast(std::stoul(il.substr(minorVersionPos + 1))); - strcpy_s(ilWithVersion.name, CL_NAME_VERSION_MAX_NAME_SIZE, il.substr(0, majorVersionPos).c_str()); - ilWithVersion.version = CL_MAKE_VERSION(majorVersion, minorVersion, 0); - deviceInfo.ilsWithVersion.push_back(ilWithVersion); - } - } -} - const std::string ClDevice::getClDeviceName() const { return this->getDevice().getDeviceInfo().name; } diff --git a/opencl/source/cl_device/cl_device_info.cpp b/opencl/source/cl_device/cl_device_info.cpp index 7b11cd4d89..2f672e4ca8 100644 --- a/opencl/source/cl_device/cl_device_info.cpp +++ b/opencl/source/cl_device/cl_device_info.cpp @@ -106,6 +106,7 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName, case CL_DEVICE_HALF_FP_CONFIG: getCap(src, srcSize, retSize); break; case CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL: getCap(src, srcSize, retSize); break; case CL_DEVICE_HOST_UNIFIED_MEMORY: getCap(src, srcSize, retSize); break; + case CL_DEVICE_ILS_WITH_VERSION: getCap(src, srcSize, retSize); break; case CL_DEVICE_IL_VERSION: getStr(src, srcSize, retSize); break; case CL_DEVICE_IMAGE_SUPPORT: getCap(src, srcSize, retSize); break; case CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED: getStr(src, srcSize, retSize); break; @@ -235,10 +236,6 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName, src = deviceInfo.openclCFeatures.data(); retSize = srcSize = deviceInfo.openclCFeatures.size() * sizeof(cl_name_version); break; - case CL_DEVICE_ILS_WITH_VERSION: - src = deviceInfo.ilsWithVersion.data(); - retSize = srcSize = deviceInfo.ilsWithVersion.size() * sizeof(cl_name_version); - break; case CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION: src = deviceInfo.builtInKernelsWithVersion.data(); retSize = srcSize = deviceInfo.builtInKernelsWithVersion.size() * sizeof(cl_name_version); diff --git a/opencl/source/cl_device/cl_device_info.h b/opencl/source/cl_device/cl_device_info.h index 1845f529d6..43281ffdc3 100644 --- a/opencl/source/cl_device/cl_device_info.h +++ b/opencl/source/cl_device/cl_device_info.h @@ -26,7 +26,7 @@ struct ClDeviceInfoParam { // clang-format off struct ClDeviceInfo { - std::vector ilsWithVersion; + cl_name_version ilsWithVersion[1]; StackVec builtInKernelsWithVersion; StackVec openclCAllVersions; OpenClCFeaturesContainer openclCFeatures; diff --git a/opencl/source/cl_device/cl_device_info_map.h b/opencl/source/cl_device/cl_device_info_map.h index f987e0d1fc..2f89bb1773 100644 --- a/opencl/source/cl_device/cl_device_info_map.h +++ b/opencl/source/cl_device/cl_device_info_map.h @@ -100,6 +100,7 @@ template<> struct Map : template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; +template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; diff --git a/opencl/test/unit_test/api/cl_get_device_info_tests.inl b/opencl/test/unit_test/api/cl_get_device_info_tests.inl index 47caa978a0..1733eabda8 100644 --- a/opencl/test/unit_test/api/cl_get_device_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_device_info_tests.inl @@ -292,7 +292,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh } } -TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamWhenGettingDeviceInfoThenSpirv10To13IsReturned) { +TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamWhenGettingDeviceInfoThenSpirv12IsReturned) { size_t paramRetSize = 0; cl_int retVal = clGetDeviceInfo( @@ -314,9 +314,8 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamWhenGettingDeviceInfoThe nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_STREQ("SPIR-V_1.3 SPIR-V_1.2 SPIR-V_1.1 SPIR-V_1.0 ", paramValue.get()); + EXPECT_STREQ("SPIR-V_1.2 ", paramValue.get()); } - using matcherAtMostGen12lp = IsAtMostGfxCore; HWTEST2_F(clGetDeviceInfoTests, givenClDeviceSupportedThreadArbitrationPolicyIntelWhenCallClGetDeviceInfoThenProperArrayIsReturned, matcherAtMostGen12lp) { cl_device_info paramName = 0; diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index f004d97757..34f724767c 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -178,7 +178,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) { EXPECT_NE(0u, caps.globalMemCacheSize); EXPECT_LT(0u, sharedCaps.globalMemSize); EXPECT_EQ(sharedCaps.maxMemAllocSize, caps.maxConstantBufferSize); - EXPECT_STREQ("SPIR-V_1.3 SPIR-V_1.2 SPIR-V_1.1 SPIR-V_1.0 ", sharedCaps.ilVersion); + EXPECT_STREQ("SPIR-V_1.2 ", sharedCaps.ilVersion); EXPECT_EQ(defaultHwInfo->capabilityTable.supportsIndependentForwardProgress, caps.independentForwardProgress); EXPECT_EQ(static_cast(CL_TRUE), caps.deviceAvailable); diff --git a/opencl/test/unit_test/device/get_device_info_size_tests.cpp b/opencl/test/unit_test/device/get_device_info_size_tests.cpp index a70dd59206..13a589fcf5 100644 --- a/opencl/test/unit_test/device/get_device_info_size_tests.cpp +++ b/opencl/test/unit_test/device/get_device_info_size_tests.cpp @@ -64,8 +64,8 @@ std::pair deviceInfoParams2[] = { {CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, sizeof(cl_uint)}, {CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong)}, {CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE, sizeof(size_t)}, - // {CL_DEVICE_ILS_WITH_VERSION, sizeof(cl_name_version[])}, - // {CL_DEVICE_IL_VERSION, sizeof(char[])}, + {CL_DEVICE_ILS_WITH_VERSION, sizeof(cl_name_version[1])}, + {CL_DEVICE_IL_VERSION, sizeof(char[12])}, {CL_DEVICE_IMAGE_SUPPORT, sizeof(cl_bool)}, {CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED, strlen(latestConformanceVersionPassed) + 1}, {CL_DEVICE_LINKER_AVAILABLE, sizeof(cl_bool)}, diff --git a/opencl/test/unit_test/device/get_device_info_tests.cpp b/opencl/test/unit_test/device/get_device_info_tests.cpp index e22518b4d9..6dad4f8be3 100644 --- a/opencl/test/unit_test/device/get_device_info_tests.cpp +++ b/opencl/test/unit_test/device/get_device_info_tests.cpp @@ -538,24 +538,18 @@ TEST(GetDeviceInfo, GivenPreferredInteropsWhenGettingDeviceInfoThenCorrectValueI EXPECT_EQ(sizeof(cl_bool), size); EXPECT_TRUE(value == 1u); } - TEST(GetDeviceInfo, WhenQueryingIlsWithVersionThenProperValueIsReturned) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); - constexpr auto ilCount = 4; - cl_name_version ilsWithVersion[ilCount]; + cl_name_version ilsWithVersion[1]; size_t paramRetSize; const auto retVal = device->getDeviceInfo(CL_DEVICE_ILS_WITH_VERSION, sizeof(ilsWithVersion), &ilsWithVersion, ¶mRetSize); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_EQ(sizeof(cl_name_version) * ilCount, paramRetSize); - for (int i = 0; i < ilCount; i++) { - EXPECT_EQ(1u, CL_VERSION_MAJOR(ilsWithVersion[i].version)); - EXPECT_GT(4u, CL_VERSION_MINOR(ilsWithVersion[i].version)); - EXPECT_EQ(0u, CL_VERSION_PATCH(ilsWithVersion[i].version)); - EXPECT_STREQ("SPIR-V", ilsWithVersion[i].name); - } + EXPECT_EQ(sizeof(cl_name_version), paramRetSize); + EXPECT_EQ(CL_MAKE_VERSION(1u, 2u, 0u), ilsWithVersion->version); + EXPECT_STREQ("SPIR-V", ilsWithVersion->name); } TEST(GetDeviceInfo, WhenQueryingAtomicMemoryCapabilitiesThenProperValueIsReturned) { diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index ec15f803ce..d483d74659 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -27,7 +27,7 @@ namespace NEO { -static const char *spirvWithVersion = "SPIR-V_1.3 SPIR-V_1.2 SPIR-V_1.1 SPIR-V_1.0 "; +static const char *spirvWithVersion = "SPIR-V_1.2 "; size_t Device::getMaxParameterSizeFromIGC() const { CompilerInterface *compilerInterface = getCompilerInterface(); diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index 3b97942a5e..d074e50ae9 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -460,7 +460,7 @@ TEST(DeviceGetCapsSimpleTest, givenVariousOclVersionsWhenCapsAreCreatedThenDevic debugManager.flags.ForceOCLVersion.set(oclVersion); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); const auto &caps = device->getDeviceInfo(); - EXPECT_STREQ("SPIR-V_1.3 SPIR-V_1.2 SPIR-V_1.1 SPIR-V_1.0 ", caps.ilVersion); + EXPECT_STREQ("SPIR-V_1.2 ", caps.ilVersion); } }