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-sycl = callPackage ./test/compilers/hello-sycl.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 { };
asan = callPackage ./test/compilers/asan.nix { };
intel2023-icx-c = hello-c.override { stdenv = final.intelPackages_2023.stdenv; };

View File

@ -2,6 +2,7 @@
intelPackages,
writeText,
strace,
pocl,
}:
let
@ -35,10 +36,10 @@ let
'';
in
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
version = "0.0.1";
name = "hello-sycl";
buildInputs = [
nativeBuildInputs = [
stdenv
strace
];
@ -52,11 +53,27 @@ stdenv.mkDerivation {
echo CXX=$CXX
command -v $CXX
$CXX -fsycl hello.cpp -o hello
./hello
./hello | tee test-output
set +x
'';
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
intelPackages.stdenv.mkDerivation {
intelPackages.stdenv.mkDerivation (finalAttrs: {
version = "0.0.1";
name = "hello-syclompss";
@ -47,10 +47,11 @@ intelPackages.stdenv.mkDerivation {
strace
nodes
nosv
pocl
];
env = {
passthru.withPocl = finalAttrs.finalPackage.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pocl ];
env = (old.env or { }) // {
POCL_DEBUG = "error,warn";
POCL_CACHE_DIR = "/build/pocl_cache";
@ -58,6 +59,11 @@ intelPackages.stdenv.mkDerivation {
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
'';
});
dontUnpack = true;
dontConfigure = true;
@ -82,11 +88,11 @@ intelPackages.stdenv.mkDerivation {
$NODES_HOME/lib/nodes-main-wrapper.o \
hello.cpp -o hello
./hello
./hello | tee test-output
set +x
'';
installPhase = ''
touch $out
cp test-output $out
'';
}
})