From 9aa8e0204033753b229fa80654656f95b9ed76c0 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Thu, 22 Dec 2022 08:08:42 -0600 Subject: [PATCH 01/25] Used new in DPC++ 2023 option to fix linker crash The issue manifested itself as "Relocation trucated to fit" error, and was caused by the large size of device code produced in debug build. The suggested solution is to use link option `-fsycl-link-huge-device-code`. See https://github.com/intel/llvm/blob/sycl/sycl/doc/UsersManual.md#link-options ``` FAILED: dpctl/tensor/_tensor_impl.cpython-39-x86_64-linux-gnu.so : && /opt/intel/oneapi/compiler/2023.0.0/linux/bin/icpx -fPIC -fsycl -O3 -Wall -Wextra -Winit-self -Wunused-function -Wuninitialized -Wmissing-declarations -fdiagnostics-color=auto -fstack-protector -fstack-protector-all -fpic -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fno-strict-overflow -fno-delete-null-pointer-checks -fsycl -g -Wall -Wextra -Winit-self -Wunused-function -Wuninitialized -Wmissing-declarations -fdiagnostics-color=auto -fstack-protector -fstack-protector-all -fpic -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fno-strict-overflow -fno-delete-null-pointer-checks -fsycl -O0 -ggdb3 -DDEBUG -fsycl-device-code-split=per_kernel -shared -o dpctl/tensor/_tensor_impl.cpython-39-x86_64-linux-gnu.so dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/tensor_py.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/simplify_iteration_space.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/copy_and_cast_usm_to_usm.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/copy_for_reshape.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/linear_sequences.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/eye_ctor.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/full_ctor.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/triul_ctor.cpp.o dpctl/tensor/CMakeFiles/_tensor_impl.dir/libtensor/source/device_support_queries.cpp.o -Wl,-rpath,::::::: && : /lib/x86_64-linux-gnu/crti.o: in function `_init': (.init+0xb): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `__gmon_start__' /tmp/icpx-a02203/_tensor_impl-411e70.o: in function `sycl.descriptor_reg': offload.wrapper.object:(.text.startup+0x4): relocation truncated to fit: R_X86_64_PC32 against `.data.rel.ro' /tmp/icpx-a02203/_tensor_impl-411e70.o: in function `sycl.descriptor_unreg': offload.wrapper.object:(.text.startup+0x14): relocation truncated to fit: R_X86_64_PC32 against `.data.rel.ro' /tmp/icpx-a02203/_tensor_impl-411e70.o:(.eh_frame+0x20): relocation truncated to fit: R_X86_64_PC32 against `.text.startup' /tmp/icpx-a02203/_tensor_impl-411e70.o:(.eh_frame+0x38): relocation truncated to fit: R_X86_64_PC32 against `.text.startup' /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `deregister_tm_clones': crtstuff.c:(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table' crtstuff.c:(.text+0xa): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in dpctl/tensor/_tensor_impl.cpython-39-x86_64-linux-gnu.so crtstuff.c:(.text+0x16): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `_ITM_deregisterTMCloneTable' /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `register_tm_clones': crtstuff.c:(.text+0x33): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table' crtstuff.c:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in dpctl/tensor/_tensor_impl.cpython-39-x86_64-linux-gnu.so crtstuff.c:(.text+0x57): additional relocation overflows omitted from the output dpctl/tensor/_tensor_impl.cpython-39-x86_64-linux-gnu.so: PC-relative offset overflow in PLT entry for `_ZSt10_ConstructIN4sycl3_V15eventEJEEvPT_DpOT0_' icpx: error: linker command failed with exit code 1 (use -v to see invocation) ``` --- dpctl/tensor/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dpctl/tensor/CMakeLists.txt b/dpctl/tensor/CMakeLists.txt index a587d84609..b496ecfbd8 100644 --- a/dpctl/tensor/CMakeLists.txt +++ b/dpctl/tensor/CMakeLists.txt @@ -29,6 +29,7 @@ pybind11_add_module(${python_module_name} MODULE ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/device_support_queries.cpp ) target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel) +target_link_options(${python_module_name} PRIVATE -fsycl-link-huge-device-code) target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include From ca987af2f499ce615e653f15278044fe24eaf960 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 07:14:25 -0600 Subject: [PATCH 02/25] Added missing include to defined __SYCL_COMPILER_VERSION --- libsyclinterface/include/dpctl_sycl_kernel_interface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libsyclinterface/include/dpctl_sycl_kernel_interface.h b/libsyclinterface/include/dpctl_sycl_kernel_interface.h index ad46ecb3f1..e101736df3 100644 --- a/libsyclinterface/include/dpctl_sycl_kernel_interface.h +++ b/libsyclinterface/include/dpctl_sycl_kernel_interface.h @@ -32,6 +32,7 @@ #include "Support/MemOwnershipAttrs.h" #include "dpctl_data_types.h" #include "dpctl_sycl_types.h" +#include DPCTL_C_EXTERN_C_BEGIN From 4deadb8099f21e496cf29139458fbf19a6e96dd3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 07:37:57 -0600 Subject: [PATCH 03/25] Skipping check for preferred_vector_width_double without fp64 aspect. DPC++ 2023 has introduced a regression where the aspect returns 1 even for devices without fp64 aspect. --- libsyclinterface/tests/test_sycl_device_interface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsyclinterface/tests/test_sycl_device_interface.cpp b/libsyclinterface/tests/test_sycl_device_interface.cpp index 80d6566996..20bc25f3d9 100644 --- a/libsyclinterface/tests/test_sycl_device_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_interface.cpp @@ -312,7 +312,9 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetPreferredVectorWidthDouble) EXPECT_TRUE(vector_width_double != 0); } else { - EXPECT_TRUE(vector_width_double == 0); + // FIXME: DPC++ 2023 RT must have a bug, since it returns 1 for + // devices without aspect::fp64 + // EXPECT_TRUE(vector_width_double == 0); } } From d24dcde147058558c7d2c59bf97f255cfc4e8604 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 07:45:16 -0600 Subject: [PATCH 04/25] Do not exercise DPCTL_HOST backend, and DPCTL_HOST_DEVICE device type since host device has been removed from 2023 compiler --- libsyclinterface/tests/test_sycl_device_manager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libsyclinterface/tests/test_sycl_device_manager.cpp b/libsyclinterface/tests/test_sycl_device_manager.cpp index ad4d3f39ab..333f221dfb 100644 --- a/libsyclinterface/tests/test_sycl_device_manager.cpp +++ b/libsyclinterface/tests/test_sycl_device_manager.cpp @@ -134,8 +134,7 @@ TEST_P(TestDPCTLGetDevices, ChkGetAt) INSTANTIATE_TEST_SUITE_P( GetDevices, TestDPCTLGetDevices, - ::testing::Values(DPCTLSyclBackendType::DPCTL_HOST, - DPCTLSyclBackendType::DPCTL_LEVEL_ZERO, + ::testing::Values(DPCTLSyclBackendType::DPCTL_LEVEL_ZERO, DPCTLSyclBackendType::DPCTL_OPENCL, DPCTLSyclBackendType::DPCTL_OPENCL | DPCTLSyclDeviceType::DPCTL_GPU)); @@ -172,8 +171,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(DPCTLSyclDeviceType::DPCTL_ACCELERATOR, DPCTLSyclDeviceType::DPCTL_ALL, DPCTLSyclDeviceType::DPCTL_CPU, - DPCTLSyclDeviceType::DPCTL_GPU, - DPCTLSyclDeviceType::DPCTL_HOST_DEVICE)); + DPCTLSyclDeviceType::DPCTL_GPU)); struct TestGetNumDevicesForBTy : public ::testing::TestWithParam { @@ -210,7 +208,6 @@ INSTANTIATE_TEST_SUITE_P( TestGetNumDevicesForBTy, ::testing::Values(DPCTLSyclBackendType::DPCTL_CUDA, DPCTLSyclBackendType::DPCTL_ALL_BACKENDS, - DPCTLSyclBackendType::DPCTL_HOST, DPCTLSyclBackendType::DPCTL_LEVEL_ZERO, DPCTLSyclBackendType::DPCTL_OPENCL)); @@ -289,8 +286,7 @@ TEST_P(TestDPCTLGetDevicesOrdering, ChkConsistencyWithFilterSelector) INSTANTIATE_TEST_SUITE_P( GetDevices, TestDPCTLGetDevicesOrdering, - ::testing::Values(DPCTLSyclDeviceType::DPCTL_HOST_DEVICE, - DPCTLSyclDeviceType::DPCTL_ACCELERATOR, + ::testing::Values(DPCTLSyclDeviceType::DPCTL_ACCELERATOR, DPCTLSyclDeviceType::DPCTL_GPU, DPCTLSyclDeviceType::DPCTL_CPU)); From d1b4d27006eb7830a5ea41e8911632f092033855 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 07:47:01 -0600 Subject: [PATCH 05/25] Adjusted test for device-specific kernel descriptor private-memory. With 2022.2 a non-zero value was being returned for interoperability kernel compiler for GPU device, but it now returns zero with 2023.0 compiler. --- libsyclinterface/tests/test_sycl_kernel_interface.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libsyclinterface/tests/test_sycl_kernel_interface.cpp b/libsyclinterface/tests/test_sycl_kernel_interface.cpp index b679fe09d5..21d2c987d0 100644 --- a/libsyclinterface/tests/test_sycl_kernel_interface.cpp +++ b/libsyclinterface/tests/test_sycl_kernel_interface.cpp @@ -145,14 +145,8 @@ TEST_P(TestDPCTLSyclKernelInterface, CheckGetPrivateMemSize) EXPECT_NO_FATAL_FAILURE(axpy_private_mem_sz = DPCTLKernel_GetPrivateMemSize(AxpyKRef)); - if (DPCTLDevice_IsGPU(DRef)) { - ASSERT_TRUE(add_private_mem_sz != 0); - ASSERT_TRUE(axpy_private_mem_sz != 0); - } - else { - ASSERT_TRUE(add_private_mem_sz >= 0); - ASSERT_TRUE(axpy_private_mem_sz >= 0); - } + ASSERT_TRUE(add_private_mem_sz >= 0); + ASSERT_TRUE(axpy_private_mem_sz >= 0); } TEST_P(TestDPCTLSyclKernelInterface, CheckGetMaxNumSubGroups) From 1389a322f50fe4551802e9f1406be79272635ba3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 07:49:47 -0600 Subject: [PATCH 06/25] Change gen_docs.py to use Release build Debug build was used previsouly to accelerate the build, but due to growth of device section, debug build takes longer than the release build. --- scripts/gen_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_docs.py b/scripts/gen_docs.py index a0455748c3..377b37f6d8 100644 --- a/scripts/gen_docs.py +++ b/scripts/gen_docs.py @@ -46,7 +46,7 @@ def run( sys.executable, "setup.py", "develop", - "--build-type=Debug", + "--build-type=Release", "--generator=Ninja", "--", "-DCMAKE_C_COMPILER:PATH=" + c_compiler, From 77efc73f8bc61a335cd4eaae878cc4328a5f4f14 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 11:00:41 -0600 Subject: [PATCH 07/25] Fixed test_cython_api --- dpctl/tests/setup_cython_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpctl/tests/setup_cython_api.py b/dpctl/tests/setup_cython_api.py index 9f9bd8f370..204a78cbc6 100644 --- a/dpctl/tests/setup_cython_api.py +++ b/dpctl/tests/setup_cython_api.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import Cython.Build import setuptools +from Cython.Build import build_ext import dpctl @@ -27,8 +27,8 @@ ) setuptools.setup( - name="_cython_api", + name="test_cython_api", version="0.0.0", ext_modules=[ext], - cmdclass={"build_ext": Cython.Build.build_ext}, + cmdclass={"build_ext": build_ext}, ) From 2e54bf69758030a4abb2018146135ce5d7473d83 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 12:44:43 -0600 Subject: [PATCH 08/25] Removed 2023_SWITCHOVER --- .../helper/source/dpctl_utils_helper.cpp | 36 --------- .../include/Config/dpctl_config.h.in | 9 +-- .../include/dpctl_device_selection.hpp | 75 ------------------- .../include/dpctl_sycl_kernel_interface.h | 3 - .../source/dpctl_device_selection.cpp | 36 --------- .../source/dpctl_sycl_context_interface.cpp | 8 -- .../source/dpctl_sycl_device_interface.cpp | 8 -- .../source/dpctl_sycl_kernel_interface.cpp | 2 - .../source/dpctl_sycl_platform_interface.cpp | 4 - .../source/dpctl_sycl_platform_manager.cpp | 4 - libsyclinterface/tests/test_helper.cpp | 36 --------- .../tests/test_sycl_device_aspects.cpp | 3 - .../tests/test_sycl_event_interface.cpp | 5 +- .../tests/test_sycl_kernel_interface.cpp | 4 - .../tests/test_sycl_queue_interface.cpp | 5 -- 15 files changed, 2 insertions(+), 236 deletions(-) diff --git a/libsyclinterface/helper/source/dpctl_utils_helper.cpp b/libsyclinterface/helper/source/dpctl_utils_helper.cpp index e13189784d..4484e48d02 100644 --- a/libsyclinterface/helper/source/dpctl_utils_helper.cpp +++ b/libsyclinterface/helper/source/dpctl_utils_helper.cpp @@ -49,11 +49,6 @@ std::string DPCTL_DeviceTypeToStr(info::device_type devTy) case info::device_type::custom: ss << "custom"; break; -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case info::device_type::host: - ss << "host"; - break; -#endif default: ss << "unknown"; } @@ -93,10 +88,6 @@ backend DPCTL_DPCTLBackendTypeToSyclBackend(DPCTLSyclBackendType BeTy) switch (BeTy) { case DPCTLSyclBackendType::DPCTL_CUDA: return backend::ext_oneapi_cuda; -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case DPCTLSyclBackendType::DPCTL_HOST: - return backend::host; -#endif case DPCTLSyclBackendType::DPCTL_LEVEL_ZERO: return backend::ext_oneapi_level_zero; case DPCTLSyclBackendType::DPCTL_OPENCL: @@ -113,10 +104,6 @@ DPCTLSyclBackendType DPCTL_SyclBackendToDPCTLBackendType(backend B) switch (B) { case backend::ext_oneapi_cuda: return DPCTLSyclBackendType::DPCTL_CUDA; -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case backend::host: - return DPCTLSyclBackendType::DPCTL_HOST; -#endif case backend::ext_oneapi_level_zero: return DPCTLSyclBackendType::DPCTL_LEVEL_ZERO; case backend::opencl: @@ -177,11 +164,6 @@ std::string DPCTL_AspectToStr(aspect aspectTy) { std::stringstream ss; switch (aspectTy) { -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case aspect::host: - ss << "host"; - break; -#endif case aspect::cpu: ss << "cpu"; break; @@ -254,11 +236,6 @@ aspect DPCTL_StrToAspectType(const std::string &aspectTyStr) if (aspectTyStr == "cpu") { aspectTy = aspect::cpu; } -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - else if (aspectTyStr == "host") { - aspectTy = aspect::host; - } -#endif else if (aspectTyStr == "gpu") { aspectTy = aspect::gpu; } @@ -323,10 +300,6 @@ aspect DPCTL_StrToAspectType(const std::string &aspectTyStr) aspect DPCTL_DPCTLAspectTypeToSyclAspect(DPCTLSyclAspectType AspectTy) { switch (AspectTy) { -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case DPCTLSyclAspectType::host: - return aspect::host; -#endif case DPCTLSyclAspectType::cpu: return aspect::cpu; case DPCTLSyclAspectType::gpu: @@ -373,10 +346,6 @@ aspect DPCTL_DPCTLAspectTypeToSyclAspect(DPCTLSyclAspectType AspectTy) DPCTLSyclAspectType DPCTL_SyclAspectToDPCTLAspectType(aspect Aspect) { switch (Aspect) { -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case aspect::host: - return DPCTLSyclAspectType::host; -#endif case aspect::cpu: return DPCTLSyclAspectType::cpu; case aspect::gpu: @@ -502,11 +471,6 @@ std::string DPCTL_GetDeviceFilterString(const device &Device) case backend::opencl: ss << "opencl"; break; -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case backend::host: - ss << "host"; - break; -#endif default: ss << "unknown"; }; diff --git a/libsyclinterface/include/Config/dpctl_config.h.in b/libsyclinterface/include/Config/dpctl_config.h.in index af6b3befa0..b1cb9562ef 100644 --- a/libsyclinterface/include/Config/dpctl_config.h.in +++ b/libsyclinterface/include/Config/dpctl_config.h.in @@ -29,14 +29,7 @@ #cmakedefine DPCTL_ENABLE_L0_PROGRAM_CREATION \ @DPCTL_ENABLE_L0_PROGRAM_CREATION@ -/* Version of SYCL DPC++ 2023 compiler at which transition to SYCL 2020 occurs */ -/* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and - 20221101L on Windows */ -#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L - -/* Version of SYCL DPC++ compiler at which info::max_work_item_size was - made templated */ -#define __SYCL_COMPILER_MAX_WORK_ITEM_SIZE_THRESHOLD __SYCL_COMPILER_2023_SWITCHOVER +#define __SYCL_COMPILER_VERSION_REQUIRED 20221201L /* The DPCPP version used to build dpctl */ #define DPCTL_DPCPP_VERSION "@IntelSycl_VERSION@" diff --git a/libsyclinterface/include/dpctl_device_selection.hpp b/libsyclinterface/include/dpctl_device_selection.hpp index a904228d34..33a810d354 100644 --- a/libsyclinterface/include/dpctl_device_selection.hpp +++ b/libsyclinterface/include/dpctl_device_selection.hpp @@ -35,8 +35,6 @@ namespace dpctl namespace syclinterface { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER - class DPCTL_API dpctl_device_selector { public: @@ -90,78 +88,5 @@ class DPCTL_API dpctl_host_selector : public dpctl_device_selector int operator()(const sycl::device &) const override; }; -#else - -class DPCTL_API dpctl_device_selector : public sycl::device_selector -{ -public: - virtual ~dpctl_device_selector() = default; - - virtual int operator()(const sycl::device &device) const = 0; -}; - -class DPCTL_API dpctl_accelerator_selector : public dpctl_device_selector -{ -public: - dpctl_accelerator_selector() : _impl(){}; - int operator()(const sycl::device &d) const override; - -private: - sycl::accelerator_selector _impl; -}; - -class DPCTL_API dpctl_default_selector : public dpctl_device_selector -{ -public: - dpctl_default_selector() : _impl(){}; - int operator()(const sycl::device &d) const override; - -private: - sycl::default_selector _impl; -}; - -class DPCTL_API dpctl_gpu_selector : public dpctl_device_selector -{ -public: - dpctl_gpu_selector() : _impl(){}; - int operator()(const sycl::device &d) const override; - -private: - sycl::gpu_selector _impl; -}; - -class DPCTL_API dpctl_cpu_selector : public dpctl_device_selector -{ -public: - dpctl_cpu_selector() : _impl(){}; - int operator()(const sycl::device &d) const override; - -private: - sycl::cpu_selector _impl; -}; - -class DPCTL_API dpctl_filter_selector : public dpctl_device_selector -{ -public: - dpctl_filter_selector(const std::string &fs) : _impl(fs) {} - - int operator()(const sycl::device &d) const override; - -private: - sycl::ext::oneapi::filter_selector _impl; -}; - -class DPCTL_API dpctl_host_selector : public dpctl_device_selector -{ -public: - dpctl_host_selector() : _impl(){}; - int operator()(const sycl::device &d) const override; - -private: - sycl::host_selector _impl; -}; - -#endif - } // namespace syclinterface } // namespace dpctl diff --git a/libsyclinterface/include/dpctl_sycl_kernel_interface.h b/libsyclinterface/include/dpctl_sycl_kernel_interface.h index e101736df3..c4b3a46e0f 100644 --- a/libsyclinterface/include/dpctl_sycl_kernel_interface.h +++ b/libsyclinterface/include/dpctl_sycl_kernel_interface.h @@ -32,7 +32,6 @@ #include "Support/MemOwnershipAttrs.h" #include "dpctl_data_types.h" #include "dpctl_sycl_types.h" -#include DPCTL_C_EXTERN_C_BEGIN @@ -131,7 +130,6 @@ DPCTL_API uint32_t DPCTLKernel_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclKernelRef KRef); -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER /*! * !brief Wrapper around * `kernel::get_info()`. @@ -144,7 +142,6 @@ DPCTLKernel_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclKernelRef KRef); DPCTL_API uint32_t DPCTLKernel_GetMaxSubGroupSize(__dpctl_keep const DPCTLSyclKernelRef KRef); -#endif /*! * !brief Wrapper around diff --git a/libsyclinterface/source/dpctl_device_selection.cpp b/libsyclinterface/source/dpctl_device_selection.cpp index 12c28cbc23..6e5437b19a 100644 --- a/libsyclinterface/source/dpctl_device_selection.cpp +++ b/libsyclinterface/source/dpctl_device_selection.cpp @@ -34,8 +34,6 @@ namespace dpctl namespace syclinterface { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER - int dpctl_device_selector::operator()(const sycl::device &) const { return REJECT_DEVICE; @@ -72,39 +70,5 @@ int dpctl_host_selector::operator()(const sycl::device &) const return REJECT_DEVICE; } -#else - -int dpctl_accelerator_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -int dpctl_default_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -int dpctl_gpu_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -int dpctl_cpu_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -int dpctl_filter_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -int dpctl_host_selector::operator()(const sycl::device &d) const -{ - return _impl(d); -} - -#endif - } // namespace syclinterface } // namespace dpctl diff --git a/libsyclinterface/source/dpctl_sycl_context_interface.cpp b/libsyclinterface/source/dpctl_sycl_context_interface.cpp index b83d17e101..d5b7c87d0f 100644 --- a/libsyclinterface/source/dpctl_sycl_context_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_context_interface.cpp @@ -170,11 +170,7 @@ bool DPCTLContext_IsHost(__dpctl_keep const DPCTLSyclContextRef CtxRef) { auto Ctx = unwrap(CtxRef); if (Ctx) { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER return false; -#else - return Ctx->is_host(); -#endif } return false; } @@ -194,10 +190,6 @@ DPCTLContext_GetBackend(__dpctl_keep const DPCTLSyclContextRef CtxRef) auto BE = unwrap(CtxRef)->get_platform().get_backend(); switch (BE) { -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case backend::host: - return DPCTL_HOST; -#endif case backend::opencl: return DPCTL_OPENCL; case backend::ext_oneapi_level_zero: diff --git a/libsyclinterface/source/dpctl_sycl_device_interface.cpp b/libsyclinterface/source/dpctl_sycl_device_interface.cpp index 5b86e426f2..59501d3094 100644 --- a/libsyclinterface/source/dpctl_sycl_device_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_interface.cpp @@ -46,12 +46,8 @@ using namespace dpctl::syclinterface; device *new_device_from_selector(const dpctl_device_selector *sel) { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER return new device( [=](const device &d) -> int { return sel->operator()(d); }); -#else - return new device(*sel); -#endif } template @@ -181,11 +177,7 @@ bool DPCTLDevice_IsHost(__dpctl_keep const DPCTLSyclDeviceRef DRef) { auto D = unwrap(DRef); if (D) { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER return false; -#else - return D->is_host(); -#endif } return false; } diff --git a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp index 95a800a34e..398c39c2fe 100644 --- a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp @@ -161,7 +161,6 @@ DPCTLKernel_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclKernelRef KRef) return static_cast(v); } -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER // commented out due to bug in DPC++ runtime, get_info for max_sub_group_size // exported by libsycl has different, not SPEC-compliant signature uint32_t @@ -185,7 +184,6 @@ DPCTLKernel_GetMaxSubGroupSize(__dpctl_keep const DPCTLSyclKernelRef KRef) devs[0]); return v; } -#endif uint32_t DPCTLKernel_GetCompileNumSubGroups(__dpctl_keep const DPCTLSyclKernelRef KRef) diff --git a/libsyclinterface/source/dpctl_sycl_platform_interface.cpp b/libsyclinterface/source/dpctl_sycl_platform_interface.cpp index a33a1e3328..3c766ad3ac 100644 --- a/libsyclinterface/source/dpctl_sycl_platform_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_platform_interface.cpp @@ -47,12 +47,8 @@ using namespace dpctl::syclinterface; platform *new_platform_from_selector(const dpctl_device_selector *sel) { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER return new platform( [=](const device &d) -> int { return sel->operator()(d); }); -#else - return new platform(*sel); -#endif } } // end of anonymous namespace diff --git a/libsyclinterface/source/dpctl_sycl_platform_manager.cpp b/libsyclinterface/source/dpctl_sycl_platform_manager.cpp index ffbfb9a939..9d0b199790 100644 --- a/libsyclinterface/source/dpctl_sycl_platform_manager.cpp +++ b/libsyclinterface/source/dpctl_sycl_platform_manager.cpp @@ -71,11 +71,7 @@ std::string platform_print_info_impl(const platform &p, size_t verbosity) << p.get_info() << _endl << std::setw(4) << " " << std::left << std::setw(12) << "Vendor" << vendor << _endl << std::setw(4) << " " << std::left << std::setw(12) << "Backend"; -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER ss << p.get_backend(); -#else - p.is_host() ? (ss << "unknown") : (ss << p.get_backend()); -#endif ss << _endl; // Get number of devices on the platform diff --git a/libsyclinterface/tests/test_helper.cpp b/libsyclinterface/tests/test_helper.cpp index 0fe530fbce..ea529cbf24 100644 --- a/libsyclinterface/tests/test_helper.cpp +++ b/libsyclinterface/tests/test_helper.cpp @@ -45,13 +45,6 @@ TEST_F(TestHelperFns, ChkDeviceTypeToStr) res = DPCTL_DeviceTypeToStr(sycl::info::device_type::gpu)); ASSERT_TRUE(res == "gpu"); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE( - res = DPCTL_DeviceTypeToStr(sycl::info::device_type::host)); - // since host device is being deprecated in SYCL 2020, accept unknown - ASSERT_TRUE(res == "host"); -#endif - EXPECT_NO_FATAL_FAILURE( res = DPCTL_DeviceTypeToStr(sycl::info::device_type::custom)); ASSERT_TRUE(res == "custom"); @@ -75,11 +68,6 @@ TEST_F(TestHelperFns, ChkStrToDeviceType) EXPECT_NO_FATAL_FAILURE(dev_type = DPCTL_StrToDeviceType("gpu")); ASSERT_TRUE(dev_type == sycl::info::device_type::gpu); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE(dev_type = DPCTL_StrToDeviceType("host")); - ASSERT_TRUE(dev_type == sycl::info::device_type::host); -#endif - EXPECT_NO_FATAL_FAILURE(dev_type = DPCTL_StrToDeviceType("accelerator")); ASSERT_TRUE(dev_type == sycl::info::device_type::accelerator); @@ -97,12 +85,6 @@ TEST_F(TestHelperFns, ChkDPCTLBackendTypeToSyclBackend) DPCTLSyclBackendType::DPCTL_CUDA)); ASSERT_TRUE(res == sycl::backend::ext_oneapi_cuda); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE(res = DPCTL_DPCTLBackendTypeToSyclBackend( - DPCTLSyclBackendType::DPCTL_HOST)); - ASSERT_TRUE(res == sycl::backend::host); -#endif - EXPECT_NO_FATAL_FAILURE(res = DPCTL_DPCTLBackendTypeToSyclBackend( DPCTLSyclBackendType::DPCTL_OPENCL)); ASSERT_TRUE(res == sycl::backend::opencl); @@ -128,12 +110,6 @@ TEST_F(TestHelperFns, ChkSyclBackendToDPCTLBackendType) DTy = DPCTL_SyclBackendToDPCTLBackendType(sycl::backend::opencl)); ASSERT_TRUE(DTy == DPCTLSyclBackendType::DPCTL_OPENCL); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE( - DTy = DPCTL_SyclBackendToDPCTLBackendType(sycl::backend::host)); - ASSERT_TRUE(DTy == DPCTLSyclBackendType::DPCTL_HOST); -#endif - EXPECT_NO_FATAL_FAILURE(DTy = DPCTL_SyclBackendToDPCTLBackendType( sycl::backend::ext_oneapi_cuda)); ASSERT_TRUE(DTy == DPCTLSyclBackendType::DPCTL_CUDA); @@ -163,12 +139,6 @@ TEST_F(TestHelperFns, ChkDPCTLDeviceTypeToSyclDeviceType) DPCTLSyclDeviceType::DPCTL_CUSTOM)); ASSERT_TRUE(dev_type == sycl::info::device_type::custom); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE(dev_type = DPCTL_DPCTLDeviceTypeToSyclDeviceType( - DPCTLSyclDeviceType::DPCTL_HOST_DEVICE)); - ASSERT_TRUE(dev_type == sycl::info::device_type::host); -#endif - EXPECT_NO_FATAL_FAILURE(dev_type = DPCTL_DPCTLDeviceTypeToSyclDeviceType( DPCTLSyclDeviceType::DPCTL_AUTOMATIC)); ASSERT_TRUE(dev_type == sycl::info::device_type::automatic); @@ -190,12 +160,6 @@ TEST_F(TestHelperFns, SyclDeviceTypeToDPCTLDeviceType) sycl::info::device_type::gpu)); ASSERT_TRUE(DTy == DPCTLSyclDeviceType::DPCTL_GPU); -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - EXPECT_NO_FATAL_FAILURE(DTy = DPCTL_SyclDeviceTypeToDPCTLDeviceType( - sycl::info::device_type::host)); - ASSERT_TRUE(DTy == DPCTLSyclDeviceType::DPCTL_HOST_DEVICE); -#endif - EXPECT_NO_FATAL_FAILURE(DTy = DPCTL_SyclDeviceTypeToDPCTLDeviceType( sycl::info::device_type::accelerator)); ASSERT_TRUE(DTy == DPCTLSyclDeviceType::DPCTL_ACCELERATOR); diff --git a/libsyclinterface/tests/test_sycl_device_aspects.cpp b/libsyclinterface/tests/test_sycl_device_aspects.cpp index a1cae92876..0d9e373184 100644 --- a/libsyclinterface/tests/test_sycl_device_aspects.cpp +++ b/libsyclinterface/tests/test_sycl_device_aspects.cpp @@ -101,9 +101,6 @@ auto build_params() constexpr auto param_2 = get_param_list>( -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - std::make_pair("host", sycl::aspect::host), -#endif std::make_pair("cpu", sycl::aspect::cpu), std::make_pair("gpu", sycl::aspect::gpu), std::make_pair("accelerator", sycl::aspect::accelerator), diff --git a/libsyclinterface/tests/test_sycl_event_interface.cpp b/libsyclinterface/tests/test_sycl_event_interface.cpp index 17ebff151e..846cdd2cc0 100644 --- a/libsyclinterface/tests/test_sycl_event_interface.cpp +++ b/libsyclinterface/tests/test_sycl_event_interface.cpp @@ -158,11 +158,8 @@ TEST_F(TestDPCTLSyclEventInterface, CheckGetProfiling) { property_list propList{property::queue::enable_profiling()}; -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER queue Q(cpu_selector_v, propList); -#else - queue Q(cpu_selector(), propList); -#endif + auto eA = Q.submit( [&](handler &h) { h.parallel_for(1000, [=](id<1>) { /*...*/ }); }); DPCTLSyclEventRef ERef = reinterpret_cast(&eA); diff --git a/libsyclinterface/tests/test_sycl_kernel_interface.cpp b/libsyclinterface/tests/test_sycl_kernel_interface.cpp index 21d2c987d0..97fba96bc3 100644 --- a/libsyclinterface/tests/test_sycl_kernel_interface.cpp +++ b/libsyclinterface/tests/test_sycl_kernel_interface.cpp @@ -161,7 +161,6 @@ TEST_P(TestDPCTLSyclKernelInterface, CheckGetMaxNumSubGroups) ASSERT_TRUE(axpy_mnsg != 0); } -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER TEST_P(TestDPCTLSyclKernelInterface, CheckGetMaxSubGroupSize) { @@ -174,7 +173,6 @@ TEST_P(TestDPCTLSyclKernelInterface, CheckGetMaxSubGroupSize) ASSERT_TRUE(add_msg_sz != 0); ASSERT_TRUE(axpy_msg_sz != 0); } -#endif TEST_P(TestDPCTLSyclKernelInterface, CheckGetCompileNumSubGroups) { @@ -251,14 +249,12 @@ TEST_F(TestDPCTLSyclKernelNullArgs, CheckGetMaxNumSubGroupsNullKRef) ASSERT_EQ(DPCTLKernel_GetMaxNumSubGroups(NullKRef), 0); } -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_2023_SWITCHOVER TEST_F(TestDPCTLSyclKernelNullArgs, CheckGetMaxSubGroupSizeNullKRef) { DPCTLSyclKernelRef NullKRef = nullptr; ASSERT_EQ(DPCTLKernel_GetMaxSubGroupSize(NullKRef), 0); } -#endif TEST_F(TestDPCTLSyclKernelNullArgs, CheckGetCompileNumSubGroupsNullKRef) { diff --git a/libsyclinterface/tests/test_sycl_queue_interface.cpp b/libsyclinterface/tests/test_sycl_queue_interface.cpp index 38266eb2f9..8d23929d39 100644 --- a/libsyclinterface/tests/test_sycl_queue_interface.cpp +++ b/libsyclinterface/tests/test_sycl_queue_interface.cpp @@ -356,11 +356,6 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckGetBackend) case DPCTL_CUDA: EXPECT_TRUE(Backend == backend::ext_oneapi_cuda); break; -#if __SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER - case DPCTL_HOST: - EXPECT_TRUE(Backend == backend::host); - break; -#endif case DPCTL_LEVEL_ZERO: EXPECT_TRUE(Backend == backend::ext_oneapi_level_zero); break; From 3267ef63b900a975a434166bd32bb900a9d20299 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 15:04:29 -0600 Subject: [PATCH 09/25] Added static assert for minimum require compiler version --- libsyclinterface/source/dpctl_device_selection.cpp | 6 ++++++ libsyclinterface/source/dpctl_sycl_context_interface.cpp | 3 +++ libsyclinterface/source/dpctl_sycl_device_interface.cpp | 3 +++ libsyclinterface/source/dpctl_sycl_device_manager.cpp | 6 +++++- .../source/dpctl_sycl_device_selector_interface.cpp | 4 ++++ libsyclinterface/source/dpctl_sycl_event_interface.cpp | 4 ++++ .../source/dpctl_sycl_kernel_bundle_interface.cpp | 2 ++ libsyclinterface/source/dpctl_sycl_kernel_interface.cpp | 3 +++ libsyclinterface/source/dpctl_sycl_platform_interface.cpp | 2 ++ libsyclinterface/source/dpctl_sycl_platform_manager.cpp | 2 ++ libsyclinterface/source/dpctl_sycl_queue_interface.cpp | 3 +++ libsyclinterface/source/dpctl_sycl_queue_manager.cpp | 3 +++ libsyclinterface/source/dpctl_sycl_usm_interface.cpp | 4 ++++ 13 files changed, 44 insertions(+), 1 deletion(-) diff --git a/libsyclinterface/source/dpctl_device_selection.cpp b/libsyclinterface/source/dpctl_device_selection.cpp index 6e5437b19a..f1afab21a6 100644 --- a/libsyclinterface/source/dpctl_device_selection.cpp +++ b/libsyclinterface/source/dpctl_device_selection.cpp @@ -29,6 +29,12 @@ #include "Config/dpctl_config.h" #include +namespace +{ +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); +} + namespace dpctl { namespace syclinterface diff --git a/libsyclinterface/source/dpctl_sycl_context_interface.cpp b/libsyclinterface/source/dpctl_sycl_context_interface.cpp index d5b7c87d0f..65ffa22b73 100644 --- a/libsyclinterface/source/dpctl_sycl_context_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_context_interface.cpp @@ -35,6 +35,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; } // end of anonymous namespace diff --git a/libsyclinterface/source/dpctl_sycl_device_interface.cpp b/libsyclinterface/source/dpctl_sycl_device_interface.cpp index 59501d3094..21f2e474f2 100644 --- a/libsyclinterface/source/dpctl_sycl_device_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_interface.cpp @@ -42,6 +42,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; device *new_device_from_selector(const dpctl_device_selector *sel) diff --git a/libsyclinterface/source/dpctl_sycl_device_manager.cpp b/libsyclinterface/source/dpctl_sycl_device_manager.cpp index 3ce34df2c5..71160089cb 100644 --- a/libsyclinterface/source/dpctl_sycl_device_manager.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_manager.cpp @@ -29,7 +29,8 @@ #include "dpctl_sycl_enum_types.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_utils_helper.h" -#include /* SYCL headers */ +#include /* SYCL headers */ +#include /* Config */ #include #include #include @@ -40,6 +41,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; /* diff --git a/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp b/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp index 5440b803f8..09561278bc 100644 --- a/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp @@ -24,6 +24,7 @@ //===----------------------------------------------------------------------===// #include "dpctl_sycl_device_selector_interface.h" +#include "Config/dpctl_config.h" #include "dpctl_device_selection.hpp" #include "dpctl_error_handlers.h" #include "dpctl_sycl_type_casters.hpp" @@ -33,6 +34,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; } // end of anonymous namespace diff --git a/libsyclinterface/source/dpctl_sycl_event_interface.cpp b/libsyclinterface/source/dpctl_sycl_event_interface.cpp index 804c76ccb9..3f872f4493 100644 --- a/libsyclinterface/source/dpctl_sycl_event_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_event_interface.cpp @@ -25,6 +25,7 @@ //===----------------------------------------------------------------------===// #include "dpctl_sycl_event_interface.h" +#include "Config/dpctl_config.h" #include "dpctl_error_handlers.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_utils_helper.h" @@ -35,6 +36,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; } // end of anonymous namespace diff --git a/libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp b/libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp index b196264350..002edabc26 100644 --- a/libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp @@ -56,6 +56,8 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); using namespace dpctl::syclinterface; diff --git a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp index 398c39c2fe..e0c39c0646 100644 --- a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp @@ -36,6 +36,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; } // end of anonymous namespace diff --git a/libsyclinterface/source/dpctl_sycl_platform_interface.cpp b/libsyclinterface/source/dpctl_sycl_platform_interface.cpp index 3c766ad3ac..b72d828b09 100644 --- a/libsyclinterface/source/dpctl_sycl_platform_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_platform_interface.cpp @@ -42,6 +42,8 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); using namespace dpctl::syclinterface; diff --git a/libsyclinterface/source/dpctl_sycl_platform_manager.cpp b/libsyclinterface/source/dpctl_sycl_platform_manager.cpp index 9d0b199790..6717b48c6f 100644 --- a/libsyclinterface/source/dpctl_sycl_platform_manager.cpp +++ b/libsyclinterface/source/dpctl_sycl_platform_manager.cpp @@ -41,6 +41,8 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); using namespace dpctl::syclinterface; diff --git a/libsyclinterface/source/dpctl_sycl_queue_interface.cpp b/libsyclinterface/source/dpctl_sycl_queue_interface.cpp index 6972b812c3..a8343598c2 100644 --- a/libsyclinterface/source/dpctl_sycl_queue_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_queue_interface.cpp @@ -25,6 +25,7 @@ //===----------------------------------------------------------------------===// #include "dpctl_sycl_queue_interface.h" +#include "Config/dpctl_config.h" #include "dpctl_error_handlers.h" #include "dpctl_sycl_context_interface.h" #include "dpctl_sycl_device_interface.h" @@ -38,6 +39,8 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); using namespace dpctl::syclinterface; diff --git a/libsyclinterface/source/dpctl_sycl_queue_manager.cpp b/libsyclinterface/source/dpctl_sycl_queue_manager.cpp index c2b9c94140..54e97c0efa 100644 --- a/libsyclinterface/source/dpctl_sycl_queue_manager.cpp +++ b/libsyclinterface/source/dpctl_sycl_queue_manager.cpp @@ -24,6 +24,7 @@ /// //===----------------------------------------------------------------------===// #include "dpctl_sycl_queue_manager.h" +#include "Config/dpctl_config.h" #include "dpctl_error_handlers.h" #include "dpctl_sycl_device_manager.h" #include "dpctl_sycl_type_casters.hpp" @@ -37,6 +38,8 @@ using namespace sycl; // Anonymous namespace for private helpers namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); using namespace dpctl::syclinterface; diff --git a/libsyclinterface/source/dpctl_sycl_usm_interface.cpp b/libsyclinterface/source/dpctl_sycl_usm_interface.cpp index 443d28bac3..71561ab0bd 100644 --- a/libsyclinterface/source/dpctl_sycl_usm_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_usm_interface.cpp @@ -25,6 +25,7 @@ //===----------------------------------------------------------------------===// #include "dpctl_sycl_usm_interface.h" +#include "Config/dpctl_config.h" #include "dpctl_error_handlers.h" #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_type_casters.hpp" @@ -34,6 +35,9 @@ using namespace sycl; namespace { +static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED, + "The compiler does not meet minimum version requirement"); + using namespace dpctl::syclinterface; } // end of anonymous namespace From b4fa9c50a3f3624ebd09160e4849431e66b6472a Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 15:05:09 -0600 Subject: [PATCH 10/25] Removed no longer needed include --- libsyclinterface/include/dpctl_device_selection.hpp | 1 - libsyclinterface/include/dpctl_sycl_kernel_interface.h | 1 - 2 files changed, 2 deletions(-) diff --git a/libsyclinterface/include/dpctl_device_selection.hpp b/libsyclinterface/include/dpctl_device_selection.hpp index 33a810d354..ddb46f0078 100644 --- a/libsyclinterface/include/dpctl_device_selection.hpp +++ b/libsyclinterface/include/dpctl_device_selection.hpp @@ -26,7 +26,6 @@ #pragma once -#include "Config/dpctl_config.h" #include "Support/DllExport.h" #include diff --git a/libsyclinterface/include/dpctl_sycl_kernel_interface.h b/libsyclinterface/include/dpctl_sycl_kernel_interface.h index c4b3a46e0f..52d1dca5bd 100644 --- a/libsyclinterface/include/dpctl_sycl_kernel_interface.h +++ b/libsyclinterface/include/dpctl_sycl_kernel_interface.h @@ -26,7 +26,6 @@ #pragma once -#include "Config/dpctl_config.h" #include "Support/DllExport.h" #include "Support/ExternC.h" #include "Support/MemOwnershipAttrs.h" From 925908325a6ee59e159f50109a00f06c7bf4c7a5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 15:25:32 -0600 Subject: [PATCH 11/25] Removed obsolete comment --- libsyclinterface/source/dpctl_sycl_kernel_interface.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp index e0c39c0646..8a5af3f179 100644 --- a/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_kernel_interface.cpp @@ -164,8 +164,6 @@ DPCTLKernel_GetMaxNumSubGroups(__dpctl_keep const DPCTLSyclKernelRef KRef) return static_cast(v); } -// commented out due to bug in DPC++ runtime, get_info for max_sub_group_size -// exported by libsycl has different, not SPEC-compliant signature uint32_t DPCTLKernel_GetMaxSubGroupSize(__dpctl_keep const DPCTLSyclKernelRef KRef) { From c73190cd62d810eca5d7d1ddd137bd182b8611f5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 15:34:32 -0600 Subject: [PATCH 12/25] Implemented SyclKernel.max_sub_group_size --- dpctl/_backend.pxd | 3 +-- dpctl/program/_program.pyx | 5 +++-- dpctl/tests/test_sycl_program.py | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dpctl/_backend.pxd b/dpctl/_backend.pxd index b0c60078c4..547e4c60e6 100644 --- a/dpctl/_backend.pxd +++ b/dpctl/_backend.pxd @@ -271,8 +271,7 @@ cdef extern from "syclinterface/dpctl_sycl_kernel_interface.h": cdef size_t DPCTLKernel_GetPreferredWorkGroupSizeMultiple(const DPCTLSyclKernelRef KRef) cdef size_t DPCTLKernel_GetPrivateMemSize(const DPCTLSyclKernelRef KRef) cdef uint32_t DPCTLKernel_GetMaxNumSubGroups(const DPCTLSyclKernelRef KRef) -## Next line is commented out due to issue in DPC++ runtime -# cdef uint32_t DPCTLKernel_GetMaxSubGroupSize(const DPCTLSyclKernelRef KRef) + cdef uint32_t DPCTLKernel_GetMaxSubGroupSize(const DPCTLSyclKernelRef KRef) cdef uint32_t DPCTLKernel_GetCompileNumSubGroups(const DPCTLSyclKernelRef KRef) cdef uint32_t DPCTLKernel_GetCompileSubGroupSize(const DPCTLSyclKernelRef KRef) diff --git a/dpctl/program/_program.pyx b/dpctl/program/_program.pyx index da98f53047..a22b220ae1 100644 --- a/dpctl/program/_program.pyx +++ b/dpctl/program/_program.pyx @@ -34,6 +34,7 @@ from dpctl._backend cimport ( # noqa: E211, E402; DPCTLKernel_GetCompileNumSubGroups, DPCTLKernel_GetCompileSubGroupSize, DPCTLKernel_GetMaxNumSubGroups, + DPCTLKernel_GetMaxSubGroupSize, DPCTLKernel_GetNumArgs, DPCTLKernel_GetPreferredWorkGroupSizeMultiple, DPCTLKernel_GetPrivateMemSize, @@ -146,8 +147,8 @@ cdef class SyclKernel: def max_sub_group_size(self): """ Returns the maximum sub-groups size for this kernel. """ - cdef uint32_t sz = 0 - return NotImplemented + cdef uint32_t sz = DPCTLKernel_GetMaxSubGroupSize(self._kernel_ref) + return sz @property def compile_num_sub_groups(self): diff --git a/dpctl/tests/test_sycl_program.py b/dpctl/tests/test_sycl_program.py index 1cbd9114e4..1f08501815 100644 --- a/dpctl/tests/test_sycl_program.py +++ b/dpctl/tests/test_sycl_program.py @@ -180,9 +180,7 @@ def _check_multi_kernel_program(prog): vmnsg = krn.max_num_sub_groups assert type(vmnsg) is int v = krn.max_sub_group_size - assert ( - v == NotImplemented - ), "SyclKernel.max_sub_group_size acquired implementation, fix the test" + assert type(v) is int cmnsg = krn.compile_num_sub_groups assert type(cmnsg) is int cmsgsz = krn.compile_sub_group_size From 72622e035bcfac12348964d6f40bc7936fa65b1d Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 15:34:49 -0600 Subject: [PATCH 13/25] Modified test_async_submit to check status right away Moved host operations done after kernel submission to improve chance of detecting non-complete status of kernel submission. --- dpctl/tests/test_sycl_kernel_submit.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dpctl/tests/test_sycl_kernel_submit.py b/dpctl/tests/test_sycl_kernel_submit.py index c97583c8ee..9e0deb482c 100644 --- a/dpctl/tests/test_sycl_kernel_submit.py +++ b/dpctl/tests/test_sycl_kernel_submit.py @@ -156,7 +156,8 @@ def test_async_submit(): assert isinstance(kern2Kernel, dpctl_prog.SyclKernel) assert isinstance(kern2Kernel, dpctl_prog.SyclKernel) - n = 1024 * 1024 + status_complete = dpctl.event_status_type.complete + n = 1024 * 1024 * 4 X = dpt.empty((3, n), dtype="u4", usm_type="device", sycl_queue=q) first_row = dpctl_mem.as_usm_memory(X[0]) second_row = dpctl_mem.as_usm_memory(X[1]) @@ -191,14 +192,16 @@ def test_async_submit(): None, [e1, e2], ) - status_complete = dpctl.event_status_type.complete + e3_st = e3.execution_status + e2_st = e2.execution_status + e1_st = e1.execution_status assert not all( [ e == status_complete for e in ( - e1.execution_status, - e2.execution_status, - e3.execution_status, + e1_st, + e2_st, + e3_st, ) ] ) From cee5afebe709875dbd32bc2b907dffd889f073e8 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 17:45:49 -0600 Subject: [PATCH 14/25] Removed aspect_host, select_host_device, has_host_device Host device has been removed from DPC++ compiler in 2023.0.0 Also removed support for host device type and for backend host. --- dpctl/__init__.py | 2 -- dpctl/_backend.pxd | 3 -- dpctl/_sycl_device.pyx | 19 ---------- dpctl/_sycl_device_factory.pxd | 2 -- dpctl/_sycl_device_factory.pyx | 44 ------------------------ dpctl/_sycl_event.pyx | 2 -- dpctl/_sycl_platform.pyx | 2 -- dpctl/_sycl_queue.pyx | 2 -- dpctl/enum_types.py | 2 -- dpctl/tests/_device_attributes_checks.py | 9 ----- dpctl/tests/test_sycl_device_factory.py | 4 --- 11 files changed, 91 deletions(-) diff --git a/dpctl/__init__.py b/dpctl/__init__.py index bd92b505f3..3784e6006d 100644 --- a/dpctl/__init__.py +++ b/dpctl/__init__.py @@ -48,12 +48,10 @@ has_accelerator_devices, has_cpu_devices, has_gpu_devices, - has_host_device, select_accelerator_device, select_cpu_device, select_default_device, select_gpu_device, - select_host_device, ) from ._sycl_event import SyclEvent from ._sycl_platform import SyclPlatform, get_platforms, lsplatform diff --git a/dpctl/_backend.pxd b/dpctl/_backend.pxd index 547e4c60e6..e6b282509e 100644 --- a/dpctl/_backend.pxd +++ b/dpctl/_backend.pxd @@ -37,7 +37,6 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h": ctypedef enum _backend_type 'DPCTLSyclBackendType': _ALL_BACKENDS 'DPCTL_ALL_BACKENDS' _CUDA 'DPCTL_CUDA' - _HOST 'DPCTL_HOST' _LEVEL_ZERO 'DPCTL_LEVEL_ZERO' _OPENCL 'DPCTL_OPENCL' _UNKNOWN_BACKEND 'DPCTL_UNKNOWN_BACKEND' @@ -49,7 +48,6 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h": _CPU 'DPCTL_CPU' _CUSTOM 'DPCTL_CUSTOM' _GPU 'DPCTL_GPU' - _HOST_DEVICE 'DPCTL_HOST_DEVICE' _UNKNOWN_DEVICE 'DPCTL_UNKNOWN_DEVICE' ctypedef enum _arg_data_type 'DPCTLKernelArgType': @@ -236,7 +234,6 @@ cdef extern from "syclinterface/dpctl_sycl_device_selector_interface.h": DPCTLSyclDeviceSelectorRef DPCTLCPUSelector_Create() DPCTLSyclDeviceSelectorRef DPCTLFilterSelector_Create(const char *) DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create() - DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create() void DPCTLDeviceSelector_Delete(DPCTLSyclDeviceSelectorRef) int DPCTLDeviceSelector_Score(DPCTLSyclDeviceSelectorRef, DPCTLSyclDeviceRef) diff --git a/dpctl/_sycl_device.pyx b/dpctl/_sycl_device.pyx index e139197b18..e98f757d59 100644 --- a/dpctl/_sycl_device.pyx +++ b/dpctl/_sycl_device.pyx @@ -162,8 +162,6 @@ cdef list _get_devices(DPCTLDeviceVectorRef DVRef): cdef str _backend_type_to_filter_string_part(_backend_type BTy): if BTy == _backend_type._CUDA: return "cuda" - elif BTy == _backend_type._HOST: - return "host" elif BTy == _backend_type._LEVEL_ZERO: return "level_zero" elif BTy == _backend_type._OPENCL: @@ -181,8 +179,6 @@ cdef str _device_type_to_filter_string_part(_device_type DTy): return "cpu" elif DTy == _device_type._GPU: return "gpu" - elif DTy == _device_type._HOST_DEVICE: - return "host" else: return "unknown" @@ -222,7 +218,6 @@ cdef class SyclDevice(_SyclDevice): :func:`dpctl.select_cpu_device()`, :func:`dpctl.select_default_device()`, :func:`dpctl.select_gpu_device()`, - :func:`dpctl.select_host_device()`. :Example: @@ -359,8 +354,6 @@ cdef class SyclDevice(_SyclDevice): ) if BTy == _backend_type._CUDA: return backend_type.cuda - elif BTy == _backend_type._HOST: - return backend_type.host elif BTy == _backend_type._LEVEL_ZERO: return backend_type.level_zero elif BTy == _backend_type._OPENCL: @@ -388,21 +381,9 @@ cdef class SyclDevice(_SyclDevice): return device_type.cpu elif DTy == _device_type._GPU: return device_type.gpu - elif DTy == _device_type._HOST_DEVICE: - return device_type.host else: raise ValueError("Unknown device type.") - @property - def has_aspect_host(self): - """ Returns True if this device is a host device, False otherwise. - - Returns: - bool: Indicates if the device is a host device. - """ - cdef _aspect_type AT = _aspect_type._host - return DPCTLDevice_HasAspect(self._device_ref, AT) - @property def has_aspect_cpu(self): """ Returns True if this device is a CPU device, False otherwise. diff --git a/dpctl/_sycl_device_factory.pxd b/dpctl/_sycl_device_factory.pxd index 8287833c67..fc36017c6e 100644 --- a/dpctl/_sycl_device_factory.pxd +++ b/dpctl/_sycl_device_factory.pxd @@ -31,10 +31,8 @@ cpdef SyclDevice select_accelerator_device() cpdef SyclDevice select_cpu_device() cpdef SyclDevice select_default_device() cpdef SyclDevice select_gpu_device() -cpdef SyclDevice select_host_device() cpdef list get_devices(backend=*, device_type=*) cpdef int get_num_devices(backend=*, device_type=*) cpdef cpp_bool has_gpu_devices() cpdef cpp_bool has_cpu_devices() cpdef cpp_bool has_accelerator_devices() -cpdef cpp_bool has_host_device() diff --git a/dpctl/_sycl_device_factory.pyx b/dpctl/_sycl_device_factory.pyx index fb848f902f..99aadb5f2b 100644 --- a/dpctl/_sycl_device_factory.pyx +++ b/dpctl/_sycl_device_factory.pyx @@ -39,7 +39,6 @@ from ._backend cimport ( # noqa: E211 DPCTLDeviceVector_Size, DPCTLDeviceVectorRef, DPCTLGPUSelector_Create, - DPCTLHostSelector_Create, DPCTLSyclDeviceRef, DPCTLSyclDeviceSelectorRef, _backend_type, @@ -56,12 +55,10 @@ __all__ = [ "select_cpu_device", "select_default_device", "select_gpu_device", - "select_host_device", "get_num_devices", "has_cpu_devices", "has_gpu_devices", "has_accelerator_devices", - "has_host_device", ] @@ -71,8 +68,6 @@ cdef _backend_type _string_to_dpctl_sycl_backend_ty(str backend_str): return _backend_type._ALL_BACKENDS elif backend_str == "cuda": return _backend_type._CUDA - elif backend_str == "host": - return _backend_type._HOST elif backend_str == "level_zero": return _backend_type._LEVEL_ZERO elif backend_str == "opencl": @@ -95,8 +90,6 @@ cdef _device_type _string_to_dpctl_sycl_device_ty(str dty_str): return _device_type._CUSTOM elif dty_str == "gpu": return _device_type._GPU - elif dty_str == "host": - return _device_type._HOST_DEVICE else: return _device_type._UNKNOWN_DEVICE @@ -106,8 +99,6 @@ cdef _backend_type _enum_to_dpctl_sycl_backend_ty(BTy): return _backend_type._ALL_BACKENDS elif BTy == backend_type.cuda: return _backend_type._CUDA - elif BTy == backend_type.host: - return _backend_type._HOST elif BTy == backend_type.level_zero: return _backend_type._LEVEL_ZERO elif BTy == backend_type.opencl: @@ -129,8 +120,6 @@ cdef _device_type _enum_to_dpctl_sycl_device_ty(DTy): return _device_type._CUSTOM elif DTy == device_type_t.gpu: return _device_type._GPU - elif DTy == device_type_t.host: - return _device_type._HOST_DEVICE else: return _device_type._UNKNOWN_DEVICE @@ -288,19 +277,6 @@ cpdef cpp_bool has_accelerator_devices(): return num_accelerator_dev -cpdef cpp_bool has_host_device(): - """ A helper function to check if there are any SYCL Host devices available. - - Returns: - bool: ``True`` if ``sycl::device_type::host`` devices are present, - ``False`` otherwise. - """ - cdef int num_host_dev = DPCTLDeviceMgr_GetNumDevices( - _device_type._HOST_DEVICE - ) - return num_host_dev - - cpdef SyclDevice select_accelerator_device(): """ A wrapper for SYCL's ``accelerator_selector`` class. @@ -379,23 +355,3 @@ cpdef SyclDevice select_gpu_device(): raise SyclDeviceCreationError("Device unavailable.") Device = SyclDevice._create(DRef) return Device - - -cpdef SyclDevice select_host_device(): - """ A wrapper for SYCL's ``host_selector`` class. - - Returns: - dpctl.SyclDevice: A Python object wrapping the SYCL ``device`` - returned by the SYCL ``host_selector``. - Raises: - dpctl.SyclDeviceCreationError: If the SYCL ``host_selector`` is - unable to select a ``device``. - """ - cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLHostSelector_Create() - cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef) - # Free up the device selector - DPCTLDeviceSelector_Delete(DSRef) - if DRef is NULL: - raise SyclDeviceCreationError("Host device is unavailable.") - Device = SyclDevice._create(DRef) - return Device diff --git a/dpctl/_sycl_event.pyx b/dpctl/_sycl_event.pyx index 5baecb5b58..a1395f3434 100644 --- a/dpctl/_sycl_event.pyx +++ b/dpctl/_sycl_event.pyx @@ -302,8 +302,6 @@ cdef class SyclEvent(_SyclEvent): return backend_type.opencl elif BE == _backend_type._LEVEL_ZERO: return backend_type.level_zero - elif BE == _backend_type._HOST: - return backend_type.host elif BE == _backend_type._CUDA: return backend_type.cuda else: diff --git a/dpctl/_sycl_platform.pyx b/dpctl/_sycl_platform.pyx index 9356c9f8a7..449ad9029f 100644 --- a/dpctl/_sycl_platform.pyx +++ b/dpctl/_sycl_platform.pyx @@ -251,8 +251,6 @@ cdef class SyclPlatform(_SyclPlatform): ) if BTy == _backend_type._CUDA: return backend_type.cuda - elif BTy == _backend_type._HOST: - return backend_type.host elif BTy == _backend_type._LEVEL_ZERO: return backend_type.level_zero elif BTy == _backend_type._OPENCL: diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index 6a686f93fd..6c6f3bf1d8 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -676,8 +676,6 @@ cdef class SyclQueue(_SyclQueue): return backend_type.opencl elif BE == _backend_type._LEVEL_ZERO: return backend_type.level_zero - elif BE == _backend_type._HOST: - return backend_type.host elif BE == _backend_type._CUDA: return backend_type.cuda else: diff --git a/dpctl/enum_types.py b/dpctl/enum_types.py index 6301e778fb..4f80f3e506 100644 --- a/dpctl/enum_types.py +++ b/dpctl/enum_types.py @@ -54,7 +54,6 @@ class device_type(Enum): cpu = auto() custom = auto() gpu = auto() - host = auto() class backend_type(Enum): @@ -74,7 +73,6 @@ class backend_type(Enum): all = auto() cuda = auto() - host = auto() level_zero = auto() opencl = auto() diff --git a/dpctl/tests/_device_attributes_checks.py b/dpctl/tests/_device_attributes_checks.py index 0d66b7c657..9e693384d6 100644 --- a/dpctl/tests/_device_attributes_checks.py +++ b/dpctl/tests/_device_attributes_checks.py @@ -23,7 +23,6 @@ dpctl.select_cpu_device, dpctl.select_default_device, dpctl.select_gpu_device, - dpctl.select_host_device, ] list_of_valid_filter_selectors = [ @@ -120,13 +119,6 @@ def check_sub_group_sizes(device): assert all(el > 0 for el in sg_sizes) -def check_has_aspect_host(device): - try: - device.has_aspect_host - except Exception: - pytest.fail("has_aspect_host call failed") - - def check_has_aspect_cpu(device): try: device.has_aspect_cpu @@ -634,7 +626,6 @@ def check_global_mem_cache_line_size(device): check_preferred_vector_width_float, check_preferred_vector_width_double, check_preferred_vector_width_half, - check_has_aspect_host, check_has_aspect_cpu, check_has_aspect_gpu, check_has_aspect_accelerator, diff --git a/dpctl/tests/test_sycl_device_factory.py b/dpctl/tests/test_sycl_device_factory.py index 404b205c0a..8e6e61b343 100644 --- a/dpctl/tests/test_sycl_device_factory.py +++ b/dpctl/tests/test_sycl_device_factory.py @@ -27,24 +27,20 @@ (bty.level_zero, dty.gpu), (bty.opencl, dty.gpu), (bty.opencl, dty.cpu), - (bty.host, dty.host), ] argument_list_2 = [ - ("host", "host"), ("level_zero", "gpu"), ("opencl", "gpu"), ("opencl", "cpu"), ] list_of_backend_str = [ - "host", "level_zero", "opencl", ] list_of_device_type_str = [ - "host", "gpu", "cpu", ] From ad85e04a4a6156c1f860d902164caa5650293b32 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 23 Dec 2022 17:46:43 -0600 Subject: [PATCH 15/25] Removed DPCTL_HOST and DPCTL_HOST_DEVICE --- libsyclinterface/helper/source/dpctl_utils_helper.cpp | 4 ---- libsyclinterface/include/dpctl_sycl_enum_types.h | 6 ++---- libsyclinterface/tests/test_sycl_device_interface.cpp | 2 -- libsyclinterface/tests/test_sycl_event_interface.cpp | 2 -- libsyclinterface/tests/test_sycl_platform_interface.cpp | 2 -- 5 files changed, 2 insertions(+), 14 deletions(-) diff --git a/libsyclinterface/helper/source/dpctl_utils_helper.cpp b/libsyclinterface/helper/source/dpctl_utils_helper.cpp index 4484e48d02..07fe6da05e 100644 --- a/libsyclinterface/helper/source/dpctl_utils_helper.cpp +++ b/libsyclinterface/helper/source/dpctl_utils_helper.cpp @@ -128,8 +128,6 @@ info::device_type DPCTL_DPCTLDeviceTypeToSyclDeviceType(DPCTLSyclDeviceType DTy) return info::device_type::custom; case DPCTLSyclDeviceType::DPCTL_GPU: return info::device_type::gpu; - case DPCTLSyclDeviceType::DPCTL_HOST_DEVICE: - return info::device_type::host; default: throw std::runtime_error("Unsupported device type"); } @@ -150,8 +148,6 @@ DPCTLSyclDeviceType DPCTL_SyclDeviceTypeToDPCTLDeviceType(info::device_type D) return DPCTLSyclDeviceType::DPCTL_CUSTOM; case info::device_type::gpu: return DPCTLSyclDeviceType::DPCTL_GPU; - case info::device_type::host: - return DPCTLSyclDeviceType::DPCTL_HOST_DEVICE; default: return DPCTLSyclDeviceType::DPCTL_UNKNOWN_DEVICE; } diff --git a/libsyclinterface/include/dpctl_sycl_enum_types.h b/libsyclinterface/include/dpctl_sycl_enum_types.h index 1d5292bb90..fcf253d89b 100644 --- a/libsyclinterface/include/dpctl_sycl_enum_types.h +++ b/libsyclinterface/include/dpctl_sycl_enum_types.h @@ -39,9 +39,8 @@ typedef enum { // clang-format off DPCTL_CUDA = 1 << 16, - DPCTL_HOST = 1 << 17, - DPCTL_LEVEL_ZERO = 1 << 18, - DPCTL_OPENCL = 1 << 19, + DPCTL_LEVEL_ZERO = 1 << 17, + DPCTL_OPENCL = 1 << 18, DPCTL_UNKNOWN_BACKEND = 0, DPCTL_ALL_BACKENDS = ((1<<5)-1) << 16 // clang-format on @@ -62,7 +61,6 @@ typedef enum DPCTL_CPU = 1 << 2, DPCTL_CUSTOM = 1 << 3, DPCTL_GPU = 1 << 4, - DPCTL_HOST_DEVICE = 1 << 5, DPCTL_ALL = (1 << 6) - 1, DPCTL_UNKNOWN_DEVICE = 0 // clang-format on diff --git a/libsyclinterface/tests/test_sycl_device_interface.cpp b/libsyclinterface/tests/test_sycl_device_interface.cpp index 20bc25f3d9..56a5ec9c29 100644 --- a/libsyclinterface/tests/test_sycl_device_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_interface.cpp @@ -81,8 +81,6 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkGetBackend) switch (BTy) { case DPCTLSyclBackendType::DPCTL_CUDA: return true; - case DPCTLSyclBackendType::DPCTL_HOST: - return true; case DPCTLSyclBackendType::DPCTL_LEVEL_ZERO: return true; case DPCTLSyclBackendType::DPCTL_OPENCL: diff --git a/libsyclinterface/tests/test_sycl_event_interface.cpp b/libsyclinterface/tests/test_sycl_event_interface.cpp index 846cdd2cc0..0cc11af731 100644 --- a/libsyclinterface/tests/test_sycl_event_interface.cpp +++ b/libsyclinterface/tests/test_sycl_event_interface.cpp @@ -125,8 +125,6 @@ TEST_F(TestDPCTLSyclEventInterface, CheckEvent_GetBackend) switch (BTy) { case DPCTLSyclBackendType::DPCTL_CUDA: return true; - case DPCTLSyclBackendType::DPCTL_HOST: - return true; case DPCTLSyclBackendType::DPCTL_LEVEL_ZERO: return true; case DPCTLSyclBackendType::DPCTL_OPENCL: diff --git a/libsyclinterface/tests/test_sycl_platform_interface.cpp b/libsyclinterface/tests/test_sycl_platform_interface.cpp index 9fac7ad7c3..e6fb7df134 100644 --- a/libsyclinterface/tests/test_sycl_platform_interface.cpp +++ b/libsyclinterface/tests/test_sycl_platform_interface.cpp @@ -70,8 +70,6 @@ void check_platform_backend(__dpctl_keep const DPCTLSyclPlatformRef PRef) switch (BTy) { case DPCTLSyclBackendType::DPCTL_CUDA: return true; - case DPCTLSyclBackendType::DPCTL_HOST: - return true; case DPCTLSyclBackendType::DPCTL_LEVEL_ZERO: return true; case DPCTLSyclBackendType::DPCTL_OPENCL: From 97551b69604ff1fb5576c2f58d2fbf3bc326df54 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 06:05:38 -0600 Subject: [PATCH 16/25] Removed host-related functions/methods Removed `DPCTLDevice_IsHost`, `DPCTLHostSelector_Create`, `DPCTLContext_IsHost` and use of is_host from Python API. --- dpctl/_backend.pxd | 1 - dpctl/_sycl_device.pyx | 18 +++------------ dpctl/tests/_device_attributes_checks.py | 12 ++-------- dpctl/tests/test_tensor_asarray.py | 5 ----- .../include/dpctl_sycl_context_interface.h | 10 --------- .../include/dpctl_sycl_device_interface.h | 10 --------- .../dpctl_sycl_device_selector_interface.h | 9 -------- .../source/dpctl_sycl_context_interface.cpp | 9 -------- .../source/dpctl_sycl_device_interface.cpp | 9 -------- .../dpctl_sycl_device_selector_interface.cpp | 11 ---------- .../tests/test_sycl_context_interface.cpp | 22 ------------------- .../tests/test_sycl_device_interface.cpp | 12 ---------- .../test_sycl_device_selector_interface.cpp | 21 ------------------ 13 files changed, 5 insertions(+), 144 deletions(-) diff --git a/dpctl/_backend.pxd b/dpctl/_backend.pxd index e6b282509e..42406d8b9d 100644 --- a/dpctl/_backend.pxd +++ b/dpctl/_backend.pxd @@ -172,7 +172,6 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h": cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef) - cdef bool DPCTLDevice_IsHost(const DPCTLSyclDeviceRef DRef) cdef bool DPCTLDevice_GetSubGroupIndependentForwardProgress(const DPCTLSyclDeviceRef DRef) cdef uint32_t DPCTLDevice_GetPreferredVectorWidthChar(const DPCTLSyclDeviceRef DRef) cdef uint32_t DPCTLDevice_GetPreferredVectorWidthShort(const DPCTLSyclDeviceRef DRef) diff --git a/dpctl/_sycl_device.pyx b/dpctl/_sycl_device.pyx index e98f757d59..76d9e99acc 100644 --- a/dpctl/_sycl_device.pyx +++ b/dpctl/_sycl_device.pyx @@ -73,7 +73,6 @@ from ._backend cimport ( # noqa: E211 DPCTLDevice_IsAccelerator, DPCTLDevice_IsCPU, DPCTLDevice_IsGPU, - DPCTLDevice_IsHost, DPCTLDeviceMgr_GetDeviceInfoStr, DPCTLDeviceMgr_GetDevices, DPCTLDeviceMgr_GetPositionInDevices, @@ -710,15 +709,6 @@ cdef class SyclDevice(_SyclDevice): """ return DPCTLDevice_IsGPU(self._device_ref) - @property - def is_host(self): - """ Returns True if the SyclDevice instance is a SYCL host device. - - Returns: - bool: True if the SyclDevice is a SYCL host device, else False. - """ - return DPCTLDevice_IsHost(self._device_ref) - @property def max_work_item_dims(self): """ Returns the maximum dimensions that specify the global and local @@ -847,11 +837,9 @@ cdef class SyclDevice(_SyclDevice): int: The maximum number of sub-groups support per work-group by the device. """ - cdef uint32_t max_num_sub_groups = 0 - if (not self.is_host): - max_num_sub_groups = ( - DPCTLDevice_GetMaxNumSubGroups(self._device_ref) - ) + cdef uint32_t max_num_sub_groups = ( + DPCTLDevice_GetMaxNumSubGroups(self._device_ref) + ) return max_num_sub_groups @property diff --git a/dpctl/tests/_device_attributes_checks.py b/dpctl/tests/_device_attributes_checks.py index 9e693384d6..49666dfce6 100644 --- a/dpctl/tests/_device_attributes_checks.py +++ b/dpctl/tests/_device_attributes_checks.py @@ -108,7 +108,7 @@ def check_max_work_group_size(device): def check_max_num_sub_groups(device): max_num_sub_groups = device.max_num_sub_groups # Special case for FPGA simulator - if device.is_accelerator or device.is_host: + if device.is_accelerator: assert max_num_sub_groups >= 0 else: assert max_num_sub_groups > 0 @@ -273,13 +273,6 @@ def check_is_gpu(device): pytest.fail("is_gpu call failed") -def check_is_host(device): - try: - device.is_host - except Exception: - pytest.fail("is_hostcall failed") - - def check_max_read_image_args(device): try: device.max_read_image_args @@ -563,7 +556,7 @@ def check_driver_version(device): def check_vendor(device): ve = device.vendor - assert ve or device.is_host + assert ve assert type(ve) is str @@ -617,7 +610,6 @@ def check_global_mem_cache_line_size(device): check_is_accelerator, check_is_cpu, check_is_gpu, - check_is_host, check_sub_group_independent_forward_progress, check_preferred_vector_width_char, check_preferred_vector_width_short, diff --git a/dpctl/tests/test_tensor_asarray.py b/dpctl/tests/test_tensor_asarray.py index e2a6f512d2..a309b4e3a4 100644 --- a/dpctl/tests/test_tensor_asarray.py +++ b/dpctl/tests/test_tensor_asarray.py @@ -35,11 +35,6 @@ ) def test_asarray_change_usm_type(src_usm_type, dst_usm_type): d = dpctl.SyclDevice() - if d.is_host: - pytest.skip( - "Skip test of host device, which only " - "supports host USM allocations" - ) X = dpt.empty(10, dtype="u1", usm_type=src_usm_type) Y = dpt.asarray(X, usm_type=dst_usm_type) assert X.shape == Y.shape diff --git a/libsyclinterface/include/dpctl_sycl_context_interface.h b/libsyclinterface/include/dpctl_sycl_context_interface.h index 6578ffbaa7..6ca3c92d05 100644 --- a/libsyclinterface/include/dpctl_sycl_context_interface.h +++ b/libsyclinterface/include/dpctl_sycl_context_interface.h @@ -130,16 +130,6 @@ DPCTL_API __dpctl_give DPCTLDeviceVectorRef DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef); -/*! - * @brief Returns true if this SYCL context is a host context. - * - * @param CtxRef An opaque pointer to a sycl::context. - * @return True if the SYCL context is a host context, else False. - * @ingroup ContextInterface - */ -DPCTL_API -bool DPCTLContext_IsHost(__dpctl_keep const DPCTLSyclContextRef CtxRef); - /*! * @brief Returns the sycl backend for the DPCTLSyclContextRef pointer. * diff --git a/libsyclinterface/include/dpctl_sycl_device_interface.h b/libsyclinterface/include/dpctl_sycl_device_interface.h index 15b6791ffc..bcce8cc592 100644 --- a/libsyclinterface/include/dpctl_sycl_device_interface.h +++ b/libsyclinterface/include/dpctl_sycl_device_interface.h @@ -120,16 +120,6 @@ bool DPCTLDevice_IsCPU(__dpctl_keep const DPCTLSyclDeviceRef DRef); DPCTL_API bool DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef); -/*! - * @brief Returns true if this SYCL device is a host device. - * - * @param DRef Opaque pointer to a ``sycl::device`` - * @return True if the device is a host device, else False. - * @ingroup DeviceInterface - */ -DPCTL_API -bool DPCTLDevice_IsHost(__dpctl_keep const DPCTLSyclDeviceRef DRef); - /*! * @brief Returns the backend for the device. * diff --git a/libsyclinterface/include/dpctl_sycl_device_selector_interface.h b/libsyclinterface/include/dpctl_sycl_device_selector_interface.h index 04813b1cc6..c1cd5fcd5c 100644 --- a/libsyclinterface/include/dpctl_sycl_device_selector_interface.h +++ b/libsyclinterface/include/dpctl_sycl_device_selector_interface.h @@ -86,15 +86,6 @@ DPCTLFilterSelector_Create(__dpctl_keep const char *filter_str); DPCTL_API __dpctl_give DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create(void); -/*! - * @brief Returns an opaque wrapper for dpctl_host_selector object. - * - * @return An opaque pointer to a dpctl_host_selector object. - * @ingroup DeviceSelectors - */ -DPCTL_API -__dpctl_give DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create(void); - /*! * @brief Deletes the DPCTLSyclDeviceSelectorRef after casting it to a * sycl::device_selector. diff --git a/libsyclinterface/source/dpctl_sycl_context_interface.cpp b/libsyclinterface/source/dpctl_sycl_context_interface.cpp index 65ffa22b73..d93ca4e992 100644 --- a/libsyclinterface/source/dpctl_sycl_context_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_context_interface.cpp @@ -169,15 +169,6 @@ size_t DPCTLContext_DeviceCount(__dpctl_keep const DPCTLSyclContextRef CRef) return Devices.size(); } -bool DPCTLContext_IsHost(__dpctl_keep const DPCTLSyclContextRef CtxRef) -{ - auto Ctx = unwrap(CtxRef); - if (Ctx) { - return false; - } - return false; -} - void DPCTLContext_Delete(__dpctl_take DPCTLSyclContextRef CtxRef) { delete unwrap(CtxRef); diff --git a/libsyclinterface/source/dpctl_sycl_device_interface.cpp b/libsyclinterface/source/dpctl_sycl_device_interface.cpp index 21f2e474f2..02e4239a3f 100644 --- a/libsyclinterface/source/dpctl_sycl_device_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_interface.cpp @@ -176,15 +176,6 @@ bool DPCTLDevice_IsGPU(__dpctl_keep const DPCTLSyclDeviceRef DRef) return false; } -bool DPCTLDevice_IsHost(__dpctl_keep const DPCTLSyclDeviceRef DRef) -{ - auto D = unwrap(DRef); - if (D) { - return false; - } - return false; -} - DPCTLSyclBackendType DPCTLDevice_GetBackend(__dpctl_keep const DPCTLSyclDeviceRef DRef) { diff --git a/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp b/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp index 09561278bc..9753c32613 100644 --- a/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_device_selector_interface.cpp @@ -97,17 +97,6 @@ __dpctl_give DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create() } } -__dpctl_give DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create() -{ - try { - auto Selector = new dpctl_host_selector(); - return wrap(Selector); - } catch (std::exception const &e) { - error_handler(e, __FILE__, __func__, __LINE__); - return nullptr; - } -} - int DPCTLDeviceSelector_Score(__dpctl_keep DPCTLSyclDeviceSelectorRef DSRef, __dpctl_keep DPCTLSyclDeviceRef DRef) { diff --git a/libsyclinterface/tests/test_sycl_context_interface.cpp b/libsyclinterface/tests/test_sycl_context_interface.cpp index f20591e134..36b2ff6e97 100644 --- a/libsyclinterface/tests/test_sycl_context_interface.cpp +++ b/libsyclinterface/tests/test_sycl_context_interface.cpp @@ -162,21 +162,6 @@ TEST_P(TestDPCTLContextInterface, ChkAreEq) EXPECT_NO_FATAL_FAILURE(DPCTLContext_Delete(CRef3)); } -TEST_P(TestDPCTLContextInterface, ChkIsHost) -{ - DPCTLSyclContextRef CRef = nullptr; - bool is_host_device = false, is_host_context = false; - - EXPECT_NO_FATAL_FAILURE(CRef = DPCTLContext_Create(DRef, nullptr, 0)); - ASSERT_TRUE(CRef); - - EXPECT_NO_FATAL_FAILURE(is_host_device = DPCTLDevice_IsHost(DRef)); - EXPECT_NO_FATAL_FAILURE(is_host_context = DPCTLContext_IsHost(CRef)); - EXPECT_TRUE(is_host_device == is_host_context); - - EXPECT_NO_FATAL_FAILURE(DPCTLContext_Delete(CRef)); -} - TEST_P(TestDPCTLContextInterface, ChkGetBackend) { DPCTLSyclContextRef CRef = nullptr; @@ -262,13 +247,6 @@ TEST_F(TestDPCTLContextNullArgs, ChkDeviceCount) ASSERT_TRUE(count == 0); } -TEST_F(TestDPCTLContextNullArgs, ChkIsHost) -{ - bool is_host = true; - EXPECT_NO_FATAL_FAILURE(is_host = DPCTLContext_IsHost(Null_CRef)); - ASSERT_FALSE(is_host); -} - TEST_F(TestDPCTLContextNullArgs, ChkHash) { size_t hash = 0; diff --git a/libsyclinterface/tests/test_sycl_device_interface.cpp b/libsyclinterface/tests/test_sycl_device_interface.cpp index 56a5ec9c29..7d202044d1 100644 --- a/libsyclinterface/tests/test_sycl_device_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_interface.cpp @@ -242,11 +242,6 @@ TEST_P(TestDPCTLSyclDeviceInterface, ChkIsGPU) EXPECT_NO_FATAL_FAILURE(DPCTLDevice_IsGPU(DRef)); } -TEST_P(TestDPCTLSyclDeviceInterface, ChkIsHost) -{ - EXPECT_NO_FATAL_FAILURE(DPCTLDevice_IsHost(DRef)); -} - TEST_P(TestDPCTLSyclDeviceInterface, ChkGetSubGroupIndependentForwardProgress) { bool sub_group_progress = 0; @@ -528,13 +523,6 @@ TEST_F(TestDPCTLSyclDeviceNullArgs, ChkIsGPU) ASSERT_FALSE(is_gpu); } -TEST_F(TestDPCTLSyclDeviceNullArgs, ChkIsHost) -{ - bool is_host = true; - EXPECT_NO_FATAL_FAILURE(is_host = DPCTLDevice_IsHost(Null_DRef)); - ASSERT_FALSE(is_host); -} - TEST_F(TestDPCTLSyclDeviceNullArgs, ChkGetMaxComputeUnits) { uint32_t mcu = -1; diff --git a/libsyclinterface/tests/test_sycl_device_selector_interface.cpp b/libsyclinterface/tests/test_sycl_device_selector_interface.cpp index 487014e3d1..eff7e4ee41 100644 --- a/libsyclinterface/tests/test_sycl_device_selector_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_selector_interface.cpp @@ -159,27 +159,6 @@ TEST_F(TestDeviceSelectorInterface, ChkDPCTLGPUSelectorCreate) EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef)); } -TEST_F(TestDeviceSelectorInterface, ChkDPCTLHostSelectorCreate) -{ - DPCTLSyclDeviceSelectorRef DSRef = nullptr; - DPCTLSyclDeviceRef DRef = nullptr; - - EXPECT_NO_FATAL_FAILURE(DSRef = DPCTLHostSelector_Create()); - EXPECT_NO_FATAL_FAILURE(DRef = DPCTLDevice_CreateFromSelector(DSRef)); - - if (!DRef) { - EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef)); - EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef)); - GTEST_SKIP_("Device not found. Skip tests."); - } - - EXPECT_NO_FATAL_FAILURE(DPCTLDeviceMgr_PrintDeviceInfo(DRef)); - // FIXME: DPCPP's host_selector returns a CPU device for some reason. - // EXPECT_TRUE(DPCTLDevice_IsHost(DRef)); - EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef)); - EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef)); -} - TEST_P(TestFilterSelector, ChkDPCTLFilterSelectorCreate) { ASSERT_TRUE(DRef != nullptr); From 9aa909f819a4642c1b64ef61e38f90a72a962401 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 06:11:13 -0600 Subject: [PATCH 17/25] Added item about removal of Python API functions to ChangeLog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba418bce4b..49ccf3d9d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* Removed `dpctl.select_host_device`, `dpctl.has_host_device`, `dpctl.SyclDevice.is_host`, and `dpctl.SyclDevice.has_aspect_host` since support for host device has been removed in DPC++ 2023 and from SYCL 2020 spec [#1208](https://github.com/IntelPython/dpctl/pull/1028). + ### Fixed From d6ed339fcaa72d0ca4d7763f625d5ba3d9f9543a Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 06:24:51 -0600 Subject: [PATCH 18/25] Removed select_host_device instance devices from dpctl_device_selector --- libsyclinterface/include/dpctl_device_selection.hpp | 7 ------- libsyclinterface/source/dpctl_device_selection.cpp | 5 ----- 2 files changed, 12 deletions(-) diff --git a/libsyclinterface/include/dpctl_device_selection.hpp b/libsyclinterface/include/dpctl_device_selection.hpp index ddb46f0078..6aa4e69ec7 100644 --- a/libsyclinterface/include/dpctl_device_selection.hpp +++ b/libsyclinterface/include/dpctl_device_selection.hpp @@ -80,12 +80,5 @@ class DPCTL_API dpctl_filter_selector : public dpctl_device_selector sycl::ext::oneapi::filter_selector _impl; }; -class DPCTL_API dpctl_host_selector : public dpctl_device_selector -{ -public: - dpctl_host_selector() = default; - int operator()(const sycl::device &) const override; -}; - } // namespace syclinterface } // namespace dpctl diff --git a/libsyclinterface/source/dpctl_device_selection.cpp b/libsyclinterface/source/dpctl_device_selection.cpp index f1afab21a6..7203bc3b1a 100644 --- a/libsyclinterface/source/dpctl_device_selection.cpp +++ b/libsyclinterface/source/dpctl_device_selection.cpp @@ -71,10 +71,5 @@ int dpctl_filter_selector::operator()(const sycl::device &d) const return _impl(d); } -int dpctl_host_selector::operator()(const sycl::device &) const -{ - return REJECT_DEVICE; -} - } // namespace syclinterface } // namespace dpctl From 8676efead7d9c9350d48e9ffb8e058ba2999ec37 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 06:34:18 -0600 Subject: [PATCH 19/25] Documented addition of dpctl.program.SyclKernel.max_sub_group_size property --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49ccf3d9d9..cdb9460cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Added `dpctl.program.SyclKernel.max_sub_group_size` property [#1208](https://github.com/IntelPython/dpctl/pull/1028). + ### Changed * Removed `dpctl.select_host_device`, `dpctl.has_host_device`, `dpctl.SyclDevice.is_host`, and `dpctl.SyclDevice.has_aspect_host` since support for host device has been removed in DPC++ 2023 and from SYCL 2020 spec [#1208](https://github.com/IntelPython/dpctl/pull/1028). From 03de8fe9348120424f7c520cd16a5b712599b494 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 06:59:40 -0600 Subject: [PATCH 20/25] Used Release build type in generate documentation workflow, it is way faster --- .github/workflows/generate-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index bf52935f89..434077f1cc 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -63,7 +63,7 @@ jobs: source /opt/intel/oneapi/setvars.sh wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz tar xf doxyrest-2.1.2-linux-amd64.tar.xz - python setup.py develop -G Ninja --build-type=Debug \ + python setup.py develop -G Ninja --build-type=Release \ -- \ -DCMAKE_C_COMPILER:PATH=$(which icx) \ -DCMAKE_CXX_COMPILER:PATH=$(which icpx) \ From 8ca2dd5e0dd95335274b312256334d4c62db7d6e Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 16:00:50 -0600 Subject: [PATCH 21/25] Use -g1 for debug build to reduce size of SO with offloaded sections --- dpctl/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dpctl/CMakeLists.txt b/dpctl/CMakeLists.txt index 2a4e829a83..596eb55651 100644 --- a/dpctl/CMakeLists.txt +++ b/dpctl/CMakeLists.txt @@ -18,10 +18,10 @@ if(WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox ${WARNING_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox ${WARNING_FLAGS}") set(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -ggdb3 -DDEBUG" + "${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -g1 -DDEBUG" ) set(CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -ggdb3 -DDEBUG" + "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -g1 -DDEBUG" ) set(DPCTL_LDFLAGS "/link /NXCompat /DynamicBase") elseif(UNIX) @@ -57,10 +57,10 @@ elseif(UNIX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 ${CXXFLAGS}") set(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -ggdb3 -DDEBUG" + "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -g1 -DDEBUG" ) set(CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -ggdb3 -DDEBUG" + "${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -g1 -DDEBUG" ) set(DPCTL_LDFLAGS "-z,noexecstack,-z,relro,-z,now") else() From 4b0f484c4b8ae0f521622ba579c99cc611a02f4f Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 24 Dec 2022 16:01:20 -0600 Subject: [PATCH 22/25] adjust --ignore-filename-regex to reflect changes in DPC++ 2023 --- scripts/gen_coverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py index 60941ce893..de79502673 100644 --- a/scripts/gen_coverage.py +++ b/scripts/gen_coverage.py @@ -140,7 +140,7 @@ def find_objects(): os.path.join(bin_llvm, "llvm-cov"), "export", "-format=lcov", - "-ignore-filename-regex=/tmp/dpctl_*.h*", + "-ignore-filename-regex=*tmp*/dpctl_*.h*", "-instr-profile=" + instr_profile_fn, ] + objects, From cfefca3124752430819b515a4aa2a4c76bc8ea31 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sun, 25 Dec 2022 11:19:27 -0600 Subject: [PATCH 23/25] Corrected -ignore-filename-regex in libsyclinterface/tests/CMakeLists.txt --- libsyclinterface/tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsyclinterface/tests/CMakeLists.txt b/libsyclinterface/tests/CMakeLists.txt index a1d5dd1c77..c4162d5775 100644 --- a/libsyclinterface/tests/CMakeLists.txt +++ b/libsyclinterface/tests/CMakeLists.txt @@ -54,7 +54,7 @@ if(DPCTL_GENERATE_COVERAGE) COMMAND ${LLVMCov_EXE} export -format=lcov - -ignore-filename-regex=/tmp/dpctl_*.h* + -ignore-filename-regex=/tmp*/dpctl_*.h* -instr-profile=dpctl.profdata "${object_arg}$,;${object_arg}>" > dpctl.lcov From 44a8e38ed96c17c1395d3e6378bb2a5529d42670 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sun, 25 Dec 2022 21:40:33 -0600 Subject: [PATCH 24/25] More verbosity to steps of coverall uploads --- .github/workflows/generate-coverage.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-coverage.yaml b/.github/workflows/generate-coverage.yaml index 20a8a44579..6d2f7cc339 100644 --- a/.github/workflows/generate-coverage.yaml +++ b/.github/workflows/generate-coverage.yaml @@ -96,11 +96,17 @@ jobs: - name: Upload coverage data to coveralls.io shell: bash -l {0} run: | + echo "Processing c-api-coverage" + export DPCTL_LCOV_FN=$(find _skbuild -name dpctl.lcov) + grep "/tmp" $DPCTL_LCOV_FN coveralls-lcov -v -n \ - $(find _skbuild -name dpctl.lcov) > dpctl-c-api-coverage.json + $DPCTL_LCOV_FN > dpctl-c-api-coverage.json + echo "Processing pytest-coverage" + export DPCTL_PYTEST_LCOV=$(find . -name dpctl_pytest.lcov) + grep "/tmp" $DPCTL_PYTEST_LCOV coveralls-lcov -v -n \ - $(find . -name dpctl_pytest.lcov) > pytest-dpctl-c-api-coverage.json - # merge json files + $DPCTL_PYTEST_LCOV > pytest-dpctl-c-api-coverage.json + echo "Merging JSON files" python -c "import json; \ fh1 = open('dpctl-c-api-coverage.json', 'r'); \ f1 = json.load(fh1); fh1.close(); \ @@ -113,6 +119,7 @@ jobs: ls -lh dpctl-c-api-coverage.json pytest-dpctl-c-api-coverage.json \ combined-dpctl-c-api-coverage.json \ $(find _skbuild -name dpctl.lcov) $(find . -name dpctl_pytest.lcov) + echo "Merging combined files with coverage data" coveralls --service=github --merge=combined-dpctl-c-api-coverage.json env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3db9c8de563027a0eb9ade43d6eac3e1274e316a Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sun, 25 Dec 2022 21:40:56 -0600 Subject: [PATCH 25/25] Use different exclusion pattern: /tmp/icpx* --- libsyclinterface/tests/CMakeLists.txt | 2 +- scripts/gen_coverage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libsyclinterface/tests/CMakeLists.txt b/libsyclinterface/tests/CMakeLists.txt index c4162d5775..4cfd30338d 100644 --- a/libsyclinterface/tests/CMakeLists.txt +++ b/libsyclinterface/tests/CMakeLists.txt @@ -54,7 +54,7 @@ if(DPCTL_GENERATE_COVERAGE) COMMAND ${LLVMCov_EXE} export -format=lcov - -ignore-filename-regex=/tmp*/dpctl_*.h* + -ignore-filename-regex=/tmp/icpx* -instr-profile=dpctl.profdata "${object_arg}$,;${object_arg}>" > dpctl.lcov diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py index de79502673..41b30d00d9 100644 --- a/scripts/gen_coverage.py +++ b/scripts/gen_coverage.py @@ -140,7 +140,7 @@ def find_objects(): os.path.join(bin_llvm, "llvm-cov"), "export", "-format=lcov", - "-ignore-filename-regex=*tmp*/dpctl_*.h*", + "-ignore-filename-regex=/tmp/icpx*", "-instr-profile=" + instr_profile_fn, ] + objects,