From a17c8220a533a88ed5d8ed02a2bd0d0019e1ecea Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Fri, 17 Dec 2021 11:42:36 +0300 Subject: [PATCH 1/7] draft releasing spec const buffer --- sycl/source/detail/device_image_impl.hpp | 4 ++++ .../program_manager/program_manager.cpp | 5 ++++- sycl/source/handler.cpp | 9 ++++++++- sycl/unittests/SYCL2020/CMakeLists.txt | 1 + .../SYCL2020/SpecializationConstant.cpp | 20 ++++++++++++++++++- 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/sycl/source/detail/device_image_impl.hpp b/sycl/source/detail/device_image_impl.hpp index e6e9050d24d98..aa91e172396cb 100644 --- a/sycl/source/detail/device_image_impl.hpp +++ b/sycl/source/detail/device_image_impl.hpp @@ -220,6 +220,10 @@ class device_image_impl { const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin(); Plugin.call(MProgram); } + if (MSpecConstsBuffer) { + const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin(); + Plugin.call(MSpecConstsBuffer); + } } private: diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index a056c1ec16b87..809c9e0e20886 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -1321,7 +1321,10 @@ static bool compatibleWithDevice(RTDeviceBinaryImage *BinImage, kernel_id ProgramManager::getSYCLKernelID(const std::string &KernelName) { std::lock_guard KernelIDsGuard(m_KernelIDsMutex); - + std::cout << KernelName << std::endl; + for (auto x:m_KernelIDs){ + std::cout << x.first << std::endl; + } auto KernelID = m_KernelIDs.find(KernelName); if (KernelID == m_KernelIDs.end()) throw runtime_error("No kernel found with the specified name", diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index e1c27d2650898..6a4024d67079e 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -584,9 +584,16 @@ std::string handler::getKernelName() { void handler::verifyUsedKernelBundle(const std::string &KernelName) { auto UsedKernelBundleImplPtr = getOrInsertHandlerKernelBundle(/*Insert=*/false); + std::cout << "HANDLER ->" << KernelName << std::endl; if (!UsedKernelBundleImplPtr) return; - + for (auto x:*UsedKernelBundleImplPtr) { + auto DIPtr = detail::getSyclObjImpl(x); + for (auto y: DIPtr->get_kernel_ids_ref()) { + auto KIPtr = detail::getSyclObjImpl(y); + std::cout << "HANDLER ->" << KIPtr->get_name() << std::endl; + } + } kernel_id KernelID = detail::get_kernel_id_impl(KernelName); device Dev = detail::getDeviceFromHandler(*this); if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev)) diff --git a/sycl/unittests/SYCL2020/CMakeLists.txt b/sycl/unittests/SYCL2020/CMakeLists.txt index f4b64df26afb0..5f3d48a04bc47 100644 --- a/sycl/unittests/SYCL2020/CMakeLists.txt +++ b/sycl/unittests/SYCL2020/CMakeLists.txt @@ -7,5 +7,6 @@ add_sycl_unittest(SYCL2020Tests OBJECT SpecializationConstant.cpp KernelBundle.cpp KernelID.cpp + SpecConstBuffer.cpp ) diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 18bc331a29d0b..558572da9f3a4 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -18,6 +18,7 @@ #include class TestKernel; +class TestKernelNative; const static sycl::specialization_id SpecConst1{42}; __SYCL_INLINE_NAMESPACE(cl) { @@ -37,9 +38,26 @@ template <> struct KernelInfo { static constexpr bool callsAnyThisFreeFunction() { return false; } }; +template <> struct KernelInfo { + static constexpr unsigned getNumParams() { return 0; } + static const kernel_param_desc_t &getParamDesc(int) { + static kernel_param_desc_t Dummy; + return Dummy; + } + static constexpr const char *getName() { + return "SpecializationConstantNative_TestKernel"; + } + static constexpr bool isESIMD() { return false; } + static constexpr bool callsThisItem() { return false; } + static constexpr bool callsAnyThisFreeFunction() { return false; } +}; + template <> const char *get_spec_constant_symbolic_ID() { return "SC1"; } +//template <> const char *get_spec_constant_symbolic_ID() { +// return "SC2"; +//} } // namespace detail } // namespace sycl } // __SYCL_INLINE_NAMESPACE(cl) @@ -70,6 +88,7 @@ static sycl::unittest::PiImage generateImageWithSpecConsts() { return Img; } + static sycl::unittest::PiImage Img = generateImageWithSpecConsts(); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; @@ -92,7 +111,6 @@ TEST(SpecializationConstant, DefaultValuesAreSet) { sycl::unittest::PiMock Mock{Plt}; setupDefaultMockAPIs(Mock); - const sycl::device Dev = Plt.get_devices()[0]; sycl::queue Queue{Dev}; From e3728597b3f65a9cdd3a79079658c9caeac2eb50 Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Fri, 17 Dec 2021 12:36:38 +0300 Subject: [PATCH 2/7] add SpecConstBuffer.cpp --- sycl/unittests/SYCL2020/SpecConstBuffer.cpp | 127 ++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sycl/unittests/SYCL2020/SpecConstBuffer.cpp diff --git a/sycl/unittests/SYCL2020/SpecConstBuffer.cpp b/sycl/unittests/SYCL2020/SpecConstBuffer.cpp new file mode 100644 index 0000000000000..eb7117b399a3e --- /dev/null +++ b/sycl/unittests/SYCL2020/SpecConstBuffer.cpp @@ -0,0 +1,127 @@ +#define SYCL2020_DISABLE_DEPRECATION_WARNINGS + +#include +#include + +#include +#include +#include + +#include + + +class TestKernelNative; + +const static sycl::specialization_id SpecConst2{42}; +__SYCL_INLINE_NAMESPACE(cl) { +namespace sycl { +namespace detail { +template <> struct KernelInfo { + static constexpr unsigned getNumParams() { return 0; } + static const kernel_param_desc_t &getParamDesc(int) { + static kernel_param_desc_t Dummy; + return Dummy; + } + static constexpr const char *getName() { + return "SpecializationConstant_TestKernelNative"; + } + static constexpr bool isESIMD() { return false; } + static constexpr bool callsThisItem() { return false; } + static constexpr bool callsAnyThisFreeFunction() { return false; } +}; + +template <> const char *get_spec_constant_symbolic_ID() { + return "SC2"; +} +} // namespace detail +} // namespace sycl +} // __SYCL_INLINE_NAMESPACE(cl) + + +static sycl::unittest::PiImage generateImageWithSpecConstsNative() { + using namespace sycl::unittest; + + std::vector SpecConstData; + PiProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); + PiProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); + + PiPropertySet PropSet; + addSpecConstants({SC1, SC2}, std::move(SpecConstData), PropSet); + + std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data + + PiArray Entries = + makeEmptyKernels({"SpecializationConstant_TestKernelNative"}); + + PiImage Img{PI_DEVICE_BINARY_TYPE_NATIVE, // Format + __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64, // DeviceTargetSpec + "", // Compile options + "", // Link options + std::move(Bin), + std::move(Entries), + std::move(PropSet)}; + + return Img; +} + +std::atomic RedefinedMemReleaseCalled; +static pi_result redefinedMemRelease(pi_mem mem) { + RedefinedMemReleaseCalled = 1; + std::cout << "rdfMemRel" << std::endl; + return PI_SUCCESS; +} + +pi_result redefinedProgramSetSpecializationConstant(pi_program prog, pi_uint32 spec_id, + size_t spec_size, const void *spec_value) { + return PI_SUCCESS; +} +static sycl::unittest::PiImage Img { generateImageWithSpecConstsNative() }; +static sycl::unittest::PiImageArray<1> ImgArray{&Img}; + + + + +TEST(SpecConstBuffer, ResourceCleanUp) { + RedefinedMemReleaseCalled = 0; + { + sycl::platform Plt{sycl::default_selector()}; + if (Plt.is_host()) { + std::cerr << "Test is not supported on host, skipping\n"; + return; // test is not supported on host. + } + + if (Plt.get_backend() == sycl::backend::ext_oneapi_cuda) { + std::cerr << "Test is not supported on CUDA platform, skipping\n"; + return; + } + + if (Plt.get_backend() == sycl::backend::ext_oneapi_hip) { + std::cerr << "Test is not supported on HIP platform, skipping\n"; + return; + } + + sycl::unittest::PiMock Mock{Plt}; + setupDefaultMockAPIs(Mock); + Mock.redefine(redefinedMemRelease); + Mock.redefine(redefinedProgramSetSpecializationConstant); + const sycl::device Dev = Plt.get_devices()[0]; + sycl::queue Q{Dev}; + const sycl::context Ctx = Q.get_context(); + std::vector kernelId = {sycl::get_kernel_id()}; + sycl::kernel_bundle KernelBundle = + sycl::get_kernel_bundle(Ctx, kernelId); + KernelBundle.set_specialization_constant(1); + auto exeBundle = sycl::build(KernelBundle); + Q.submit([&](sycl::handler &CGH) { + CGH.use_kernel_bundle(exeBundle); + // CGH.set_specialization_constant(1); + // CGH.single_task([=](sycl::kernel_handler KH) { + // (void)KH.get_specialization_constant(); + // }); + CGH.single_task([]() {}); + }); + Q.wait(); + } + EXPECT_EQ(RedefinedMemReleaseCalled, 1); +} + From 13a2ce78924377a7c1fe9641eea0f6edd310ebaf Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Fri, 17 Dec 2021 14:21:37 +0300 Subject: [PATCH 3/7] Revert debug changings --- .../program_manager/program_manager.cpp | 3 - sycl/source/handler.cpp | 9 +- sycl/unittests/SYCL2020/CMakeLists.txt | 1 - sycl/unittests/SYCL2020/SpecConstBuffer.cpp | 127 ------------------ 4 files changed, 1 insertion(+), 139 deletions(-) delete mode 100644 sycl/unittests/SYCL2020/SpecConstBuffer.cpp diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 809c9e0e20886..affaef1ab549b 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -1322,9 +1322,6 @@ static bool compatibleWithDevice(RTDeviceBinaryImage *BinImage, kernel_id ProgramManager::getSYCLKernelID(const std::string &KernelName) { std::lock_guard KernelIDsGuard(m_KernelIDsMutex); std::cout << KernelName << std::endl; - for (auto x:m_KernelIDs){ - std::cout << x.first << std::endl; - } auto KernelID = m_KernelIDs.find(KernelName); if (KernelID == m_KernelIDs.end()) throw runtime_error("No kernel found with the specified name", diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 6a4024d67079e..4452327c9741e 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -584,16 +584,9 @@ std::string handler::getKernelName() { void handler::verifyUsedKernelBundle(const std::string &KernelName) { auto UsedKernelBundleImplPtr = getOrInsertHandlerKernelBundle(/*Insert=*/false); - std::cout << "HANDLER ->" << KernelName << std::endl; if (!UsedKernelBundleImplPtr) return; - for (auto x:*UsedKernelBundleImplPtr) { - auto DIPtr = detail::getSyclObjImpl(x); - for (auto y: DIPtr->get_kernel_ids_ref()) { - auto KIPtr = detail::getSyclObjImpl(y); - std::cout << "HANDLER ->" << KIPtr->get_name() << std::endl; - } - } + kernel_id KernelID = detail::get_kernel_id_impl(KernelName); device Dev = detail::getDeviceFromHandler(*this); if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev)) diff --git a/sycl/unittests/SYCL2020/CMakeLists.txt b/sycl/unittests/SYCL2020/CMakeLists.txt index 5f3d48a04bc47..f4b64df26afb0 100644 --- a/sycl/unittests/SYCL2020/CMakeLists.txt +++ b/sycl/unittests/SYCL2020/CMakeLists.txt @@ -7,6 +7,5 @@ add_sycl_unittest(SYCL2020Tests OBJECT SpecializationConstant.cpp KernelBundle.cpp KernelID.cpp - SpecConstBuffer.cpp ) diff --git a/sycl/unittests/SYCL2020/SpecConstBuffer.cpp b/sycl/unittests/SYCL2020/SpecConstBuffer.cpp deleted file mode 100644 index eb7117b399a3e..0000000000000 --- a/sycl/unittests/SYCL2020/SpecConstBuffer.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#define SYCL2020_DISABLE_DEPRECATION_WARNINGS - -#include -#include - -#include -#include -#include - -#include - - -class TestKernelNative; - -const static sycl::specialization_id SpecConst2{42}; -__SYCL_INLINE_NAMESPACE(cl) { -namespace sycl { -namespace detail { -template <> struct KernelInfo { - static constexpr unsigned getNumParams() { return 0; } - static const kernel_param_desc_t &getParamDesc(int) { - static kernel_param_desc_t Dummy; - return Dummy; - } - static constexpr const char *getName() { - return "SpecializationConstant_TestKernelNative"; - } - static constexpr bool isESIMD() { return false; } - static constexpr bool callsThisItem() { return false; } - static constexpr bool callsAnyThisFreeFunction() { return false; } -}; - -template <> const char *get_spec_constant_symbolic_ID() { - return "SC2"; -} -} // namespace detail -} // namespace sycl -} // __SYCL_INLINE_NAMESPACE(cl) - - -static sycl::unittest::PiImage generateImageWithSpecConstsNative() { - using namespace sycl::unittest; - - std::vector SpecConstData; - PiProperty SC1 = makeSpecConstant(SpecConstData, "SC1", {0}, {0}, {42}); - PiProperty SC2 = makeSpecConstant(SpecConstData, "SC2", {1}, {0}, {8}); - - PiPropertySet PropSet; - addSpecConstants({SC1, SC2}, std::move(SpecConstData), PropSet); - - std::vector Bin{0, 1, 2, 3, 4, 5}; // Random data - - PiArray Entries = - makeEmptyKernels({"SpecializationConstant_TestKernelNative"}); - - PiImage Img{PI_DEVICE_BINARY_TYPE_NATIVE, // Format - __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64, // DeviceTargetSpec - "", // Compile options - "", // Link options - std::move(Bin), - std::move(Entries), - std::move(PropSet)}; - - return Img; -} - -std::atomic RedefinedMemReleaseCalled; -static pi_result redefinedMemRelease(pi_mem mem) { - RedefinedMemReleaseCalled = 1; - std::cout << "rdfMemRel" << std::endl; - return PI_SUCCESS; -} - -pi_result redefinedProgramSetSpecializationConstant(pi_program prog, pi_uint32 spec_id, - size_t spec_size, const void *spec_value) { - return PI_SUCCESS; -} -static sycl::unittest::PiImage Img { generateImageWithSpecConstsNative() }; -static sycl::unittest::PiImageArray<1> ImgArray{&Img}; - - - - -TEST(SpecConstBuffer, ResourceCleanUp) { - RedefinedMemReleaseCalled = 0; - { - sycl::platform Plt{sycl::default_selector()}; - if (Plt.is_host()) { - std::cerr << "Test is not supported on host, skipping\n"; - return; // test is not supported on host. - } - - if (Plt.get_backend() == sycl::backend::ext_oneapi_cuda) { - std::cerr << "Test is not supported on CUDA platform, skipping\n"; - return; - } - - if (Plt.get_backend() == sycl::backend::ext_oneapi_hip) { - std::cerr << "Test is not supported on HIP platform, skipping\n"; - return; - } - - sycl::unittest::PiMock Mock{Plt}; - setupDefaultMockAPIs(Mock); - Mock.redefine(redefinedMemRelease); - Mock.redefine(redefinedProgramSetSpecializationConstant); - const sycl::device Dev = Plt.get_devices()[0]; - sycl::queue Q{Dev}; - const sycl::context Ctx = Q.get_context(); - std::vector kernelId = {sycl::get_kernel_id()}; - sycl::kernel_bundle KernelBundle = - sycl::get_kernel_bundle(Ctx, kernelId); - KernelBundle.set_specialization_constant(1); - auto exeBundle = sycl::build(KernelBundle); - Q.submit([&](sycl::handler &CGH) { - CGH.use_kernel_bundle(exeBundle); - // CGH.set_specialization_constant(1); - // CGH.single_task([=](sycl::kernel_handler KH) { - // (void)KH.get_specialization_constant(); - // }); - CGH.single_task([]() {}); - }); - Q.wait(); - } - EXPECT_EQ(RedefinedMemReleaseCalled, 1); -} - From a41683fccd5a9ef89020b8cb5415d46134715b64 Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Fri, 17 Dec 2021 23:38:05 +0300 Subject: [PATCH 4/7] Revert some debug changes --- .../program_manager/program_manager.cpp | 1 - sycl/source/handler.cpp | 1 - .../SYCL2020/SpecializationConstant.cpp | 19 ------------------- 3 files changed, 21 deletions(-) diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 4d4b84dc32767..6e403a27aa77e 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -1330,7 +1330,6 @@ static bool compatibleWithDevice(RTDeviceBinaryImage *BinImage, kernel_id ProgramManager::getSYCLKernelID(const std::string &KernelName) { std::lock_guard KernelIDsGuard(m_KernelIDsMutex); - std::cout << KernelName << std::endl; auto KernelID = m_KernelIDs.find(KernelName); if (KernelID == m_KernelIDs.end()) throw runtime_error("No kernel found with the specified name", diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index fcbb50a406abc..1a3f9de506019 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -606,7 +606,6 @@ void handler::verifyUsedKernelBundle(const std::string &KernelName) { getOrInsertHandlerKernelBundle(/*Insert=*/false); if (!UsedKernelBundleImplPtr) return; - kernel_id KernelID = detail::get_kernel_id_impl(KernelName); device Dev = detail::getDeviceFromHandler(*this); if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev)) diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 558572da9f3a4..06afc066eae55 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -18,7 +18,6 @@ #include class TestKernel; -class TestKernelNative; const static sycl::specialization_id SpecConst1{42}; __SYCL_INLINE_NAMESPACE(cl) { @@ -38,26 +37,9 @@ template <> struct KernelInfo { static constexpr bool callsAnyThisFreeFunction() { return false; } }; -template <> struct KernelInfo { - static constexpr unsigned getNumParams() { return 0; } - static const kernel_param_desc_t &getParamDesc(int) { - static kernel_param_desc_t Dummy; - return Dummy; - } - static constexpr const char *getName() { - return "SpecializationConstantNative_TestKernel"; - } - static constexpr bool isESIMD() { return false; } - static constexpr bool callsThisItem() { return false; } - static constexpr bool callsAnyThisFreeFunction() { return false; } -}; - template <> const char *get_spec_constant_symbolic_ID() { return "SC1"; } -//template <> const char *get_spec_constant_symbolic_ID() { -// return "SC2"; -//} } // namespace detail } // namespace sycl } // __SYCL_INLINE_NAMESPACE(cl) @@ -88,7 +70,6 @@ static sycl::unittest::PiImage generateImageWithSpecConsts() { return Img; } - static sycl::unittest::PiImage Img = generateImageWithSpecConsts(); static sycl::unittest::PiImageArray<1> ImgArray{&Img}; From 55655691f029c133e4d5dd090515e3b70fd84daf Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Wed, 22 Dec 2021 11:43:06 +0300 Subject: [PATCH 5/7] Added MSpecConstAccessMtx and some minor changes --- sycl/source/detail/device_image_impl.hpp | 1 + sycl/source/detail/program_manager/program_manager.cpp | 1 + sycl/source/handler.cpp | 1 + sycl/unittests/SYCL2020/SpecializationConstant.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/sycl/source/detail/device_image_impl.hpp b/sycl/source/detail/device_image_impl.hpp index c2719e06887ab..af6e895775781 100644 --- a/sycl/source/detail/device_image_impl.hpp +++ b/sycl/source/detail/device_image_impl.hpp @@ -221,6 +221,7 @@ class device_image_impl { Plugin.call(MProgram); } if (MSpecConstsBuffer) { + std::lock_guard Lock{MSpecConstAccessMtx}; const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin(); Plugin.call(MSpecConstsBuffer); } diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 6e403a27aa77e..3e6c61c068825 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -1330,6 +1330,7 @@ static bool compatibleWithDevice(RTDeviceBinaryImage *BinImage, kernel_id ProgramManager::getSYCLKernelID(const std::string &KernelName) { std::lock_guard KernelIDsGuard(m_KernelIDsMutex); + auto KernelID = m_KernelIDs.find(KernelName); if (KernelID == m_KernelIDs.end()) throw runtime_error("No kernel found with the specified name", diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 1a3f9de506019..fcbb50a406abc 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -606,6 +606,7 @@ void handler::verifyUsedKernelBundle(const std::string &KernelName) { getOrInsertHandlerKernelBundle(/*Insert=*/false); if (!UsedKernelBundleImplPtr) return; + kernel_id KernelID = detail::get_kernel_id_impl(KernelName); device Dev = detail::getDeviceFromHandler(*this); if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev)) diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index 06afc066eae55..a925f3c84cd3d 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -92,6 +92,7 @@ TEST(SpecializationConstant, DefaultValuesAreSet) { sycl::unittest::PiMock Mock{Plt}; setupDefaultMockAPIs(Mock); + const sycl::device Dev = Plt.get_devices()[0]; sycl::queue Queue{Dev}; From bcac08740b866dba0137facfed7aa145db45b414 Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Wed, 22 Dec 2021 11:48:00 +0300 Subject: [PATCH 6/7] Clang fix --- sycl/source/detail/program_manager/program_manager.cpp | 2 +- sycl/source/handler.cpp | 2 +- sycl/unittests/SYCL2020/SpecializationConstant.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 3e6c61c068825..aff8dc2f9f74b 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -1330,7 +1330,7 @@ static bool compatibleWithDevice(RTDeviceBinaryImage *BinImage, kernel_id ProgramManager::getSYCLKernelID(const std::string &KernelName) { std::lock_guard KernelIDsGuard(m_KernelIDsMutex); - + auto KernelID = m_KernelIDs.find(KernelName); if (KernelID == m_KernelIDs.end()) throw runtime_error("No kernel found with the specified name", diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index fcbb50a406abc..4dc70eaef76b2 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -606,7 +606,7 @@ void handler::verifyUsedKernelBundle(const std::string &KernelName) { getOrInsertHandlerKernelBundle(/*Insert=*/false); if (!UsedKernelBundleImplPtr) return; - + kernel_id KernelID = detail::get_kernel_id_impl(KernelName); device Dev = detail::getDeviceFromHandler(*this); if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev)) diff --git a/sycl/unittests/SYCL2020/SpecializationConstant.cpp b/sycl/unittests/SYCL2020/SpecializationConstant.cpp index a925f3c84cd3d..18bc331a29d0b 100644 --- a/sycl/unittests/SYCL2020/SpecializationConstant.cpp +++ b/sycl/unittests/SYCL2020/SpecializationConstant.cpp @@ -92,7 +92,7 @@ TEST(SpecializationConstant, DefaultValuesAreSet) { sycl::unittest::PiMock Mock{Plt}; setupDefaultMockAPIs(Mock); - + const sycl::device Dev = Plt.get_devices()[0]; sycl::queue Queue{Dev}; From c33085ca4c312476107f0e9b7d82f47f378568c3 Mon Sep 17 00:00:00 2001 From: HabKaffee Date: Thu, 23 Dec 2021 13:23:47 +0300 Subject: [PATCH 7/7] apply suggested changes --- sycl/source/detail/device_image_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/source/detail/device_image_impl.hpp b/sycl/source/detail/device_image_impl.hpp index af6e895775781..8916a2d25a7ab 100644 --- a/sycl/source/detail/device_image_impl.hpp +++ b/sycl/source/detail/device_image_impl.hpp @@ -223,7 +223,7 @@ class device_image_impl { if (MSpecConstsBuffer) { std::lock_guard Lock{MSpecConstAccessMtx}; const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin(); - Plugin.call(MSpecConstsBuffer); + memReleaseHelper(Plugin, MSpecConstsBuffer); } }