From b0d9a5a5c81bd7b54e5f8f08e1d53bf37422ff6c Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Wed, 11 Mar 2026 11:36:22 -0700 Subject: [PATCH 1/2] opencl-cts: fix binaries being nested under cmakeBuildType --- pkgs/by-name/op/opencl-cts/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/op/opencl-cts/package.nix b/pkgs/by-name/op/opencl-cts/package.nix index e49e10599024..f60f6f2f683e 100644 --- a/pkgs/by-name/op/opencl-cts/package.nix +++ b/pkgs/by-name/op/opencl-cts/package.nix @@ -48,6 +48,11 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "OPENCL_LIBRARIES" "OpenCL") ]; + # Upstream installs to bin/$ (e.g. bin/Release/); flatten it. + postInstall = '' + mv "$out/bin/''${cmakeBuildType:-Release}"/* "$out"/bin/ + ''; + meta = { description = "OpenCL Conformance Test Suite"; homepage = "https://github.com/KhronosGroup/OpenCL-CTS"; From 4f3546d64b63daac7eb153d15a8baff7a46e4991 Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Wed, 11 Mar 2026 11:36:48 -0700 Subject: [PATCH 2/2] rocmPackages.clr: add impureTest that runs openctl-cts test_basic Replacement for AMD app samples opencl tests --- pkgs/development/rocm-modules/clr/default.nix | 6 +++- .../rocm-modules/clr/test-opencl-cts.nix | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/rocm-modules/clr/test-opencl-cts.nix diff --git a/pkgs/development/rocm-modules/clr/default.nix b/pkgs/development/rocm-modules/clr/default.nix index 8b76a12d9351..8592f361199b 100644 --- a/pkgs/development/rocm-modules/clr/default.nix +++ b/pkgs/development/rocm-modules/clr/default.nix @@ -263,11 +263,15 @@ stdenv.mkDerivation (finalAttrs: { }; impureTests = { + # bash $(nix-build -A rocmPackages.clr.impureTests.rocm-smi) rocm-smi = callPackage ./test-rocm-smi.nix { inherit rocm-smi; clr = finalAttrs.finalPackage; }; - # TODO(@LunNova): add OpenCL test with opencl-cts + # Simple subset of opencl-cts test_basic + opencl-cts = callPackage ./test-opencl-cts.nix { + clr = finalAttrs.finalPackage; + }; generic-arch = callPackage ./test-isa-compat.nix { clr = finalAttrs.finalPackage; name = "generic-arch"; diff --git a/pkgs/development/rocm-modules/clr/test-opencl-cts.nix b/pkgs/development/rocm-modules/clr/test-opencl-cts.nix new file mode 100644 index 000000000000..77929531f900 --- /dev/null +++ b/pkgs/development/rocm-modules/clr/test-opencl-cts.nix @@ -0,0 +1,28 @@ +{ + lib, + makeImpureTest, + opencl-cts, + clr, +}: + +makeImpureTest { + name = "opencl-cts"; + testedPackage = "rocmPackages.clr"; + + sandboxPaths = [ + "/sys" + "/dev/dri" + "/dev/kfd" + ]; + + nativeBuildInputs = [ opencl-cts ]; + OCL_ICD_VENDORS = "${clr.icd}/etc/OpenCL/vendors"; + + testScript = '' + test_basic arraycopy arrayreadwrite astype barrier vector_swizzle work_item_functions + ''; + + meta = { + teams = [ lib.teams.rocm ]; + }; +}