diff --git a/.github/deps/dpcpp-icx.env b/.github/deps/dpcpp-icx.env new file mode 100644 index 00000000..4d913fd2 --- /dev/null +++ b/.github/deps/dpcpp-icx.env @@ -0,0 +1 @@ +DPCPP_VERSION=icx/compiler_ppkg-rel/20240129 \ No newline at end of file diff --git a/.github/deps/dpcpp-sycl-nightly.env b/.github/deps/dpcpp-sycl-nightly.env index 75ae44b9..7372f6ce 100644 --- a/.github/deps/dpcpp-sycl-nightly.env +++ b/.github/deps/dpcpp-sycl-nightly.env @@ -1 +1 @@ -DPCPP_VERSION=intel-llvm/nightly-2023-09-22-rk +DPCPP_VERSION=intel-llvm/nightly-2023-10-26-rk diff --git a/.github/deps/gfx-windows-public.env b/.github/deps/gfx-windows-public.env index a68ea51b..a0c5335d 100644 --- a/.github/deps/gfx-windows-public.env +++ b/.github/deps/gfx-windows-public.env @@ -1 +1 @@ -GFX_DRIVER_VERSION=windows-101.4826 \ No newline at end of file +GFX_DRIVER_VERSION=windows-101.5186 \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index dfaa812d..c401e8ec 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -35,7 +35,6 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh CPU benchmark-x8380-1: @@ -47,7 +46,6 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh CPU benchmark-i9-12900k-1: @@ -59,7 +57,6 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh CPU benchmark-a3970x-1: @@ -71,7 +68,6 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh CPU build-gpu: @@ -82,13 +78,10 @@ jobs: image: ubuntu:22.04 artifact-out: build-gpu artifact-path: ./build/install ./build/openvkl/build - level-zero-version: public/1.12.0 # It's needed to build ISPCRT env-from-files: .github/deps/dpcpp-sycl-nightly.env cmd: | - export CC=clang - export CXX=clang++ module load cmake/3.25.3 - gitlab/build.sh -D BUILD_OPENVDB=OFF -D BUILD_ISPCRT_GPU=ON \ + gitlab/build.sh -D BUILD_OPENVDB=OFF \ -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" @@ -106,7 +99,6 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh GPU perf-pvc: @@ -122,5 +114,4 @@ jobs: setup-benny: true cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-benchmarks.sh GPU \ No newline at end of file diff --git a/.github/workflows/ci.linux.gpu.icx.yml b/.github/workflows/ci.linux.gpu.icx.yml new file mode 100644 index 00000000..55cd7ef0 --- /dev/null +++ b/.github/workflows/ci.linux.gpu.icx.yml @@ -0,0 +1,175 @@ +## Copyright 2023 Intel Corporation +## SPDX-License-Identifier: Apache-2.0 + +name: CI GPU ICX Linux Workflow +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build-gpu: + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + artifact-out: build-gpu + artifact-path: ./build/install ./build/openvkl/build + env-from-files: .github/deps/dpcpp-icx.env + cmd: | + module load cmake/3.25.3 + gitlab/build.sh -D BUILD_OPENVDB=OFF \ + -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" + + build-gpu-rel-with-dbg-info: + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + env-from-files: .github/deps/dpcpp-icx.env + cmd: | + module load cmake/3.25.3 + gitlab/build.sh -D BUILD_OPENVDB=OFF \ + -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON \ + -D CMAKE_BUILD_TYPE=RelWithDebInfo" + + build-gpu-debug: + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + env-from-files: .github/deps/dpcpp-icx.env + cmd: | + module load cmake/3.25.3 + gitlab/build.sh -D BUILD_OPENVDB=OFF \ + -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ + -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON \ + -D CMAKE_BUILD_TYPE=Debug" + + test-build-from-install-dg2: + needs: [ build-gpu ] + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "dg2" ]' + artifact-in: build-gpu + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env + options: --device=/dev/dri:/dev/dri + cmd: | + module load cmake/3.25.3 + export PATH=`pwd`/build/install/bin:`pwd`/build/install:$PATH + gitlab/build-from-install.sh + + test-pvc: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "pvc" ]' + artifact-in: build-gpu + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env .github/env/pvc-runtime-options.env + options: --device=/dev/dri:/dev/dri + cmd: | + cd ./build/install/bin + ./vklTutorialGPU + ./vklTestsGPU --durations yes + + test-examples-pvc: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "pvc" ]' + artifact-in: build-gpu + artifact-out: test-examples-pvc + artifact-path: ./build/install/bin/*.pfm + artifact-on-failure: true + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env .github/env/pvc-runtime-options.env + options: --device=/dev/dri:/dev/dri + cmd: | + cd ./build/install/bin + python3 $GITHUB_WORKSPACE/.github/scripts/run-examples-tests.py $STORAGE_PATH/tools/img-diff/dist_linux/img_diff + + test-cpu: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "build" ]' + artifact-in: build-gpu + env-from-files: .github/deps/dpcpp-icx.env + cmd: | + cd ./build/install/bin + ./vklTutorialCPU + ./vklTestsCPU --durations yes + + test-dg2: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "dg2" ]' + artifact-in: build-gpu + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env + options: --device=/dev/dri:/dev/dri + cmd: | + cd ./build/install/bin + ./vklTutorialGPU + ./vklTestsGPU --durations yes + + test-examples-dg2: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "dg2" ]' + artifact-in: build-gpu + artifact-out: test-examples-dg2 + artifact-path: ./build/install/bin/*.pfm + artifact-on-failure: true + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env + options: --device=/dev/dri:/dev/dri + cmd: | + cd ./build/install/bin + python3 $GITHUB_WORKSPACE/.github/scripts/run-examples-tests.py $STORAGE_PATH/tools/img-diff/dist_linux/img_diff + + test-examples-big-volume-pvc: + secrets: inherit + needs: [ build-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main + with: + submodules: true + image: ubuntu:22.04 + runs-on: '[ "Linux", "docker", "pvc" ]' + artifact-in: build-gpu + artifact-out: test-examples-big-volume-pvc + artifact-path: ./build/install/*.pfm + artifact-on-failure: true + env-from-files: .github/deps/dpcpp-icx.env .github/deps/gfx-linux-public.env .github/env/pvc-runtime-options.env + options: --device=/dev/dri:/dev/dri + cmd: | + cd ./build/install + $GITHUB_WORKSPACE/.github/scripts/run-examples-big-volume-tests.sh \ No newline at end of file diff --git a/.github/workflows/ci.linux.gpu.yml b/.github/workflows/ci.linux.gpu.yml index 39fb5ccb..a93d7003 100644 --- a/.github/workflows/ci.linux.gpu.yml +++ b/.github/workflows/ci.linux.gpu.yml @@ -20,13 +20,10 @@ jobs: image: ubuntu:22.04 artifact-out: build-gpu artifact-path: ./build/install ./build/openvkl/build - level-zero-version: public/1.12.0 # It's needed to build ISPCRT env-from-files: .github/deps/dpcpp-sycl-nightly.env cmd: | module load cmake/3.25.3 - export CC=clang - export CXX=clang++ - gitlab/build.sh -D BUILD_OPENVDB=OFF -D BUILD_ISPCRT_GPU=ON \ + gitlab/build.sh -D BUILD_OPENVDB=OFF \ -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" @@ -37,13 +34,10 @@ jobs: with: submodules: true image: ubuntu:22.04 - level-zero-version: public/1.12.0 # It's needed to build ISPCRT env-from-files: .github/deps/dpcpp-sycl-nightly.env cmd: | module load cmake/3.25.3 - export CC=clang - export CXX=clang++ - gitlab/build.sh -D BUILD_OPENVDB=OFF -D BUILD_ISPCRT_GPU=ON \ + gitlab/build.sh -D BUILD_OPENVDB=OFF \ -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON \ @@ -55,13 +49,10 @@ jobs: with: submodules: true image: ubuntu:22.04 - level-zero-version: public/1.12.0 # It's needed to build ISPCRT env-from-files: .github/deps/dpcpp-sycl-nightly.env cmd: | module load cmake/3.25.3 - export CC=clang - export CXX=clang++ - gitlab/build.sh -D BUILD_OPENVDB=OFF -D BUILD_ISPCRT_GPU=ON \ + gitlab/build.sh -D BUILD_OPENVDB=OFF \ -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF \ -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON \ @@ -79,9 +70,6 @@ jobs: options: --device=/dev/dri:/dev/dri cmd: | module load cmake/3.25.3 - export CC=clang - export CXX=clang++ - export LD_LIBRARY_PATH=`pwd`/build/install/lib:$LD_LIBRARY_PATH export PATH=`pwd`/build/install/bin:`pwd`/build/install:$PATH gitlab/build-from-install.sh @@ -97,7 +85,6 @@ jobs: env-from-files: .github/deps/dpcpp-sycl-nightly.env .github/deps/gfx-linux-public.env .github/env/pvc-runtime-options.env options: --device=/dev/dri:/dev/dri cmd: | - export LD_LIBRARY_PATH=`pwd`/build/install/lib:$LD_LIBRARY_PATH cd ./build/install/bin ./vklTutorialGPU ./vklTestsGPU --durations yes @@ -117,7 +104,6 @@ jobs: env-from-files: .github/deps/dpcpp-sycl-nightly.env .github/deps/gfx-linux-public.env .github/env/pvc-runtime-options.env options: --device=/dev/dri:/dev/dri cmd: | - export LD_LIBRARY_PATH=`pwd`/build/install/lib:$LD_LIBRARY_PATH cd ./build/install/bin python3 $GITHUB_WORKSPACE/.github/scripts/run-examples-tests.py $STORAGE_PATH/tools/img-diff/dist_linux/img_diff @@ -133,7 +119,6 @@ jobs: env-from-files: .github/deps/dpcpp-sycl-nightly.env .github/deps/gfx-linux-public.env options: --device=/dev/dri:/dev/dri cmd: | - export LD_LIBRARY_PATH=`pwd`/build/install/lib:$LD_LIBRARY_PATH cd ./build/install/bin ./vklTutorialGPU ./vklTestsGPU --durations yes @@ -153,7 +138,6 @@ jobs: env-from-files: .github/deps/dpcpp-sycl-nightly.env .github/deps/gfx-linux-public.env options: --device=/dev/dri:/dev/dri cmd: | - export LD_LIBRARY_PATH=`pwd`/build/install/lib:$LD_LIBRARY_PATH cd ./build/install/bin python3 $GITHUB_WORKSPACE/.github/scripts/run-examples-tests.py $STORAGE_PATH/tools/img-diff/dist_linux/img_diff @@ -173,5 +157,4 @@ jobs: options: --device=/dev/dri:/dev/dri cmd: | cd ./build/install - export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH $GITHUB_WORKSPACE/.github/scripts/run-examples-big-volume-tests.sh \ No newline at end of file diff --git a/.github/workflows/ci.linux.yml b/.github/workflows/ci.linux.yml index 44e65a5f..5acdf212 100644 --- a/.github/workflows/ci.linux.yml +++ b/.github/workflows/ci.linux.yml @@ -437,7 +437,6 @@ jobs: artifact-in: build-linux-arch image: ospray/docker-images:arch cmd: | - export LD_LIBRARY_PATH=./build/install/lib ./build/openvkl/build/vklTutorialCPU ./build/openvkl/build/vklTutorialISPC ./build/openvkl/build/vklExamplesCPU -batch -printStats -spp 50 -framebufferSize 1024 1024 @@ -463,7 +462,6 @@ jobs: prebuild: > mkdir build && cd build && - export LD_LIBRARY_PATH=`pwd`/install/lib:${LD_LIBRARY_PATH} && cmake -DBUILD_JOBS=`nproc` -DBUILD_DEPENDENCIES_ONLY=ON -DBUILD_GLFW=OFF "$@" ../superbuild && cmake --build . && mkdir openvkl_build && @@ -471,7 +469,6 @@ jobs: DEP_INSTALL_DIR=`pwd`/../install && export rkcommon_DIR=$DEP_INSTALL_DIR && export embree_DIR=$DEP_INSTALL_DIR && - export ispcrt_DIR=$DEP_INSTALL_DIR && cmake -DISPC_EXECUTABLE=$DEP_INSTALL_DIR/bin/ispc -DBUILD_EXAMPLES=OFF -DRKCOMMON_TBB_ROOT=$DEP_INSTALL_DIR ../.. && cd ../.. build: cmake --build ./build/openvkl_build diff --git a/.github/workflows/ci.mac.yml b/.github/workflows/ci.mac.yml index dac6e420..14ceb22f 100644 --- a/.github/workflows/ci.mac.yml +++ b/.github/workflows/ci.mac.yml @@ -31,7 +31,6 @@ jobs: runs-on: '[ "macOS", "build", "x86_64" ]' artifact-in: build-macOS cmd: | - export DYLD_LIBRARY_PATH=./build/install/lib ./build/openvkl/build/vklTutorialCPU ./build/openvkl/build/vklTutorialISPC ./build/openvkl/build/vklExamplesCPU -batch -printStats -spp 50 -framebufferSize 1024 1024 @@ -57,7 +56,6 @@ jobs: runs-on: '[ "macOS", "build", "x86_64" ]' artifact-in: build-macOS-TBB2020 cmd: | - export DYLD_LIBRARY_PATH=./build/install/lib ./build/openvkl/build/vklTutorialCPU ./build/openvkl/build/vklTutorialISPC ./build/openvkl/build/vklExamplesCPU -batch -printStats -spp 50 -framebufferSize 1024 1024 @@ -84,7 +82,6 @@ jobs: runs-on: '[ "macOS", "build", "arm" ]' artifact-in: build-macOS-arm-neon cmd: | - export DYLD_LIBRARY_PATH=./build/install/lib export OPENVKL_LOG_LEVEL=debug # gives prints of current ISA and SIMD width ./build/openvkl/build/vklTutorialCPU ./build/openvkl/build/vklTutorialISPC @@ -112,7 +109,6 @@ jobs: runs-on: '[ "macOS", "build", "arm" ]' artifact-in: build-macOS-arm-neon2x cmd: | - export DYLD_LIBRARY_PATH=./build/install/lib export OPENVKL_LOG_LEVEL=debug # gives prints of current ISA and SIMD width ./build/openvkl/build/vklTutorialCPU ./build/openvkl/build/vklTutorialISPC diff --git a/.github/workflows/ci.windows.gpu.icx.yml b/.github/workflows/ci.windows.gpu.icx.yml new file mode 100644 index 00000000..9d5de54b --- /dev/null +++ b/.github/workflows/ci.windows.gpu.icx.yml @@ -0,0 +1,91 @@ +## Copyright 2023 Intel Corporation +## SPDX-License-Identifier: Apache-2.0 + +name: CI GPU ICX Windows Workflow +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build-windows-gpu: + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows_gpu.yml@main + with: + force-delete: true # guarantees .gitattributes are respected in working dir + submodules: true + runs-on: '[ "Windows", "build" ]' + env-from-files: ./.github/deps/dpcpp-icx.env + artifact-out: build-windows-gpu + artifact-path: ./build + artifact-on-failure: true + cmd: | + # disable warnings which lead to excessively large log files + $env:CXXFLAGS = '-w' + $env:CFLAGS = '-w' + + mkdir build + cd build + + cmake -L -G Ninja -D CMAKE_INSTALL_LIBDIR=lib -D BUILD_OPENVKL_BENCHMARKS=OFF -D BUILD_OPENVKL_TESTING=ON -D BUILD_OPENVDB=OFF -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" ../superbuild + + cmake --build . --config Release -j1 --verbose + + + test-windows-cpu: + secrets: inherit + needs: [ build-windows-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows_gpu.yml@main + with: + force-delete: true # guarantees .gitattributes are respected in working dir + submodules: true + runs-on: '[ "Windows", "build" ]' + env-from-files: ./.github/deps/dpcpp-icx.env + artifact-in: build-windows-gpu + cmd: | + cd ./build/install/bin + + ./vklTutorialCPU + ./vklTestsCPU + + test-windows-dg2: + secrets: inherit + needs: [ build-windows-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows_gpu.yml@main + with: + force-delete: true # guarantees .gitattributes are respected in working dir + submodules: true + runs-on: '[ "Windows", "dg2" ]' + env-from-files: ./.github/deps/dpcpp-icx.env ./.github/deps/gfx-windows-public.env + artifact-in: build-windows-gpu + cmd: | + cd ./build/install/bin + + ./vklTutorialGPU + ./vklTestsGPU --durations yes exclude:'Multiple devices' + + test-examples-windows-dg2: + secrets: inherit + needs: [ build-windows-gpu ] + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows_gpu.yml@main + with: + force-delete: true # guarantees .gitattributes are respected in working dir + submodules: true + runs-on: '[ "Windows", "dg2" ]' + env-from-files: ./.github/deps/dpcpp-icx.env ./.github/deps/gfx-windows-public.env + artifact-in: build-windows-gpu + artifact-out: test-examples-dg2 + artifact-path: ./build/install/bin/*.pfm + artifact-on-failure: true + cmd: | + # Prepare img_diff tool to be ready for CI usage (copy it on local runner) + $img_diff_dir = $env:STORAGE_PATH + '\tools\img-diff\dist_windows' + Copy-Item -Path "$img_diff_dir" -Destination $pwd\img-diff -Recurse + $img_diff_path = "$pwd\img-diff\img_diff.exe" + + cd $env:GITHUB_WORKSPACE/build/install/bin + python $env:GITHUB_WORKSPACE/.github/scripts/run-examples-tests.py "$img_diff_path" \ No newline at end of file diff --git a/.github/workflows/ci.windows.gpu.yml b/.github/workflows/ci.windows.gpu.yml index 0cdabe8d..e9dc0318 100644 --- a/.github/workflows/ci.windows.gpu.yml +++ b/.github/workflows/ci.windows.gpu.yml @@ -18,7 +18,6 @@ jobs: with: force-delete: true # guarantees .gitattributes are respected in working dir submodules: true - level-zero-version: public/1.12.0 # It's needed to build ISPCRT runs-on: '[ "Windows", "build" ]' env-from-files: ./.github/deps/dpcpp-sycl-nightly.env artifact-out: build-windows-gpu @@ -32,7 +31,7 @@ jobs: mkdir build cd build - cmake -L -G Ninja -D CMAKE_INSTALL_LIBDIR=lib -D BUILD_OPENVKL_BENCHMARKS=OFF -D BUILD_OPENVKL_TESTING=ON -D BUILD_OPENVDB=OFF -D BUILD_ISPCRT_GPU=ON -D CMAKE_CXX_COMPILER=clang-cl -D CMAKE_C_COMPILER=clang-cl -D OPENVKL_EXTRA_OPTIONS="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DOPENVKL_ENABLE_DEVICE_GPU=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" ../superbuild + cmake -L -G Ninja -D CMAKE_INSTALL_LIBDIR=lib -D BUILD_OPENVKL_BENCHMARKS=OFF -D BUILD_OPENVKL_TESTING=ON -D BUILD_OPENVDB=OFF -D CMAKE_CXX_COMPILER=clang-cl -D CMAKE_C_COMPILER=clang-cl -D OPENVKL_EXTRA_OPTIONS="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DOPENVKL_ENABLE_DEVICE_GPU=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON" ../superbuild cmake --build . --config Release -j1 --verbose diff --git a/.github/workflows/ci.windows.yml b/.github/workflows/ci.windows.yml index 2d5ed5f7..2d1f2223 100644 --- a/.github/workflows/ci.windows.yml +++ b/.github/workflows/ci.windows.yml @@ -20,7 +20,7 @@ jobs: runs-on: '[ "Windows", "build" ]' artifact-out: build-windows-msvc15 artifact-path: ./build/install - cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" + cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" "Release" build-windows-msvc15-TBB2020: secrets: inherit @@ -31,7 +31,7 @@ jobs: runs-on: '[ "Windows", "build" ]' artifact-out: build-windows-msvc15-TBB2020 artifact-path: ./build/install - cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" '"-DTBB_VERSION=2020.3"' '"-DTBB_HASH="""' + cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" "Release" '"-DTBB_VERSION=2020.3"' '"-DTBB_HASH="""' test-windows-msvc15: needs: build-windows-msvc15 @@ -51,4 +51,4 @@ jobs: runs-on: '[ "Windows", "build" ]' artifact-in: build-windows-msvc15-TBB2020 cmd: | - gitlab\run_tests.bat + gitlab\run_tests.bat \ No newline at end of file diff --git a/.github/workflows/nightly.windows.yml b/.github/workflows/nightly.windows.yml new file mode 100644 index 00000000..2b8a15bf --- /dev/null +++ b/.github/workflows/nightly.windows.yml @@ -0,0 +1,35 @@ +## Copyright 2023 Intel Corporation +## SPDX-License-Identifier: Apache-2.0 + +name: Nightly Windows Workflow +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build-windows-msvc15-debug: + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows.yml@main + with: + force-delete: true # guarantees .gitattributes are respected in working dir + submodules: true + runs-on: '[ "Windows", "build" ]' + artifact-out: build-windows-msvc15-debug + artifact-path: ./build/install + cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" "Debug" + + test-windows-msvc15-debug: + needs: build-windows-msvc15-debug + secrets: inherit + uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows.yml@main + with: + runs-on: '[ "Windows", "build" ]' + artifact-in: build-windows-msvc15-debug + cmd: | + gitlab\run_tests.bat \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2796abbf..79c976a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,6 @@ jobs: prebuild: > mkdir build && cd build && - export LD_LIBRARY_PATH=`pwd`/install/lib:${LD_LIBRARY_PATH} && cmake -DBUILD_JOBS=`nproc` -DBUILD_DEPENDENCIES_ONLY=ON -DBUILD_GLFW=OFF "$@" ../superbuild && cmake --build . && mkdir openvkl_build && @@ -33,7 +32,6 @@ jobs: DEP_INSTALL_DIR=`pwd`/../install && export rkcommon_DIR=$DEP_INSTALL_DIR && export embree_DIR=$DEP_INSTALL_DIR && - export ispcrt_DIR=$DEP_INSTALL_DIR && cmake -DISPC_EXECUTABLE=$DEP_INSTALL_DIR/bin/ispc -DBUILD_EXAMPLES=OFF -DRKCOMMON_TBB_ROOT=$DEP_INSTALL_DIR ../.. && cd ../.. build: cmake --build ./build/openvkl_build @@ -49,7 +47,7 @@ jobs: artifact-out: linux artifact-path: ./*.gz cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" module load cmake module load intel/2022.1 export CC=icx @@ -67,10 +65,9 @@ jobs: image: rockylinux:8.7 artifact-out: linux_sycl artifact-path: ./*.gz - level-zero-version: public/1.12.0 # It's needed to build ISPCRT env-from-files: .github/deps/dpcpp-sycl-nightly.env cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" module load cmake/3.25.3 export CC=clang export CXX=clang++ @@ -86,8 +83,8 @@ jobs: artifact-out: windows artifact-path: ./*.zip cmd: | - $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" - $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" + $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/windows.ps1 "Visual Studio 15 2017 Win64" "v141" windows_sycl: @@ -96,7 +93,6 @@ jobs: with: force-delete: true # guarantees .gitattributes are respected in working dir submodules: true - level-zero-version: public/1.12.0 # It's needed to build ISPCRT runs-on: '[ "Windows", "build" ]' env-from-files: ./.github/deps/dpcpp-sycl-nightly.env artifact-out: windows_sycl @@ -106,8 +102,8 @@ jobs: $env:CXXFLAGS = '-w' $env:CFLAGS = '-w' - $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" - $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" + $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/windows_sycl.ps1 macos: @@ -120,7 +116,7 @@ jobs: artifact-out: macos artifact-path: ./*.zip cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/macos.sh linux-test: @@ -132,7 +128,7 @@ jobs: image: rockylinux:8.7 artifact-in: linux cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/linux-test.sh linux_sycl-test: @@ -140,13 +136,13 @@ jobs: secrets: inherit uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main with: - image: ubuntu:22.04 + image: ubuntu:22.04 runs-on: '[ "Linux", "docker", "dg2" ]' artifact-in: linux_sycl env-from-files: .github/deps/dpcpp-sycl-nightly.env .github/deps/gfx-linux-public.env options: --device=/dev/dri:/dev/dri cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" module load cmake/3.25.3 gitlab/release/linux_sycl-test.sh @@ -155,13 +151,13 @@ jobs: secrets: inherit uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker_gpu.yml@main with: - image: ubuntu:22.04 + image: ubuntu:22.04 runs-on: '[ "Linux", "docker", "dg2" ]' artifact-in: linux_sycl env-from-files: .github/deps/gfx-linux-public.env options: --device=/dev/dri:/dev/dri cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" module load cmake/3.25.3 gitlab/release/linux_sycl-test_run_only.sh @@ -173,8 +169,8 @@ jobs: runs-on: '[ "Windows" ]' artifact-in: windows cmd: | - $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" - $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" + $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/windows-test.ps1 "Visual Studio 15 2017 Win64" "v141" windows_sycl-test: @@ -184,12 +180,12 @@ jobs: with: force-delete: true # guarantees .gitattributes are respected in working dir submodules: true - runs-on: '[ "Windows", "dg2" ]' + runs-on: '[ "Windows", "dg2" ]' env-from-files: ./.github/deps/dpcpp-sycl-nightly.env ./.github/deps/gfx-windows-public.env artifact-in: windows_sycl cmd: | - $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" - $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" + $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/windows_sycl-test.ps1 windows_sycl-test_run_only: @@ -203,8 +199,8 @@ jobs: env-from-files: ./.github/deps/gfx-windows-public.env artifact-in: windows_sycl cmd: | - $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" - $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + $env:OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" + $OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/windows_sycl-test_run_only.ps1 macos-test: @@ -215,7 +211,7 @@ jobs: runs-on: '[ "macOS", "build", "x86_64" ]' artifact-in: macos cmd: | - export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.0" + export OPENVKL_RELEASE_PACKAGE_VERSION="2.0.1" gitlab/release/macos-test.sh binary-analysis: diff --git a/CHANGELOG.md b/CHANGELOG.md index ec18f6e1..bf285bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Version History --------------- +### Open VKL 2.0.1 + +- Removed ISPC runtime dependency and level zero loader requirement +- Add DEPENDENTLOADFLAG linker parameter for Windows binaries, restricting DLL + loading behavior +- Superbuild updates to latest versions of dependencies + ### Open VKL 2.0.0 - This Open VKL release adds support for Intel® Arc™ GPUs, Intel® Data Center diff --git a/CMakeLists.txt b/CMakeLists.txt index ea5a6bfe..da06f90c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_policy(SET CMP0074 NEW) ## Establish project ## -project(openvkl VERSION 2.0.0 LANGUAGES C CXX) +project(openvkl VERSION 2.0.1 LANGUAGES C CXX) ## Add openvkl specific macros ## @@ -48,6 +48,14 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openvkl/include/${PROJECT_NAME}/versio DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ) +set(CMAKE_SKIP_INSTALL_RPATH OFF) +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) + set(CMAKE_INSTALL_RPATH "@loader_path/" "@loader_path/../${CMAKE_INSTALL_LIBDIR}") +else() + set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") +endif() + ## openvkl specific configuration ## option(BUILD_EXAMPLES "Build example applications." ON) diff --git a/README.md b/README.md index afb0fe66..75938d6c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Intel® Open Volume Kernel Library -This is release v2.0.0 of Intel® Open VKL. For changes and new features +This is release v2.0.1 of Intel® Open VKL. For changes and new features see the [changelog](CHANGELOG.md). Visit http://www.openvkl.org for more information. @@ -43,6 +43,13 @@ example renderers to demonstrate how to best use the Open VKL API. ## Version History +### Open VKL 2.0.1 + +- Removed ISPC runtime dependency and level zero loader requirement +- Add DEPENDENTLOADFLAG linker parameter for Windows binaries, + restricting DLL loading behavior +- Superbuild updates to latest versions of dependencies + ### Open VKL 2.0.0 - This Open VKL release adds support for Intel® Arc™ GPUs, Intel® Data @@ -2752,22 +2759,8 @@ Linux or Windows, you need the following additional prerequisites: - [CMake](http://www.cmake.org) version 3.25.3 or higher -- Download or build from sources [oneAPI Level Zero Loader - v1.12.0](https://github.com/oneapi-src/level-zero/releases/tag/v1.12.0) - development packages. - - - On Linux Ubuntu 22.04 there are prebuilt packages available for - this: `level-zero-devel` and `level-zero` - - - Other Linux distributions require building these packages from - source. - - - On Windows, you can use the single package - `level-zero__win-sdk`; note you will need to set the - environment variable `LEVEL_ZERO_ROOT` to the location of the SDK. - - Download the [oneAPI DPC++ Compiler - 2023-09-22](https://github.com/intel/llvm/releases/tag/nightly-2023-09-22); + 2023-10-26](https://github.com/intel/llvm/releases/tag/nightly-2023-10-26); please note this specific version has been validated and used in our releases. @@ -2819,8 +2812,7 @@ the superbuild. On Linux: export CC=clang export CXX=clang++ - cmake -D BUILD_ISPCRT_GPU=ON \ - -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON" \ + cmake -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON" \ [/superbuild] ``` @@ -2828,7 +2820,6 @@ And on Windows: ``` cmake -L -G Ninja \ - -D BUILD_ISPCRT_GPU=ON \ -D CMAKE_CXX_COMPILER=clang-cl -D CMAKE_C_COMPILER=clang-cl \ -D OPENVKL_EXTRA_OPTIONS="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DOPENVKL_ENABLE_DEVICE_GPU=ON" \ [/superbuild] diff --git a/cmake/openvklConfig.cmake.in b/cmake/openvklConfig.cmake.in index 166199d8..6afbf6ad 100644 --- a/cmake/openvklConfig.cmake.in +++ b/cmake/openvklConfig.cmake.in @@ -51,12 +51,6 @@ if (TARGET openvkl::openvkl_module_gpu_device) file(GLOB_RECURSE RKCOMMON_LIBRARY ${LIBRARY_PATH_PREFIX}rkcommon*.${LIB_SUFFIX}) endif() - if (TARGET ispcrt::ispcrt) - set(ISPCRT_LIBRARY ispcrt::ispcrt) - else() - file(GLOB_RECURSE ISPCRT_LIBRARY ${LIBRARY_PATH_PREFIX}ispcrt.${LIB_SUFFIX}) - endif() - if (TARGET embree) set(EMBREE_LIBRARY embree) else() @@ -71,7 +65,7 @@ if (TARGET openvkl::openvkl_module_gpu_device) # Add missing targets to libraries set_target_properties(openvkl::openvkl_module_gpu_device PROPERTIES - INTERFACE_LINK_LIBRARIES "${RKCOMMON_LIBRARY};${ISPCRT_LIBRARY};${EMBREE_LIBRARY};${TBB_LIBRARY}" + INTERFACE_LINK_LIBRARIES "${RKCOMMON_LIBRARY};${EMBREE_LIBRARY};${TBB_LIBRARY}" ) endif() diff --git a/cmake/openvkl_ispc.cmake b/cmake/openvkl_ispc.cmake index 2900abf3..cbb66838 100644 --- a/cmake/openvkl_ispc.cmake +++ b/cmake/openvkl_ispc.cmake @@ -311,8 +311,3 @@ macro (OPENVKL_ISPC_COMPILE) set(ISPC_OBJECTS ${ISPC_OBJECTS} ${results}) endforeach() endmacro() - -if (NOT ISPCRT_FOUND) - set(ISPCRT_VERSION_REQUIRED "1.19.0") - find_package(ispcrt ${ISPCRT_VERSION_REQUIRED} REQUIRED) -endif() diff --git a/cmake/openvkl_macros.cmake b/cmake/openvkl_macros.cmake index 990745c2..935b55cd 100644 --- a/cmake/openvkl_macros.cmake +++ b/cmake/openvkl_macros.cmake @@ -33,9 +33,7 @@ macro(openvkl_add_executable_ispc name) openvkl_ispc_compile(${ISPC_SOURCES}) unset(ISPC_TARGET_NAME) add_executable(${name} ${ISPC_OBJECTS} ${OTHER_SOURCES} ${ISPC_SOURCES} ${VKL_RESOURCE}) - target_link_libraries(${name} PRIVATE ispcrt::ispcrt) - target_include_directories(${name} PRIVATE "${COMMON_PATH}" "${LEVEL_ZERO_INCLUDE_DIR}" "${ISPC_INCLUDE_DIR}" ) - target_link_libraries(${name} PRIVATE ${LEVEL_ZERO_LIB_LOADER}) + target_include_directories(${name} PRIVATE ${ISPC_INCLUDE_DIR}) endmacro() macro(openvkl_configure_build_type) @@ -64,7 +62,11 @@ macro(openvkl_configure_global_build_flags) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model=precise") + if (WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model=precise") + endif() endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") @@ -72,6 +74,19 @@ macro(openvkl_configure_global_build_flags) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-ansi-alias") endif() endif() + + if(WIN32) + # set DEPENDENTLOADFLAG:LOAD_LIBRARY_SAFE_CURRENT_DIRS on all binaries + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEPENDENTLOADFLAG:0x2000") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEPENDENTLOADFLAG:0x2000") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /Qoption,link,/DEPENDENTLOADFLAG:0x2000") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /Qoption,link,/DEPENDENTLOADFLAG:0x2000") + else() + message(WARNING "Unrecognized compiler, DEPENDENTLOADFLAG can't be set") + endif() + endif() endmacro() macro(openvkl_create_embree_target) diff --git a/doc/compilation.md b/doc/compilation.md index 72b43357..fe5ea3b6 100644 --- a/doc/compilation.md +++ b/doc/compilation.md @@ -72,21 +72,8 @@ Windows, you need the following additional prerequisites: - [CMake](http://www.cmake.org) version 3.25.3 or higher -- Download or build from sources [oneAPI Level Zero Loader - v1.12.0](https://github.com/oneapi-src/level-zero/releases/tag/v1.12.0) - development packages. - - - On Linux Ubuntu 22.04 there are prebuilt packages available for this: -`level-zero-devel` and `level-zero` - - - Other Linux distributions require building these packages from source. - - - On Windows, you can use the single package - `level-zero__win-sdk`; note you will need to set the - environment variable `LEVEL_ZERO_ROOT` to the location of the SDK. - - Download the [oneAPI DPC++ Compiler - 2023-09-22](https://github.com/intel/llvm/releases/tag/nightly-2023-09-22); + 2023-10-26](https://github.com/intel/llvm/releases/tag/nightly-2023-10-26); please note this specific version has been validated and used in our releases. @@ -143,8 +130,7 @@ superbuild. On Linux: export CC=clang export CXX=clang++ - cmake -D BUILD_ISPCRT_GPU=ON \ - -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON" \ + cmake -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_ENABLE_DEVICE_GPU=ON" \ [/superbuild] ``` @@ -152,7 +138,6 @@ And on Windows: ``` cmake -L -G Ninja \ - -D BUILD_ISPCRT_GPU=ON \ -D CMAKE_CXX_COMPILER=clang-cl -D CMAKE_C_COMPILER=clang-cl \ -D OPENVKL_EXTRA_OPTIONS="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DOPENVKL_ENABLE_DEVICE_GPU=ON" \ [/superbuild] diff --git a/examples/vklTutorialGPU.cpp b/examples/vklTutorialGPU.cpp index 716dfee1..de4fa28b 100644 --- a/examples/vklTutorialGPU.cpp +++ b/examples/vklTutorialGPU.cpp @@ -318,7 +318,7 @@ int main() sycl::queue syclQueue(IntelGPUDeviceSelector); sycl::context syclContext = syclQueue.get_context(); - + sycl::device syclDevice = syclQueue.get_device(); std::cout << "Target SYCL device: " << syclQueue.get_device().get_info() << std::endl @@ -328,6 +328,9 @@ int main() VKLDevice device = vklNewDevice("gpu"); vklDeviceSetVoidPtr(device, "syclContext", static_cast(&syclContext)); + // "syclDevice" is optional. + // By default first available SYCL device will be used. + vklDeviceSetVoidPtr(device, "syclDevice", static_cast(&syclDevice)); vklCommitDevice(device); const int dimensions[] = {128, 128, 128}; diff --git a/gitlab/build.bat b/gitlab/build.bat index 16fa4eee..008b9636 100755 --- a/gitlab/build.bat +++ b/gitlab/build.bat @@ -15,10 +15,10 @@ cmake -L ^ -D CMAKE_INSTALL_LIBDIR=lib ^ -D BUILD_OPENVKL_BENCHMARKS=OFF ^ -D BUILD_OPENVKL_TESTING=ON ^ -%~3 %~4 %~5 %~6 %~7 %~8 %~9 ^ +%~4 %~5 %~6 %~7 %~8 %~9 ^ ../superbuild -cmake --build . --verbose --config Release --target ALL_BUILD -- /m /nologo +cmake --build . --verbose --config "%~3" --target ALL_BUILD -- /m /nologo :abort endlocal diff --git a/gitlab/release/linux.sh b/gitlab/release/linux.sh index 900836e4..0449507f 100755 --- a/gitlab/release/linux.sh +++ b/gitlab/release/linux.sh @@ -52,7 +52,6 @@ cd $OPENVKL_BUILD_DIR export rkcommon_DIR=$DEP_INSTALL_DIR export embree_DIR=$DEP_INSTALL_DIR export glfw3_DIR=$DEP_INSTALL_DIR -export ispcrt_DIR=$DEP_INSTALL_DIR export OPENVKL_EXTRA_OPENVDB_OPTIONS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON" diff --git a/gitlab/release/linux_sycl.sh b/gitlab/release/linux_sycl.sh index b83e8b26..b191e2be 100755 --- a/gitlab/release/linux_sycl.sh +++ b/gitlab/release/linux_sycl.sh @@ -37,7 +37,6 @@ cmake \ -D BUILD_DEPENDENCIES_ONLY=ON \ -D CMAKE_INSTALL_PREFIX=$DEP_INSTALL_DIR \ -D CMAKE_INSTALL_LIBDIR=lib \ - -D BUILD_ISPCRT_GPU=ON \ ../superbuild cmake --build . @@ -53,7 +52,6 @@ cd $OPENVKL_BUILD_DIR export rkcommon_DIR=$DEP_INSTALL_DIR export embree_DIR=$DEP_INSTALL_DIR export glfw3_DIR=$DEP_INSTALL_DIR -export ispcrt_DIR=$DEP_INSTALL_DIR export OPENVKL_EXTRA_OPENVDB_OPTIONS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON" diff --git a/gitlab/release/macos.sh b/gitlab/release/macos.sh index 4e25d75a..6956c004 100755 --- a/gitlab/release/macos.sh +++ b/gitlab/release/macos.sh @@ -65,7 +65,6 @@ cd $OPENVKL_BUILD_DIR export rkcommon_DIR=$DEP_INSTALL_DIR export embree_DIR=$DEP_INSTALL_DIR export glfw3_DIR=$DEP_INSTALL_DIR -export ispcrt_DIR=$DEP_INSTALL_DIR export OPENVKL_EXTRA_OPENVDB_OPTIONS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON" diff --git a/gitlab/release/windows.ps1 b/gitlab/release/windows.ps1 index 78cc7834..204f2f86 100755 --- a/gitlab/release/windows.ps1 +++ b/gitlab/release/windows.ps1 @@ -40,7 +40,6 @@ cd $OPENVKL_BUILD_DIR $env:rkcommon_DIR = $DEP_INSTALL_DIR $env:embree_DIR = $DEP_INSTALL_DIR $env:glfw3_DIR = $DEP_INSTALL_DIR -$env:ispcrt_DIR = $DEP_INSTALL_DIR # set release settings cmake -L ` diff --git a/gitlab/release/windows_sycl.ps1 b/gitlab/release/windows_sycl.ps1 index 05b3aa6d..d337518e 100755 --- a/gitlab/release/windows_sycl.ps1 +++ b/gitlab/release/windows_sycl.ps1 @@ -25,7 +25,6 @@ cmake -L ` -D CMAKE_INSTALL_PREFIX=$DEP_INSTALL_DIR ` -D CMAKE_INSTALL_LIBDIR=lib ` -D CMAKE_CXX_COMPILER=clang-cl -D CMAKE_C_COMPILER=clang-cl ` - -D BUILD_ISPCRT_GPU=ON ` -D BUILD_OPENVDB=OFF ` ../superbuild @@ -42,7 +41,6 @@ cd $OPENVKL_BUILD_DIR $env:rkcommon_DIR = $DEP_INSTALL_DIR $env:embree_DIR = $DEP_INSTALL_DIR $env:glfw3_DIR = $DEP_INSTALL_DIR -$env:ispcrt_DIR = $DEP_INSTALL_DIR # set release settings cmake -L ` @@ -65,7 +63,7 @@ cmake -L ` cmake --build . --config Release --verbose # install -cmake --build . --config Release --target install +cmake --build . --config Release --target install # copy dependent libs into the install $INSTALL_BIN_DIR = "$OPENVKL_INSTALL_DIR/bin" @@ -74,7 +72,6 @@ $INSTALL_LIB_DIR = "$OPENVKL_INSTALL_DIR/lib" cp $DEP_INSTALL_DIR/bin/*.dll $INSTALL_BIN_DIR cp $DEP_INSTALL_DIR/lib/rkcommon*.lib $INSTALL_LIB_DIR -cp $DEP_INSTALL_DIR/lib/ispcrt*.lib $INSTALL_LIB_DIR cp $DEP_INSTALL_DIR/lib/embree*.lib $INSTALL_LIB_DIR cp $DEP_INSTALL_DIR/lib/tbb*.lib $INSTALL_LIB_DIR diff --git a/openvkl/CMakeLists.txt b/openvkl/CMakeLists.txt index b7d9a92b..e66e5528 100644 --- a/openvkl/CMakeLists.txt +++ b/openvkl/CMakeLists.txt @@ -32,9 +32,7 @@ target_include_directories(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} PUBLIC - $ - PRIVATE - ispcrt::ispcrt) + $) set(VKL_VDB_LOG_RESOLUTION_0 "6" CACHE STRING "Base 2 logarithm of the root level resolution in vdb volumes.") diff --git a/openvkl/api/Device.h b/openvkl/api/Device.h index 741c9521..33ddb8f0 100644 --- a/openvkl/api/Device.h +++ b/openvkl/api/Device.h @@ -39,12 +39,6 @@ namespace openvkl { namespace api { - typedef struct - { - void *allocatedBuffer; - void *privateManagement; - } memstate; - struct OPENVKL_CORE_INTERFACE Device : public rkcommon::memory::RefCountedObject, public rkcommon::utility::ParameterizedObject @@ -174,10 +168,9 @@ namespace openvkl { virtual AllocType getAllocationType(const void *ptr) const = 0; - virtual void *getContext() const = 0; - - virtual memstate *allocateBytes(size_t numBytes) const = 0; - virtual void freeMemState(memstate *) const = 0; + virtual void *allocateSharedMemory(size_t numBytes, + size_t alignment) const = 0; + virtual void freeSharedMemory(void *) const = 0; virtual char *copyDeviceBufferToHost(size_t numItems, VKLDataType dataType, diff --git a/openvkl/common/Data.cpp b/openvkl/common/Data.cpp index 5ee790f0..7a8cd38e 100644 --- a/openvkl/common/Data.cpp +++ b/openvkl/common/Data.cpp @@ -59,12 +59,12 @@ namespace openvkl { const size_t naturalByteStride = sizeOf(dataType); const size_t numBytes = numItems * naturalByteStride; - openvkl::api::memstate *m = this->device->allocateBytes(numBytes + 16); - if (m->allocatedBuffer == nullptr) { + sharedPtr = + this->device->allocateSharedMemory(numBytes, alignOf(dataType)); + if (sharedPtr == nullptr) { throw std::bad_alloc(); } - memstate = m; - void *buffer = m->allocatedBuffer; + void *buffer = sharedPtr; if (isManagedObject(dataType)) { // the user provided an array of VKLObjects, but we'll only populate @@ -89,8 +89,8 @@ namespace openvkl { addr = (char *)buffer; byteStride = naturalByteStride; } else if (dataCreationFlags == VKL_DATA_SHARED_BUFFER) { - // memstate is not needed for shared buffers - memstate = nullptr; + // sharedPtr is not needed for shared buffers + sharedPtr = nullptr; addr = (char *)source; // we must validate that shared buffers for GPU devices were allocated @@ -175,12 +175,11 @@ namespace openvkl { const size_t numBytes = numItems * byteStride; - openvkl::api::memstate *m = this->device->allocateBytes(numBytes + 16); - if (m->allocatedBuffer == nullptr) { + sharedPtr = this->device->allocateSharedMemory(numBytes, alignOf(dataType)); + if (sharedPtr == nullptr) { throw std::bad_alloc(); } - memstate = m; - addr = (char *)m->allocatedBuffer; + addr = (char *)sharedPtr; managedObjectType = VKL_DATA; @@ -203,7 +202,8 @@ namespace openvkl { } if (!(dataCreationFlags & VKL_DATA_SHARED_BUFFER)) { - this->device->freeMemState(memstate); + this->device->freeSharedMemory(sharedPtr); + sharedPtr = nullptr; } else if ((dataCreationFlags & VKL_DATA_SHARED_BUFFER) && ownSharedBuffer) { LogMessageStream(this->device.ptr, VKL_LOG_DEBUG) diff --git a/openvkl/common/Data.h b/openvkl/common/Data.h index b3452cdd..a3a1c0b6 100644 --- a/openvkl/common/Data.h +++ b/openvkl/common/Data.h @@ -54,7 +54,7 @@ namespace openvkl { static ispc::Data1D emptyData1D; // dummy, zero-initialized protected: - api::memstate *memstate; + void *sharedPtr; char *addr; // transfer ownership of the shared buffer? if so, we will free the memory @@ -99,12 +99,18 @@ namespace openvkl { // DataT //////////////////////////////////////////////////////////////////// template - class Iter1D : public std::iterator + class Iter1D { char *addr{nullptr}; size_t byteStride{0}; public: + using iterator_category = std::forward_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = T *; + using reference = T &; + Iter1D(char *addr, size_t byteStride) : addr(addr), byteStride(byteStride) { } diff --git a/openvkl/devices/common/BufferShared.h b/openvkl/devices/common/BufferShared.h index 6d25798d..620ab718 100644 --- a/openvkl/devices/common/BufferShared.h +++ b/openvkl/devices/common/BufferShared.h @@ -5,74 +5,63 @@ #include #include "../api/Device.h" -#include "ispcrt.hpp" namespace openvkl { // C version //////////////////////////////////////////// - inline ISPCRTMemoryView BufferSharedCreate(Device *device, size_t size) + inline void *BufferSharedCreate(Device *device, size_t size, size_t alignment) { - ispcrt::Context *context = (ispcrt::Context *)device->getContext(); - ISPCRTNewMemoryViewFlags flags; - flags.allocType = ISPCRT_ALLOC_TYPE_SHARED; - flags.smHint = ISPCRT_SM_HOST_WRITE_DEVICE_READ; - auto view = - ispcrtNewMemoryViewForContext(context->handle(), nullptr, size, &flags); - return view; + return device->allocateSharedMemory(size, alignment); } - inline void BufferSharedDelete(ISPCRTMemoryView view) + inline void BufferSharedDelete(Device *device, void *ptr) { - ispcrtRelease(view); + device->freeSharedMemory(ptr); } // C++ version //////////////////////////////////////////// template - struct BufferShared : public ispcrt::Array + struct BufferShared { - using ispcrt::Array::sharedPtr; - BufferShared(Device *device); + private: + void *m_ptr; + size_t m_size; + Device *m_device; + + public: BufferShared(Device *, size_t size); BufferShared(Device *, const std::vector &v); - BufferShared(Device *, const T *data, size_t size); + T *sharedPtr() + { + return (T *)m_ptr; + } + size_t size() + { + return m_size; + } + ~BufferShared() + { + BufferSharedDelete(m_device, m_ptr); + } }; - template - BufferShared::BufferShared(Device *device) - : ispcrt::Array( - *(ispcrt::Context *)device->getContext()) - { - // ISPCRT lazily allocates on first access of pointer; force allocation on - // construction to maintain thread safety - sharedPtr(); - } - template BufferShared::BufferShared(Device *device, size_t size) - : ispcrt::Array( - *(ispcrt::Context *)device->getContext(), size) + : m_size(size), + m_device(device), + m_ptr(BufferSharedCreate(device, sizeof(T) * size, alignof(T))) { - // ISPCRT lazily allocates on first access of pointer; force allocation on - // construction to maintain thread safety - sharedPtr(); } template BufferShared::BufferShared(Device *device, const std::vector &v) - : ispcrt::Array( - *(ispcrt::Context *)device->getContext(), v.size()) - { - memcpy(sharedPtr(), v.data(), sizeof(T) * v.size()); - } - - template - BufferShared::BufferShared(Device *device, const T *data, size_t size) - : ispcrt::Array( - *(ispcrt::Context *)device->getContext(), size) + : m_size(v.size()), + m_device(device), + m_ptr(BufferSharedCreate(device, sizeof(T) * v.size(), alignof(T))) { - memcpy(sharedPtr(), data, sizeof(T) * size); + memcpy(sharedPtr(), v.data(), sizeof(T) * m_size); } template diff --git a/openvkl/devices/common/StructShared.h b/openvkl/devices/common/StructShared.h index eb608c08..347994cf 100644 --- a/openvkl/devices/common/StructShared.h +++ b/openvkl/devices/common/StructShared.h @@ -6,7 +6,6 @@ #include #include #include -#include "ispcrt.hpp" #include "BufferShared.h" @@ -34,14 +33,6 @@ namespace openvkl { the same). */ - template - inline ISPCRTMemoryView StructSharedCreate(Device *device) - { - ISPCRTMemoryView view = BufferSharedCreate(device, sizeof(T)); - new (ispcrtSharedPtr(view)) T; - return view; - } - struct StructSharedView { ~StructSharedView(); @@ -53,7 +44,7 @@ namespace openvkl { friend struct AddStructShared; private: - ISPCRTMemoryView structSharedView{nullptr}; + void *structSharedView{nullptr}; // we must keep the underlying device, which contains the ispcrt::Context, // active as long as this view is active @@ -63,7 +54,7 @@ namespace openvkl { template struct StructSharedGet { - StructSharedGet(Device *, ISPCRTMemoryView *); + StructSharedGet(Device *, void **); T *getSh() const; }; @@ -132,22 +123,22 @@ namespace openvkl { inline StructSharedView::~StructSharedView() { - BufferSharedDelete(structSharedView); + BufferSharedDelete(structSharedDevice.ptr, structSharedView); } template - StructSharedGet::StructSharedGet(Device *device, ISPCRTMemoryView *view) + StructSharedGet::StructSharedGet(Device *device, void **view) { if (!*view) { - *view = StructSharedCreate(device); + *view = BufferSharedCreate(device, sizeof(T), alignof(T)); + new (*view) T; } } template T *StructSharedGet::getSh() const { - return static_cast( - ispcrtHostPtr(static_cast(this)->structSharedView)); + return static_cast(static_cast(this)->structSharedView); } // Testing //////////////////////////////////////////////////// diff --git a/openvkl/devices/cpu/CMakeLists.txt b/openvkl/devices/cpu/CMakeLists.txt index 86b38920..62f22a21 100644 --- a/openvkl/devices/cpu/CMakeLists.txt +++ b/openvkl/devices/cpu/CMakeLists.txt @@ -223,17 +223,15 @@ foreach(TARGET_WIDTH 4 8 16) PUBLIC $ $ - $ ) target_link_libraries(${TARGET_NAME} PUBLIC - openvkl - $ - $ + openvkl + $ PRIVATE - embree - $ + embree + $ ) openvkl_install_library(${TARGET_NAME}) diff --git a/openvkl/devices/cpu/api/CPUDevice.cpp b/openvkl/devices/cpu/api/CPUDevice.cpp index 7d95754e..773d87c8 100644 --- a/openvkl/devices/cpu/api/CPUDevice.cpp +++ b/openvkl/devices/cpu/api/CPUDevice.cpp @@ -1,9 +1,11 @@ // Copyright 2019 Intel Corporation // SPDX-License-Identifier: Apache-2.0 +#include #include "rkcommon/math/AffineSpace.h" #include "rkcommon/math/box.h" #include "rkcommon/math/vec.h" +#include "rkcommon/memory/malloc.h" using namespace rkcommon; using namespace rkcommon::math; @@ -27,26 +29,20 @@ namespace openvkl { /////////////////////////////////////////////////////////////////////////// template - CPUDevice::~CPUDevice() + void *CPUDevice::allocateSharedMemory(size_t numBytes, + size_t alignment) const { - delete (ispcrt::Context *)context; + // Allocate memory aligned to 64 bytes (512 bits) + // which is optimal for AVX512 instructions. + // If larger alignment requested then use it instead. + return rkcommon::memory::alignedMalloc(numBytes, + std::max((size_t)64, alignment)); } template - api::memstate *CPUDevice::allocateBytes(size_t numBytes) const + void CPUDevice::freeSharedMemory(void *ptr) const { - api::memstate *container = new api::memstate; - void *buffer = (char *)new char[numBytes]; - container->privateManagement = nullptr; - container->allocatedBuffer = buffer; - return container; - } - - template - void CPUDevice::freeMemState(api::memstate *container) const - { - delete[](char *) container->allocatedBuffer; - delete container; + rkcommon::memory::alignedFree(ptr); } template @@ -66,11 +62,6 @@ namespace openvkl { { Device::commit(); - if (!context) { - auto _context = new ispcrt::Context(ISPCRT_DEVICE_TYPE_CPU); - context = (void *)_context; - } - VKLISPCTarget target = static_cast(CALL_ISPC(ISPC_getTarget)); diff --git a/openvkl/devices/cpu/api/CPUDevice.h b/openvkl/devices/cpu/api/CPUDevice.h index 73e81947..b1fa7ad2 100644 --- a/openvkl/devices/cpu/api/CPUDevice.h +++ b/openvkl/devices/cpu/api/CPUDevice.h @@ -21,7 +21,6 @@ namespace openvkl { struct CPUDevice : public AddDeviceAPIs { CPUDevice() = default; - ~CPUDevice() override; bool supportsWidth(int width) override; @@ -490,16 +489,9 @@ namespace openvkl { return OPENVKL_ALLOC_TYPE_HOST; } - void *getContext() const override - { - return context; - }; - - api::memstate *allocateBytes(size_t numBytes) const override; - void freeMemState(api::memstate *) const override; - - private: - void *context{nullptr}; + void *allocateSharedMemory(size_t numBytes, + size_t alignment) const override; + void freeSharedMemory(void *) const override; }; //////////////////////////////////////////////////////////////////////////// diff --git a/openvkl/devices/cpu/common/Allocator.h b/openvkl/devices/cpu/common/Allocator.h index a9412462..a56b9718 100644 --- a/openvkl/devices/cpu/common/Allocator.h +++ b/openvkl/devices/cpu/common/Allocator.h @@ -30,10 +30,6 @@ namespace openvkl { template void deallocate(T *&ptr); - - private: - std::atomic bytesAllocated{0}; - std::map ptrToMemState; }; // ------------------------------------------------------------------------- @@ -41,33 +37,14 @@ namespace openvkl { template inline T *Allocator::allocate(size_t size) { - // matches default for rkcommon::memory::alignedMalloc(), which was used - // before - const size_t alignment = 64; - - const size_t numBytes = size * sizeof(T) + alignment; - bytesAllocated += numBytes; + const size_t numBytes = size * sizeof(T); - api::memstate *m = this->device->allocateBytes(numBytes); - if (!m->allocatedBuffer) { + void *memory = this->device->allocateSharedMemory(numBytes, alignof(T)); + if (!memory) { throw std::bad_alloc(); } - - // std::align() may modify ptr and space, so use temporaries here - void *ptr = m->allocatedBuffer; - size_t space = numBytes; - - void *alignedBuffer = std::align(alignment, size * sizeof(T), ptr, space); - if (!alignedBuffer) { - throw std::bad_alloc(); - } - - T *buf = reinterpret_cast(alignedBuffer); - std::memset(buf, 0, size * sizeof(T)); - - ptrToMemState[buf] = m; - - return buf; + std::memset(memory, 0, numBytes); + return reinterpret_cast(memory); } template @@ -76,15 +53,7 @@ namespace openvkl { if (!ptr) { return; } - - if (ptrToMemState.count(ptr)) { - this->device->freeMemState(ptrToMemState[ptr]); - ptrToMemState.erase(ptr); - } else { - throw std::runtime_error( - "Allocator::deallocate(): cannot find memstate for ptr"); - } - + this->device->freeSharedMemory(ptr); ptr = nullptr; } @@ -100,46 +69,39 @@ namespace openvkl { { typedef T value_type; - AllocatorStl(Device *device) noexcept : device(device){}; + AllocatorStl(Device *device) : m_device(device) + { + assert(m_device); + }; - ~AllocatorStl(); + ~AllocatorStl() = default; template - AllocatorStl(const AllocatorStl &) noexcept - { - } + bool operator==(const AllocatorStl &) const = delete; template - bool operator==(const AllocatorStl &) const noexcept - { - return true; - } + bool operator!=(const AllocatorStl &) const = delete; template - bool operator!=(const AllocatorStl &) const noexcept + AllocatorStl(const AllocatorStl &o) { - return false; + m_device = o.getDevice(); + assert(m_device); } T *allocate(const size_t n); void deallocate(T *const p, size_t); + Device *getDevice() const + { + return m_device; + }; private: - Device *device{nullptr}; - - std::map ptrToMemState; + Device *m_device{nullptr}; }; // ------------------------------------------------------------------------- - template - AllocatorStl::~AllocatorStl() - { - for (auto const &m : ptrToMemState) { - this->device->freeMemState(m.second); - } - } - template T *AllocatorStl::allocate(const size_t size) { @@ -151,30 +113,16 @@ namespace openvkl { throw std::bad_array_new_length(); } - const size_t alignment = alignof(T); - - const size_t numBytes = size * sizeof(T) + alignment; + const size_t numBytes = size * sizeof(T); - api::memstate *m = this->device->allocateBytes(numBytes); - if (!m->allocatedBuffer) { + void *memory = m_device->allocateSharedMemory(numBytes, alignof(T)); + if (!memory) { throw std::bad_alloc(); } - // std::align() may modify ptr and space, so use temporaries here - void *ptr = m->allocatedBuffer; - size_t space = numBytes; + std::memset(memory, 0, numBytes); - void *alignedBuffer = std::align(alignment, size * sizeof(T), ptr, space); - if (!alignedBuffer) { - throw std::bad_alloc(); - } - - T *buf = reinterpret_cast(alignedBuffer); - std::memset(buf, 0, size * sizeof(T)); - - ptrToMemState[buf] = m; - - return buf; + return reinterpret_cast(memory); } template @@ -183,16 +131,7 @@ namespace openvkl { if (!ptr) { return; } - - void *voidPtr = static_cast(ptr); - - if (ptrToMemState.count(voidPtr)) { - this->device->freeMemState(ptrToMemState[voidPtr]); - ptrToMemState.erase(voidPtr); - } else { - throw std::runtime_error( - "Allocator::deallocate(): cannot find memstate for ptr"); - } + m_device->freeSharedMemory(ptr); } } // namespace cpu_device diff --git a/openvkl/devices/cpu/volume/StructuredVolume.h b/openvkl/devices/cpu/volume/StructuredVolume.h index fc56223e..edcdff3f 100644 --- a/openvkl/devices/cpu/volume/StructuredVolume.h +++ b/openvkl/devices/cpu/volume/StructuredVolume.h @@ -95,7 +95,7 @@ namespace openvkl { rkcommon::memory::Ref> background; private: - ISPCRTMemoryView m_accelerator = nullptr; + void *m_accelerator = nullptr; std::unique_ptr> valueRanges; std::unique_ptr> cellValueRanges; }; @@ -110,7 +110,7 @@ namespace openvkl { SharedStructuredVolume_Destructor(this->getSh()); } if (m_accelerator) - BufferSharedDelete(m_accelerator); + BufferSharedDelete(this->getDevice(), m_accelerator); } template @@ -239,11 +239,11 @@ namespace openvkl { preHostBuild(); if (m_accelerator) - BufferSharedDelete(m_accelerator); - m_accelerator = - BufferSharedCreate(this->getDevice(), sizeof(ispc::GridAccelerator)); - auto ga = - static_cast(ispcrtHostPtr(m_accelerator)); + BufferSharedDelete(this->getDevice(), m_accelerator); + m_accelerator = BufferSharedCreate(this->getDevice(), + sizeof(ispc::GridAccelerator), + alignof(ispc::GridAccelerator)); + auto ga = static_cast(m_accelerator); // cells per dimension after padding out the volume dimensions to the // nearest cell diff --git a/openvkl/devices/cpu/volume/UnstructuredBVH.h b/openvkl/devices/cpu/volume/UnstructuredBVH.h index e3c72f54..06fcdcc3 100644 --- a/openvkl/devices/cpu/volume/UnstructuredBVH.h +++ b/openvkl/devices/cpu/volume/UnstructuredBVH.h @@ -47,7 +47,7 @@ namespace openvkl { memGuard.lock(); if (chunkBytesRemaining < sizeof(T)) { - allocateNewChunk(); + allocateNewChunk(alignof(T)); } ptr = chunkPtr; @@ -56,10 +56,9 @@ namespace openvkl { memGuard.unlock(); } else { - auto mv = BufferSharedCreate(device.ptr, sizeof(T)); - ptr = ispcrtSharedPtr(mv); + ptr = BufferSharedCreate(device.ptr, sizeof(T), alignof(T)); memGuard.lock(); - memRefs.push_back(mv); + memRefs.push_back(ptr); memGuard.unlock(); } @@ -81,7 +80,7 @@ namespace openvkl { memGuard.lock(); if (chunkBytesRemaining < num * sizeof(T)) { - allocateNewChunk(); + allocateNewChunk(alignof(T)); } ptr = chunkPtr; @@ -90,10 +89,9 @@ namespace openvkl { memGuard.unlock(); } else { - auto mv = BufferSharedCreate(device.ptr, num * sizeof(T)); - ptr = ispcrtSharedPtr(mv); + ptr = BufferSharedCreate(device.ptr, num * sizeof(T), alignof(T)); memGuard.lock(); - memRefs.push_back(mv); + memRefs.push_back(ptr); memGuard.unlock(); } @@ -106,8 +104,8 @@ namespace openvkl { virtual ~BvhBuildAllocator() { - for (auto mv : memRefs) { - BufferSharedDelete(mv); + for (auto ptr : memRefs) { + BufferSharedDelete(device.ptr, ptr); } } @@ -119,7 +117,7 @@ namespace openvkl { std::mutex memGuard; // data to free eventually - std::vector memRefs; + std::vector memRefs; // how many bytes to allocate per "chunk", if 0 then no chunking // allocation is used @@ -129,15 +127,14 @@ namespace openvkl { char *chunkPtr = nullptr; long long chunkBytesRemaining = 0; - void allocateNewChunk() + void allocateNewChunk(size_t alignment) { // memGuard should already be locked! + void *ptr = + BufferSharedCreate(device.ptr, chunkAllocationBytes, alignment); + memRefs.push_back(ptr); - ISPCRTMemoryView mv = - BufferSharedCreate(device.ptr, chunkAllocationBytes); - memRefs.push_back(mv); - - chunkPtr = static_cast(ispcrtSharedPtr(mv)); + chunkPtr = static_cast(ptr); chunkBytesRemaining = chunkAllocationBytes; } }; diff --git a/openvkl/devices/cpu/volume/amr/AMRAccel.cpp b/openvkl/devices/cpu/volume/amr/AMRAccel.cpp index 351b2a73..e75e97fb 100644 --- a/openvkl/devices/cpu/volume/amr/AMRAccel.cpp +++ b/openvkl/devices/cpu/volume/amr/AMRAccel.cpp @@ -8,6 +8,7 @@ using namespace rkcommon; using namespace rkcommon::math; #include +#include "../devices/common/BufferShared.h" #include "AMRAccel.h" namespace openvkl { @@ -21,8 +22,7 @@ namespace openvkl { nodeAllocator(device), node(nodeAllocator), leafAllocator(device), - leaf(leafAllocator), - brickListAllocator(device) + leaf(leafAllocator) { box3f bounds = empty; std::vector brickVec; @@ -62,8 +62,12 @@ namespace openvkl { AMRAccel::Leaf newLeaf; newLeaf.bounds = bounds; + auto brickListBuffer = + std::make_shared>( + levelAllocator.getDevice(), brick.size() + 1); - newLeaf.brickList = brickListAllocator.allocate(brick.size() + 1); + newLeaf.brickList = brickListBuffer->sharedPtr(); + m_brickListContainer.push_back(brickListBuffer); // create leaf list, and sort it std::copy(brick.begin(), brick.end(), newLeaf.brickList); diff --git a/openvkl/devices/cpu/volume/amr/AMRAccel.h b/openvkl/devices/cpu/volume/amr/AMRAccel.h index 3525f894..dc6511b6 100644 --- a/openvkl/devices/cpu/volume/amr/AMRAccel.h +++ b/openvkl/devices/cpu/volume/amr/AMRAccel.h @@ -103,9 +103,6 @@ namespace openvkl { AllocatorStl leafAllocator; std::vector> leaf; - //! for brick lists inside leaf nodes - AllocatorStl brickListAllocator; - //! world bounds of domain box3f worldBounds; @@ -117,6 +114,9 @@ namespace openvkl { void buildRec(int nodeID, const box3f &bounds, std::vector &brick); + + std::vector>> + m_brickListContainer; }; std::ostream &operator<<(std::ostream &os, const AMRAccel &a); diff --git a/openvkl/devices/gpu/CMakeLists.txt b/openvkl/devices/gpu/CMakeLists.txt index 43a59208..acfba1d7 100644 --- a/openvkl/devices/gpu/CMakeLists.txt +++ b/openvkl/devices/gpu/CMakeLists.txt @@ -150,15 +150,13 @@ target_include_directories(openvkl_module_gpu_device PUBLIC $ $ - $ ) target_link_libraries(openvkl_module_gpu_device PUBLIC - openvkl - $ - $ - $ + openvkl + $ + $ ) target_compile_definitions(openvkl_module_gpu_device PUBLIC diff --git a/openvkl/devices/gpu/api/GPUDevice.cpp b/openvkl/devices/gpu/api/GPUDevice.cpp index 0ac2ed19..9cb466c4 100644 --- a/openvkl/devices/gpu/api/GPUDevice.cpp +++ b/openvkl/devices/gpu/api/GPUDevice.cpp @@ -25,12 +25,6 @@ namespace openvkl { // GPUDevice ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// - template - GPUDevice::~GPUDevice() - { - delete (ispcrt::Context *)context; - } - template AllocType GPUDevice::getAllocationType(const void *ptr) const { @@ -52,22 +46,17 @@ namespace openvkl { } template - api::memstate *GPUDevice::allocateBytes(size_t numBytes) const + void *GPUDevice::allocateSharedMemory(size_t numBytes, + size_t alignment) const { - api::memstate *container = new api::memstate; - container->privateManagement = - (void *)BufferSharedCreate((Device *)this, numBytes + 16); - void *buffer = - ispcrtSharedPtr((ISPCRTMemoryView)container->privateManagement); - container->allocatedBuffer = buffer; - return container; + return (void *)sycl::aligned_alloc_shared( + alignment, numBytes, syclDevice, syclContext); } template - void GPUDevice::freeMemState(api::memstate *container) const + void GPUDevice::freeSharedMemory(void *ptr) const { - BufferSharedDelete((ISPCRTMemoryView)container->privateManagement); - delete container; + sycl::free(ptr, syclContext); } template @@ -126,44 +115,29 @@ namespace openvkl { { Device::commit(); - // the env var OPENVKL_GPU_DEVICE_DEBUG_USE_CPU is intended for debug - // purposes only, and forces the Open VKL GPU device to use the CPU - // instead. - const bool useCpu = - rkcommon::utility::getEnvVar("OPENVKL_GPU_DEVICE_DEBUG_USE_CPU") - .value_or(0); + sycl::context *c = + (sycl::context *)getParam("syclContext", nullptr); - if (context) { - delete (ispcrt::Context *)context; - context = nullptr; + if (c == nullptr) { + throw std::runtime_error( + "SYCL device type can't be used without 'syclContext' parameter"); } - if (useCpu) { - postLogMessage(this, VKL_LOG_INFO) - << "GPU device: using CPU backend (enabled via env var: " - "OPENVKL_GPU_DEVICE_DEBUG_USE_CPU=1)"; + // SYCL contexts are normally stored in the application by-value, so + // save a copy here in case it disappears from the application's stack + syclContext = *c; - context = new ispcrt::Context(ISPCRT_DEVICE_TYPE_CPU); + sycl::device *device = + (sycl::device *)getParam("syclDevice", nullptr); + if (device == nullptr) { + // take first device as default device + auto devices = syclContext.get_devices(); + if (devices.size() == 0) + throw std::runtime_error("SYCL context contains no device"); + syclDevice = devices[0]; } else { - sycl::context *c = - (sycl::context *)getParam("syclContext", nullptr); - - if (c == nullptr) { - throw std::runtime_error( - "GPU device type can't be used without 'syclContext' parameter"); - } - - // SYCL contexts are normally stored in the application by-value, so - // save a copy here in case it disappears from the application's stack - syclContext = *c; - - // nativeContext is a pointer - it's owned by syclContext so no need to - // care about life cycle for this variable here. - ze_context_handle_t nativeContext = - sycl::get_native(syclContext); - - context = new ispcrt::Context(ISPCRT_DEVICE_TYPE_GPU, nativeContext); + syclDevice = *device; } } diff --git a/openvkl/devices/gpu/api/GPUDevice.h b/openvkl/devices/gpu/api/GPUDevice.h index 3c1ab31f..2fa0811f 100644 --- a/openvkl/devices/gpu/api/GPUDevice.h +++ b/openvkl/devices/gpu/api/GPUDevice.h @@ -22,7 +22,6 @@ namespace openvkl { struct GPUDevice : public AddDeviceAPIs { GPUDevice() = default; - ~GPUDevice() override; bool supportsWidth(int width) override; @@ -122,13 +121,9 @@ namespace openvkl { AllocType getAllocationType(const void *ptr) const override; - void *getContext() const override - { - return context; - }; - - openvkl::api::memstate *allocateBytes(size_t numByte) const override; - void freeMemState(openvkl::api::memstate *) const override; + void *allocateSharedMemory(size_t numBytes, + size_t alignment) const override; + void freeSharedMemory(void *) const override; char *copyDeviceBufferToHost(size_t numItems, VKLDataType dataType, @@ -145,8 +140,8 @@ namespace openvkl { unsigned int attributeIndex, const float *times); - void *context{nullptr}; sycl::context syclContext; + sycl::device syclDevice; }; } // namespace gpu_device diff --git a/openvkl/include/openvkl/openvkl.rc b/openvkl/include/openvkl/openvkl.rc index a660e435..0ddae276 100644 --- a/openvkl/include/openvkl/openvkl.rc +++ b/openvkl/include/openvkl/openvkl.rc @@ -24,7 +24,7 @@ BEGIN VALUE "FileDescription", "Open Volume Kernel Library" VALUE "FileVersion", OPENVKL_VERSION VALUE "ProductVersion", OPENVKL_VERSION - VALUE "LegalCopyright", "© 2019-2022 Intel Corporation" + VALUE "LegalCopyright", "© 2019 Intel Corporation" VALUE "InternalName", "Open VKL" VALUE "ProductName", "Intel® Open VKL" END diff --git a/superbuild/CMakeLists.txt b/superbuild/CMakeLists.txt index 14254093..bff6d60c 100644 --- a/superbuild/CMakeLists.txt +++ b/superbuild/CMakeLists.txt @@ -95,30 +95,27 @@ option(BUILD_OPENVKL_BENCHMARKS option(BUILD_ISPC "Build the Intel SPMD Program Compiler or search in environment?" ON) if (BUILD_ISPC) - set(ISPC_VERSION "1.21.0") + set(ISPC_VERSION "1.22.0") set(ISPC_BASE_URL "https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}") if (APPLE) set(_ISPC_URL "${ISPC_BASE_URL}/ispc-v${ISPC_VERSION}-macOS.universal.tar.gz") - set(_ISPC_HASH "ea220fbf1b7e6a1211fe4c81827474ecf539c8c1cf278f7f7b8961f074dfa293") + set(_ISPC_HASH "af31ca1f02b04fbdd44b747f9e13c1df54d3e89a6e87c891ac5409b3b3a71370") elseif(WIN32) set(_ISPC_URL "${ISPC_BASE_URL}/ispc-v${ISPC_VERSION}-windows.zip") - set(_ISPC_HASH "b8823c03c050152aeae19594160d9a1a00e21817fc0cd86f21be2b4f22ab17bf") + set(_ISPC_HASH "e597a1568675d5c5ad9cf2fe5be2653d279c74b46d0e899a01a844770a0a9ad1") else() set(_ISPC_URL "${ISPC_BASE_URL}/ispc-v${ISPC_VERSION}-linux.tar.gz") - set(_ISPC_HASH "fe658893799af46c9cac0153f0bdc9a2ff93541fff9b17cf6b09ffc7576cfdcc") + set(_ISPC_HASH "8c935ef7537c241a519f2632e6ffeae0988a64f21db78d403ceaa4c52517b416") endif() set(ISPC_URL "${_ISPC_URL}" CACHE STRING "URL of the ISPC archive.") set(ISPC_HASH "${_ISPC_HASH}" CACHE STRING "SHA256 hash of the ISPC archive.") include(dep_ispc) - include(dep_ispcrt) endif() -option(BUILD_ISPCRT_GPU "Build the ISPC Runtime with GPU support?" OFF) - option(BUILD_TBB "Build Intel Threading Building Blocks or search in environment?" ON) option(BUILD_TBB_FROM_SOURCE "Build Intel Threading Building Blocks from source or use pre-built version?" OFF) if (BUILD_TBB) - set(TBB_VERSION "2021.10.0" CACHE STRING "TBB version to download") + set(TBB_VERSION "2021.11.0" CACHE STRING "TBB version to download") if (BUILD_TBB_FROM_SOURCE) if (TBB_VERSION VERSION_LESS 2021) message(FATAL_ERROR "Only TBB 2021 and later are supported when building TBB from source") @@ -126,7 +123,7 @@ if (BUILD_TBB) string(REGEX REPLACE "(^[0-9]+\.[0-9]+\.[0-9]+$)" "v\\1" TBB_ARCHIVE ${TBB_VERSION}) set(_TBB_URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/${TBB_ARCHIVE}.zip") - set(_TBB_HASH "78fb7bb29b415f53de21a68c4fdf97de8ae035090d9ee9caa221e32c6e79567c") + set(_TBB_HASH "2f0bfce641d238e80798fc48397d43821bd977d49c4e03bc785be363b7ab4742") else() if (TBB_VERSION VERSION_LESS 2021) set(TBB_BASE_URL "https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/tbb-${TBB_VERSION}") @@ -135,15 +132,15 @@ if (BUILD_TBB) endif() if (APPLE) set(_TBB_URL "${TBB_BASE_URL}-mac.tgz") - set(_TBB_HASH "20899b66b8a42d649283209276e70dd7e10ab10d90fd3c7372fc6e28dbc9a94b") + set(_TBB_HASH "360bcb20bcdcd01e8492c32bba6d5d5baf4bc83f77fb9dbf1ff701ac816e3b44") set(TBB_LIB_SUBDIR "") elseif(WIN32) set(_TBB_URL "${TBB_BASE_URL}-win.zip") - set(_TBB_HASH "d517205d6cc2f80a56500a7f7e1428d47e7cfc55ea66675027024c7b90047ecb") + set(_TBB_HASH "02f0e93600fba69bb1c00e5dd3f66ae58f56e5410342f6155455a95ba373b1b6") set(TBB_LIB_SUBDIR "intel64/vc14") else() set(_TBB_URL "${TBB_BASE_URL}-lin.tgz") - set(_TBB_HASH "d5be4164a1f2e67a8c7bc927cbe2b36690815adb48d36e50b9e3b8afa4c99310") + set(_TBB_HASH "95659f4d7b1711c41ffa190561d4e5b6841efc8091549661c7a2e6207e0fa79b") set(TBB_LIB_SUBDIR "intel64/gcc4.8") endif() endif() @@ -155,10 +152,10 @@ endif() option(BUILD_RKCOMMON "Build rkcommon or search in environment?" ON) if (BUILD_RKCOMMON) - set(RKCOMMON_VERSION "v1.12.0" CACHE STRING "rkcommon version to download") + set(RKCOMMON_VERSION "v1.13.0" CACHE STRING "rkcommon version to download") set(RKCOMMON_URL "https://github.com/ospray/rkcommon/archive/${RKCOMMON_VERSION}.zip" CACHE STRING "URL of the rkcommon archive.") - set(RKCOMMON_HASH "514be81fb9bc95bf8a36ee9dfe1289a0d09ad0b9d76263866c284066449c75ae" CACHE STRING "SHA256 hash of the rkcommon archive.") + set(RKCOMMON_HASH "9d360ce89de1842d4ae81b561ce150efd4fd812bd9e8b1d42d3934c528de637c" CACHE STRING "SHA256 hash of the rkcommon archive.") include(dep_rkcommon) endif() @@ -168,23 +165,23 @@ option(BUILD_EMBREE "Build Intel Embree or search in environment?" ON) option(BUILD_EMBREE_FROM_SOURCE "Build Embree from source or use pre-built version? (Only used when BUILD_EMBREE=ON)" ON) option(BUILD_EMBREE_SYCL "Build Intel Embree with SYCL support?" OFF) if (BUILD_EMBREE) - set(EMBREE_VERSION "v4.3.0" CACHE STRING "Embree version to download") + set(EMBREE_VERSION "v4.3.1" CACHE STRING "Embree version to download") if (BUILD_EMBREE_FROM_SOURCE) set(_EMBREE_URL "https://github.com/embree/embree/archive/${EMBREE_VERSION}.zip") - set(_EMBREE_HASH "e248e69b7a6debceb66b9f9af8ff5f7b46c19e696473b7ccaa3e3b7a37d65287") + set(_EMBREE_HASH "bdab87b285efa1a9f1f57fe74b2743c659c487fee7e32221db43a6b8f5e36e5f") else() # Embree binary package URLs do not use the "v" prefix string(REPLACE "v" "" EMBREE_VERSION_NUMBER ${EMBREE_VERSION}) set(EMBREE_BASE_URL "https://github.com/embree/embree/releases/download/${EMBREE_VERSION}") if (APPLE) set(_EMBREE_URL "${EMBREE_BASE_URL}/embree-${EMBREE_VERSION_NUMBER}.x86_64.macosx.zip") - set(_EMBREE_HASH "eed7a677bb5944f90238ad61dfdb4d602ed4568b2085af9ffd0b5d90cceee181") + set(_EMBREE_HASH "ffb446c5a688d961f4219f42446147632f5704374c5b2b148a1e2a20b7c99975") elseif (WIN32) set(_EMBREE_URL "${EMBREE_BASE_URL}/embree-${EMBREE_VERSION_NUMBER}.x64.windows.zip") - set(_EMBREE_HASH "4efe5269353168063ecb3ae24876c8ac868d5644c12bae75c86084c566b2acdb") + set(_EMBREE_HASH "6e2b968d45c0895cda98fb44c42e214e8d382bcd08b0a548fe086b0864563c6a") else() set(_EMBREE_URL "${EMBREE_BASE_URL}/embree-${EMBREE_VERSION_NUMBER}.x86_64.linux.tar.gz") - set(_EMBREE_HASH "93507aea3e35dcf1bc40aafa20ca9e882ded562a8909eeacc02d0b3de17691d0") + set(_EMBREE_HASH "375e829dc31ac5c6c579de34e0b1527e088a3b296fb9d3f90ed892d29592f845") endif() endif() set(EMBREE_URL "${_EMBREE_URL}" CACHE STRING "URL of the Embree source archive.") @@ -195,10 +192,10 @@ endif() option(BUILD_GLFW "Build glfw or search in environment?" ON) if (BUILD_GLFW) - set(GLFW_VERSION "3.3.8") + set(GLFW_VERSION "3.3.9") set(GLFW_URL "https://github.com/glfw/glfw/archive/${GLFW_VERSION}.zip" CACHE STRING "URL of the GLFW source archive.") - set(GLFW_HASH "8106e1a432305a8780b986c24922380df6a009a96b2ca590392cb0859062c8ff" + set(GLFW_HASH "c49d895b1f32fa3e072626f6dc928887fc814f445d3ba1fbb97598fea8e48933" CACHE STRING "SHA256 hash of the GLFW source archive.") include(dep_glfw) endif() @@ -224,25 +221,25 @@ if (BUILD_OPENVDB) message(WARNING "Open VKL superbuild currently does not support building OpenVDB on Windows with TBB 2021") set(BUILD_OPENVDB OFF) else() - set(ILMBASE_VERSION "2.5.9") + set(ILMBASE_VERSION "2.5.10") set(ILMBASE_URL "https://github.com/AcademySoftwareFoundation/openexr/archive/v${ILMBASE_VERSION}.zip" CACHE STRING "URL of the IlmBase archive.") - set(ILMBASE_HASH "3b23a2b16b09ab0419db5e1517d2e81b41b4b32606f95169a83e320504f0976f" + set(ILMBASE_HASH "8580ae0d1372fd54ba7ad79314253a9db2c69099eaee6472b3c1081895168c08" CACHE STRING "SHA256 hash of the IlmBase archive.") include(dep_ilmbase) - set(ZLIB_VERSION "1.3") + set(ZLIB_VERSION "1.3.1") set(ZLIB_URL "https://www.zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz" CACHE STRING "URL of the zlib archive.") - set(ZLIB_HASH "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e" + set(ZLIB_HASH "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" CACHE STRING "SHA256 hash of the zlib archive.") include(dep_zlib) - set(BOOST_VERSION "1.83.0") + set(BOOST_VERSION "1.84.0") string(REPLACE "." "_" BOOST_FILE_BASE "${BOOST_VERSION}") set(BOOST_BASE_URL "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost") set(_BOOST_URL "${BOOST_BASE_URL}_${BOOST_FILE_BASE}.tar.gz") - set(_BOOST_HASH "c0685b68dd44cc46574cce86c4e17c0f611b15e195be9848dfd0769a0a207628") + set(_BOOST_HASH "a5800f405508f5df8114558ca9855d2640a2de8f0445f051fa1c7c3383045724") set(BOOST_URL "${_BOOST_URL}" CACHE STRING "URL of the boost archive.") set(BOOST_HASH "${_BOOST_HASH}" CACHE STRING "SHA256 hash of the boost archive.") include(dep_boost) @@ -312,7 +309,6 @@ if (NOT BUILD_DEPENDENCIES_ONLY) ExternalProject_Add_StepDependencies(openvkl configure $<$:ispc> - $<$:ispcrt> $<$:tbb> $<$:rkcommon> $<$:glfw> diff --git a/superbuild/dependencies/dep_ispcrt.cmake b/superbuild/dependencies/dep_ispcrt.cmake deleted file mode 100644 index 24813326..00000000 --- a/superbuild/dependencies/dep_ispcrt.cmake +++ /dev/null @@ -1,48 +0,0 @@ -## Copyright 2022 Intel Corporation -## SPDX-License-Identifier: Apache-2.0 - -set(COMPONENT_NAME ispcrt) - -set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) -if (INSTALL_IN_SEPARATE_DIRECTORIES) - set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) -endif() - -string(REGEX REPLACE "(^[0-9]+\.[0-9]+\.[0-9]+$)" "v\\1" ISPCRT_ARCHIVE ${ISPC_VERSION}) - -ExternalProject_Add(ispcrt - PREFIX ${COMPONENT_NAME} - STAMP_DIR ${COMPONENT_NAME}/stamp - SOURCE_DIR ${COMPONENT_NAME}/src - BINARY_DIR ${COMPONENT_NAME}/build - SOURCE_SUBDIR "ispcrt" - - GIT_REPOSITORY https://github.com/ispc/ispc.git - GIT_TAG "main" - - LIST_SEPARATOR | - - CMAKE_ARGS - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_INSTALL_PREFIX:PATH=${COMPONENT_PATH} - -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} - -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} - -DCMAKE_INSTALL_DOCDIR=${CMAKE_INSTALL_DOCDIR} - -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} - -DCMAKE_BUILD_TYPE=${DEPENDENCIES_BUILD_TYPE} - -DISPCRT_BUILD_TASKING=OFF - -DISPCRT_BUILD_GPU=${BUILD_ISPCRT_GPU} - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} - BUILD_COMMAND ${DEFAULT_BUILD_COMMAND} - BUILD_ALWAYS ${ALWAYS_REBUILD} -) - -add_dependencies(ispcrt ispc) -ExternalProject_Add_StepTargets(${COMPONENT_NAME} configure ${COMPONENT_NAME}) - -list(APPEND CMAKE_PREFIX_PATH ${COMPONENT_PATH}) -string(REPLACE ";" "|" CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}") - -set(ispcrt_DIR "${COMPONENT_PATH}/lib/cmake/ispcrt-${ISPC_VERSION}") diff --git a/testing/apps/AppInit.cpp b/testing/apps/AppInit.cpp index dcbd6fc1..3208fa6b 100644 --- a/testing/apps/AppInit.cpp +++ b/testing/apps/AppInit.cpp @@ -39,14 +39,15 @@ void initializeOpenVKL() sycl::property::queue::in_order()}); // By default sycl queues are out // of order sycl::context syclContext = syclQueuePtr->get_context(); + sycl::device syclDevice = syclQueuePtr->get_device(); std::cout << std::endl << "Target SYCL device: " - << syclQueuePtr->get_device().get_info() - << std::endl + << syclDevice.get_info() << std::endl << std::endl; device = vklNewDevice("gpu"); vklDeviceSetVoidPtr( device, "syclContext", static_cast(&syclContext)); + vklDeviceSetVoidPtr(device, "syclDevice", static_cast(&syclDevice)); #endif #ifdef OPENVKL_TESTING_CPU device = vklNewDevice("cpu"); diff --git a/testing/apps/tests/multi_device.cpp b/testing/apps/tests/multi_device.cpp index b1fb464a..459f353c 100644 --- a/testing/apps/tests/multi_device.cpp +++ b/testing/apps/tests/multi_device.cpp @@ -169,6 +169,7 @@ TEST_CASE("Multiple devices", "[multi_device]") VKLDevice device = vklNewDevice("gpu"); vklDeviceSetVoidPtr( device, "syclContext", static_cast(&syclContext)); + vklDeviceSetVoidPtr(device, "syclDevice", static_cast(&syclDevice)); #else VKLDevice device = vklNewDevice("cpu"); #endif