Add aocc compiler

This commit is contained in:
Aleix Boné 2025-06-19 22:16:04 +02:00
parent 1375a068a0
commit 0994be3b93
No known key found for this signature in database
3 changed files with 72 additions and 0 deletions

View File

@ -9,6 +9,9 @@ let
bscPkgs = {
agenix = prev.callPackage ./pkgs/agenix/default.nix { };
amd-uprof = prev.callPackage ./pkgs/amd-uprof/default.nix { };
aoccUnwrapped = callPackage ./pkgs/aocc/unwrapped.nix { };
aocc = callPackage ./pkgs/aocc/default.nix { };
stdenvAocc = final.overrideCC final.stdenv final.aocc;
bench6 = callPackage ./pkgs/bench6/default.nix { };
bigotes = callPackage ./pkgs/bigotes/default.nix { };
clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { };

17
pkgs/aocc/default.nix Normal file
View File

@ -0,0 +1,17 @@
{
wrapCCWith,
aoccUnwrapped,
}:
let
cc = aoccUnwrapped;
in
wrapCCWith {
inherit cc;
nixSupport.cc-cflags = [ "-isystem ${cc}/include" ];
extraBuildCommands = ''
wrap aocc $wrapper $ccPath/clang
wrap aocc++ $wrapper $ccPath/clang++
'';
}

52
pkgs/aocc/unwrapped.nix Normal file
View File

@ -0,0 +1,52 @@
{
lib,
fetchurl,
stdenv,
autoPatchelfHook,
rocmPackages,
zlib,
libffi,
elfutils,
}:
let
# in newer nixpkgs the runtime is hsakmt
rocmRuntime = if rocmPackages ? hsakmt then rocmPackages.hsakmt else rocmPackages.rocm-runtime;
in
stdenv.mkDerivation {
pname = "aocc-compiler";
version = "5.0.0";
src = fetchurl {
url = "https://download.amd.com/developer/eula/aocc/aocc-5-0/aocc-compiler-5.0.0.tar";
sha256 = "sha256-lm+sLSx1np3m6WnBCtp6ezBsET9/HgfqN2gp7IY4Dao=";
};
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
elfutils
zlib
rocmRuntime
stdenv.cc.cc.lib
];
phases = [
"unpackPhase"
"installPhase"
"fixupPhase"
];
dontStrip = true;
installPhase = ''
mkdir -p $out
cp -a . $out/
ln -s ${lib.getLib libffi}/lib/libffi.so $out/lib/libffi.so.6
'';
passthru = {
inherit rocmRuntime;
isClang = true; # Needed for wrapCCWith
};
meta.mainProgram = "clang";
}