diff --git a/pkgs/development/compilers/adaptivecpp/default.nix b/pkgs/development/compilers/adaptivecpp/default.nix index 6cb32e3e92d2..dc5f69e71e9c 100644 --- a/pkgs/development/compilers/adaptivecpp/default.nix +++ b/pkgs/development/compilers/adaptivecpp/default.nix @@ -2,7 +2,6 @@ lib, fetchFromGitHub, llvmPackages_17, - lld_17, python3, cmake, boost, @@ -18,23 +17,40 @@ cudaSupport ? config.cudaSupport, autoAddDriverRunpath, callPackage, + symlinkJoin, nix-update-script, }: let inherit (llvmPackages) stdenv; rocmPackages = rocmPackages_6; llvmPackages = llvmPackages_17; - lld = lld_17; in stdenv.mkDerivation (finalAttrs: { pname = "adaptivecpp"; - version = "24.06.0"; + version = "24.10.0"; src = fetchFromGitHub { owner = "AdaptiveCpp"; repo = "AdaptiveCpp"; rev = "v${finalAttrs.version}"; - sha256 = "sha256-TPa2DT66bGQ9VfSXaFUDuE5ng5x5fiLC2bqQ+ZVo9LQ="; + sha256 = "sha256-ZwHDiwv1ybC+2UhiOe2f7fnfqcul+CD9Uta8PT9ICr4="; + }; + + # we may be able to get away with just wrapping hipcc and nothing more + # this is mainly so that if acpp tries doing /../amdgcn/bitcode + rocmMerged = symlinkJoin { + name = "rocm-merged"; + paths = with rocmPackages; [ + clr + rocm-core + rocm-device-libs + rocm-runtime + ]; + buildInputs = [ makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/hipcc \ + --add-flags "--rocm-device-lib-path=$out/amdgcn/bitcode" + ''; }; nativeBuildInputs = @@ -57,23 +73,24 @@ stdenv.mkDerivation (finalAttrs: { llvmPackages.libclang.dev llvmPackages.llvm ] - ++ lib.optionals rocmSupport [ - rocmPackages.clr - rocmPackages.rocm-runtime - ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart (lib.getOutput "stubs" cudaPackages.cuda_cudart) ]; # adaptivecpp makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually - cmakeFlags = [ - "-DCLANG_INCLUDE_PATH=${llvmPackages.libclang.dev}/include" - (lib.cmakeBool "WITH_CPU_BACKEND" ompSupport) - (lib.cmakeBool "WITH_CUDA_BACKEND" cudaSupport) - (lib.cmakeBool "WITH_ROCM_BACKEND" rocmSupport) - (lib.cmakeBool "WITH_OPENCL_BACKEND" openclSupport) - ]; + cmakeFlags = + [ + "-DCLANG_INCLUDE_PATH=${llvmPackages.libclang.dev}/include" + (lib.cmakeBool "WITH_CPU_BACKEND" ompSupport) + (lib.cmakeBool "WITH_CUDA_BACKEND" cudaSupport) + (lib.cmakeBool "WITH_ROCM_BACKEND" rocmSupport) + (lib.cmakeBool "WITH_OPENCL_BACKEND" openclSupport) + ] + ++ lib.optionals rocmSupport [ + "-DHIPCC_COMPILER=${finalAttrs.rocmMerged}/bin/hipcc" + "-DROCM_PATH=${finalAttrs.rocmMerged}" + ]; # this hardening option breaks rocm builds hardeningDisable = [ "zerocallusedregs" ]; @@ -92,6 +109,7 @@ stdenv.mkDerivation (finalAttrs: { meta = with lib; { homepage = "https://github.com/AdaptiveCpp/AdaptiveCpp"; description = "Multi-backend implementation of SYCL for CPUs and GPUs"; + mainProgram = "acpp"; maintainers = with maintainers; [ yboettcher ]; license = licenses.bsd2; };