Add test to run sycl applications with PoCL

This commit is contained in:
Aleix Boné 2025-12-10 18:52:11 +01:00
parent 54a583dcfa
commit 9991207323
No known key found for this signature in database
3 changed files with 43 additions and 17 deletions

View File

@ -82,6 +82,9 @@ let
hello-cpp = callPackage ./test/compilers/hello-cpp.nix { }; hello-cpp = callPackage ./test/compilers/hello-cpp.nix { };
hello-sycl = callPackage ./test/compilers/hello-sycl.nix { }; hello-sycl = callPackage ./test/compilers/hello-sycl.nix { };
hello-syclompss = callPackage ./test/compilers/icpx-ompss2.nix { }; hello-syclompss = callPackage ./test/compilers/icpx-ompss2.nix { };
hello-sycl-pocl = (callPackage ./test/compilers/hello-sycl.nix { }).withPocl;
hello-syclompss-pocl = (callPackage ./test/compilers/icpx-ompss2.nix { }).withPocl;
lto = callPackage ./test/compilers/lto.nix { }; lto = callPackage ./test/compilers/lto.nix { };
asan = callPackage ./test/compilers/asan.nix { }; asan = callPackage ./test/compilers/asan.nix { };
intel2023-icx-c = hello-c.override { stdenv = final.intelPackages_2023.stdenv; }; intel2023-icx-c = hello-c.override { stdenv = final.intelPackages_2023.stdenv; };

View File

@ -2,6 +2,7 @@
intelPackages, intelPackages,
writeText, writeText,
strace, strace,
pocl,
}: }:
let let
@ -35,10 +36,10 @@ let
''; '';
in in
stdenv.mkDerivation { stdenv.mkDerivation (finalAttrs: {
version = "0.0.1"; version = "0.0.1";
name = "hello-sycl"; name = "hello-sycl";
buildInputs = [ nativeBuildInputs = [
stdenv stdenv
strace strace
]; ];
@ -52,11 +53,27 @@ stdenv.mkDerivation {
echo CXX=$CXX echo CXX=$CXX
command -v $CXX command -v $CXX
$CXX -fsycl hello.cpp -o hello $CXX -fsycl hello.cpp -o hello
./hello ./hello | tee test-output
set +x set +x
''; '';
installPhase = '' installPhase = ''
touch $out cp test-output $out
''; '';
}
passthru.withPocl = finalAttrs.finalPackage.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pocl ];
env = (old.env or { }) // {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
# Make PoCL report Intel vendor id so oneapi SYCL works
POCL_DRIVER_VERSION_OVERRIDE = "2024.18.6.0.02_160000";
POCL_CPU_VENDOR_ID_OVERRIDE = 32902;
};
doInstallCheck = true;
installCheckPhase = ''
grep "Hello World! (on device)" $out
'';
});
})

View File

@ -37,7 +37,7 @@ let
''; '';
in in
intelPackages.stdenv.mkDerivation { intelPackages.stdenv.mkDerivation (finalAttrs: {
version = "0.0.1"; version = "0.0.1";
name = "hello-syclompss"; name = "hello-syclompss";
@ -47,17 +47,23 @@ intelPackages.stdenv.mkDerivation {
strace strace
nodes nodes
nosv nosv
pocl
]; ];
env = { passthru.withPocl = finalAttrs.finalPackage.overrideAttrs (old: {
POCL_DEBUG = "error,warn"; nativeBuildInputs = old.nativeBuildInputs ++ [ pocl ];
POCL_CACHE_DIR = "/build/pocl_cache"; env = (old.env or { }) // {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
# Make PoCL report Intel vendor id so oneapi SYCL works # Make PoCL report Intel vendor id so oneapi SYCL works
POCL_DRIVER_VERSION_OVERRIDE = "2024.18.6.0.02_160000"; POCL_DRIVER_VERSION_OVERRIDE = "2024.18.6.0.02_160000";
POCL_CPU_VENDOR_ID_OVERRIDE = 32902; POCL_CPU_VENDOR_ID_OVERRIDE = 32902;
}; };
doInstallCheck = true;
installCheckPhase = ''
grep "Hello World! (on device)" $out
'';
});
dontUnpack = true; dontUnpack = true;
dontConfigure = true; dontConfigure = true;
@ -82,11 +88,11 @@ intelPackages.stdenv.mkDerivation {
$NODES_HOME/lib/nodes-main-wrapper.o \ $NODES_HOME/lib/nodes-main-wrapper.o \
hello.cpp -o hello hello.cpp -o hello
./hello ./hello | tee test-output
set +x set +x
''; '';
installPhase = '' installPhase = ''
touch $out cp test-output $out
''; '';
} })