From 153c325f6f0f412302bbd49a466c5c343a823a73 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Mon, 12 Apr 2021 11:14:00 -0500 Subject: [PATCH 1/3] wip win --- conda-recipe/build.sh | 3 +++ dpctl-capi/source/dpctl_sycl_program_interface.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index a3009779bf..13d1831497 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -9,6 +9,9 @@ else exit 1 fi +wget https://github.com/oneapi-src/level-zero/blob/master/include/zet_api.h +mv "$(pwd)/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" + ${PYTHON} setup.py clean --all ${PYTHON} setup.py install diff --git a/dpctl-capi/source/dpctl_sycl_program_interface.cpp b/dpctl-capi/source/dpctl_sycl_program_interface.cpp index bf8dc32bff..7105c48000 100644 --- a/dpctl-capi/source/dpctl_sycl_program_interface.cpp +++ b/dpctl-capi/source/dpctl_sycl_program_interface.cpp @@ -47,6 +47,9 @@ namespace #ifdef __linux__ static const char *zeLoaderName = "libze_loader.so"; static const int libLoadFlags = RTLD_NOLOAD | RTLD_NOW | RTLD_LOCAL; +#elif defined(_WIN64) +static const char *zeLoaderName = "ze_loader.dll"; +static const int libLoadFlags = 0; #else #error "Level Zero program compilation is unavailable for this platform" #endif From 321ad5e0276751da0cb552b905fc73af78f37176 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Wed, 14 Apr 2021 16:35:28 +0300 Subject: [PATCH 2/3] wip level-zero win --- conda-recipe/bld.bat | 3 +++ conda-recipe/build.sh | 6 ++++-- dpctl-capi/CMakeLists.txt | 5 +++++ dpctl-capi/cmake/modules/FindLevelZero.cmake | 10 +++++++++- dpctl/tests/test_sycl_program.py | 8 ++++---- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index e3203d5e13..161137b8ef 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -4,6 +4,9 @@ if errorlevel 1 ( exit /b 1 ) +git clone -b v1.2.3 https://github.com/oneapi-src/level-zero.git +copy "%CD%\\level-zero\\include\\zet_api.h" "%CD%\\dpctl-capi\\include\\zet_api.h" + "%PYTHON%" setup.py clean --all "%PYTHON%" setup.py install if errorlevel 1 exit 1 diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 13d1831497..2ff0bd6ecf 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -9,8 +9,10 @@ else exit 1 fi -wget https://github.com/oneapi-src/level-zero/blob/master/include/zet_api.h -mv "$(pwd)/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" +git clone -b v1.2.3 https://github.com/oneapi-src/level-zero.git +mv "$(pwd)/level-zero/include/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" +# wget https://github.com/oneapi-src/level-zero/blob/master/include/zet_api.h +# mv "$(pwd)/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" ${PYTHON} setup.py clean --all ${PYTHON} setup.py install diff --git a/dpctl-capi/CMakeLists.txt b/dpctl-capi/CMakeLists.txt index 2bb1ef332f..59c77b7ec8 100644 --- a/dpctl-capi/CMakeLists.txt +++ b/dpctl-capi/CMakeLists.txt @@ -99,6 +99,11 @@ if(DPCTL_ENABLE_LO_PROGRAM_CREATION) PRIVATE ${LEVEL_ZERO_INCLUDE_DIR} ) + elseif(WIN32) + target_include_directories(DPCTLSyclInterface + PRIVATE + ${LEVEL_ZERO_INCLUDE_DIR} + ) else() message(WARNING "DPCTL support Level Zero program creation not supported " diff --git a/dpctl-capi/cmake/modules/FindLevelZero.cmake b/dpctl-capi/cmake/modules/FindLevelZero.cmake index 69a626bbed..742ed07845 100644 --- a/dpctl-capi/cmake/modules/FindLevelZero.cmake +++ b/dpctl-capi/cmake/modules/FindLevelZero.cmake @@ -25,8 +25,16 @@ # LEVEL_ZERO_LIBRARY - the full path to the ze_loader library # TODO: Add a way to record the version of the level_zero library +if(WIN32) + set L0_INCLUDE_DIR="%CD%\\level-zero\\include\\zet_api.h" +endif() + find_library(LEVEL_ZERO_LIBRARY ze_loader HINTS $ENV{L0_LIB_DIR}) -find_path(LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/zet_api.h HINTS $ENV{L0_INCLUDE_DIR}) +if(UNIX) + find_path(LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/zet_api.h HINTS $ENV{L0_INCLUDE_DIR}) +elif(WIN32) + find_path(LEVEL_ZERO_INCLUDE_DIR NAMES zet_api.h HINTS $ENV{L0_INCLUDE_DIR}) +endif() find_package_handle_standard_args(LevelZero DEFAULT_MSG LEVEL_ZERO_INCLUDE_DIR diff --git a/dpctl/tests/test_sycl_program.py b/dpctl/tests/test_sycl_program.py index 287dae2756..f6438945f6 100644 --- a/dpctl/tests/test_sycl_program.py +++ b/dpctl/tests/test_sycl_program.py @@ -87,10 +87,10 @@ class TestProgramForLevel0GPU(unittest.TestCase): # Level zero program creation from a SPIR-V binary is not supported # on Windows. - @unittest.skipIf( - sys.platform in ["win32", "cygwin"], - "Level Zero module creation unsupported on Windows.", - ) + # @unittest.skipIf( + # sys.platform in ["win32", "cygwin"], + # "Level Zero module creation unsupported on Windows.", + # ) def test_create_program_from_spirv(self): CURR_DIR = os.path.dirname(os.path.abspath(__file__)) spirv_file = os.path.join(CURR_DIR, "input_files/multi_kernel.spv") From a9aebf0b6c50728a8fccaa858f01fa4dff1463dd Mon Sep 17 00:00:00 2001 From: etotmeni Date: Tue, 20 Apr 2021 18:12:12 +0300 Subject: [PATCH 3/3] Fixes --- conda-recipe/bld.bat | 1 + conda-recipe/build.sh | 2 -- dpctl-capi/CMakeLists.txt | 7 +------ dpctl-capi/cmake/modules/FindLevelZero.cmake | 4 ---- dpctl/tests/test_sycl_program.py | 6 ------ 5 files changed, 2 insertions(+), 18 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 161137b8ef..7d1051047b 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -6,6 +6,7 @@ if errorlevel 1 ( git clone -b v1.2.3 https://github.com/oneapi-src/level-zero.git copy "%CD%\\level-zero\\include\\zet_api.h" "%CD%\\dpctl-capi\\include\\zet_api.h" +set L0_INCLUDE_DIR="%CD%" "%PYTHON%" setup.py clean --all "%PYTHON%" setup.py install diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 2ff0bd6ecf..4e180a97ab 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -11,8 +11,6 @@ fi git clone -b v1.2.3 https://github.com/oneapi-src/level-zero.git mv "$(pwd)/level-zero/include/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" -# wget https://github.com/oneapi-src/level-zero/blob/master/include/zet_api.h -# mv "$(pwd)/zet_api.h" "$(pwd)/dpctl-capi/include/zet_api.h" ${PYTHON} setup.py clean --all ${PYTHON} setup.py install diff --git a/dpctl-capi/CMakeLists.txt b/dpctl-capi/CMakeLists.txt index 59c77b7ec8..ce0dd574d7 100644 --- a/dpctl-capi/CMakeLists.txt +++ b/dpctl-capi/CMakeLists.txt @@ -94,12 +94,7 @@ target_link_libraries(DPCTLSyclInterface ) if(DPCTL_ENABLE_LO_PROGRAM_CREATION) - if(UNIX) - target_include_directories(DPCTLSyclInterface - PRIVATE - ${LEVEL_ZERO_INCLUDE_DIR} - ) - elseif(WIN32) + if(WIN32 OR UNIX) target_include_directories(DPCTLSyclInterface PRIVATE ${LEVEL_ZERO_INCLUDE_DIR} diff --git a/dpctl-capi/cmake/modules/FindLevelZero.cmake b/dpctl-capi/cmake/modules/FindLevelZero.cmake index 742ed07845..55b1f36012 100644 --- a/dpctl-capi/cmake/modules/FindLevelZero.cmake +++ b/dpctl-capi/cmake/modules/FindLevelZero.cmake @@ -25,10 +25,6 @@ # LEVEL_ZERO_LIBRARY - the full path to the ze_loader library # TODO: Add a way to record the version of the level_zero library -if(WIN32) - set L0_INCLUDE_DIR="%CD%\\level-zero\\include\\zet_api.h" -endif() - find_library(LEVEL_ZERO_LIBRARY ze_loader HINTS $ENV{L0_LIB_DIR}) if(UNIX) find_path(LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/zet_api.h HINTS $ENV{L0_INCLUDE_DIR}) diff --git a/dpctl/tests/test_sycl_program.py b/dpctl/tests/test_sycl_program.py index f6438945f6..c688032ccd 100644 --- a/dpctl/tests/test_sycl_program.py +++ b/dpctl/tests/test_sycl_program.py @@ -85,12 +85,6 @@ class TestProgramForLevel0GPU(unittest.TestCase): import sys - # Level zero program creation from a SPIR-V binary is not supported - # on Windows. - # @unittest.skipIf( - # sys.platform in ["win32", "cygwin"], - # "Level Zero module creation unsupported on Windows.", - # ) def test_create_program_from_spirv(self): CURR_DIR = os.path.dirname(os.path.abspath(__file__)) spirv_file = os.path.join(CURR_DIR, "input_files/multi_kernel.spv")