From 1742313d1005466d2932326ccb5ed1108a3f6d31 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 11 Mar 2024 23:28:06 +0100 Subject: [PATCH 1/2] spirv-llvm-translator: add llvm 18 support --- .../compilers/spirv-llvm-translator/default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/spirv-llvm-translator/default.nix b/pkgs/development/compilers/spirv-llvm-translator/default.nix index 88119d002808..80e4620c7dc6 100644 --- a/pkgs/development/compilers/spirv-llvm-translator/default.nix +++ b/pkgs/development/compilers/spirv-llvm-translator/default.nix @@ -16,7 +16,11 @@ let # ROCm, if actively updated will always be at the latest version branch = - if llvmMajor == "17" || isROCm then rec { + if llvmMajor == "18" then rec { + version = "18.1.0"; + rev = "v${version}"; + hash = "sha256-64guZiuO7VpaX01wNIjV7cnjEAe6ineMdY44S6sA33k="; + } else if llvmMajor == "17" || isROCm then rec { version = "17.0.0"; rev = "v${version}"; hash = "sha256-Rzm5Py9IPFtS9G7kME+uSwZ/0gPGW6MlL35ZWk4LfHM="; @@ -48,7 +52,15 @@ disable-warnings-if-gcc13 (stdenv.mkDerivation { inherit (branch) rev hash; }; - patches = lib.optionals (lib.versionAtLeast llvmMajor "15") [ + patches = lib.optionals (llvmMajor == "18") [ + # Fixes build after SPV_INTEL_maximum_registers breaking change + # TODO: remove on next spirv-headers release + (fetchpatch { + url = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/d970c9126c033ebcbb7187bc705eae2e54726b74.patch"; + revert = true; + hash = "sha256-71sJuGqVjTcB549eIiCO0LoqAgxkdEHCoxh8Pd/Qzz8="; + }) + ] ++ lib.optionals (lib.versionAtLeast llvmMajor "15" && lib.versionOlder llvmMajor "18") [ # Fixes build after spirv-headers breaking change (fetchpatch { url = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/0166a0fb86dc6c0e8903436bbc3a89bc3273ebc0.patch"; From c9f6ba9f182f75c5475bf71313f70f37546e3190 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 11 Mar 2024 23:28:21 +0100 Subject: [PATCH 2/2] llvmPackages_git.libclc: init --- pkgs/development/compilers/llvm/git/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 1efaa0402fc7..e8a9089035c3 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -274,6 +274,12 @@ in let nixSupport.cc-cflags = [ "-fno-exceptions" ]; }); + # Has to be in tools despite mostly being a library, + # because we use a native helper executable from a + # non-cross build in cross builds. + libclc = callPackage ../common/libclc.nix { + inherit buildLlvmTools; + }; }); libraries = lib.makeExtensible (libraries: let