diff --git a/pkgs/by-name/in/intel-graphics-compiler/bump-cmake.patch b/pkgs/by-name/in/intel-compute-runtime-legacy1/bump-cmake.patch similarity index 100% rename from pkgs/by-name/in/intel-graphics-compiler/bump-cmake.patch rename to pkgs/by-name/in/intel-compute-runtime-legacy1/bump-cmake.patch diff --git a/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-allow-llvm-free-nonheap-object-warning.patch b/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-allow-llvm-free-nonheap-object-warning.patch new file mode 100644 index 000000000000..90cd81176d12 --- /dev/null +++ b/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-allow-llvm-free-nonheap-object-warning.patch @@ -0,0 +1,14 @@ +diff --git a/igc/IGC/common/LLVMWarningsPush.hpp b/igc/IGC/common/LLVMWarningsPush.hpp +index 12874dfcc2..38acd80943 100644 +--- a/igc/IGC/common/LLVMWarningsPush.hpp ++++ b/igc/IGC/common/LLVMWarningsPush.hpp +@@ -43,6 +43,9 @@ + #if __GNUC__ > 8 + #pragma GCC diagnostic ignored "-Winit-list-lifetime" + #endif ++#if __GNUC__ > 14 ++#pragma GCC diagnostic ignored "-Wfree-nonheap-object" ++#endif + #endif + + #if defined(_WIN32) || defined(_WIN64) diff --git a/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-llvm-header-fixes.patch b/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-llvm-header-fixes.patch new file mode 100644 index 000000000000..d0b0964f5748 --- /dev/null +++ b/pkgs/by-name/in/intel-compute-runtime-legacy1/gcc15-llvm-header-fixes.patch @@ -0,0 +1,13 @@ +diff --git a/llvm-project/llvm/include/llvm/Support/Threading.h b/llvm-project/llvm/include/llvm/Support/Threading.h +index ba6c531ab4..78aa5e7be5 100644 +--- a/llvm-project/llvm/include/llvm/Support/Threading.h ++++ b/llvm-project/llvm/include/llvm/Support/Threading.h +@@ -18,7 +18,7 @@ + #include "llvm/ADT/StringRef.h" + #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX + #include "llvm/Support/Compiler.h" +-#include // So we can check the C++ standard lib macros. ++#include // So we can check the C++ standard lib macros. + #include + + #if defined(_MSC_VER) diff --git a/pkgs/by-name/in/intel-compute-runtime-legacy1/intel-graphics-compiler.nix b/pkgs/by-name/in/intel-compute-runtime-legacy1/intel-graphics-compiler.nix new file mode 100644 index 000000000000..859ca5c54f5e --- /dev/null +++ b/pkgs/by-name/in/intel-compute-runtime-legacy1/intel-graphics-compiler.nix @@ -0,0 +1,156 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + ninja, + git, + bison, + flex, + zlib, + intel-compute-runtime, + python3, + spirv-tools, + spirv-headers, +}: + +let + llvmVersion = "16.0.6"; +in +stdenv.mkDerivation rec { + pname = "intel-graphics-compiler"; + version = "2.34.4"; + + # See the repository for expected versions: + # + srcs = [ + (fetchFromGitHub { + name = "igc"; + owner = "intel"; + repo = "intel-graphics-compiler"; + tag = "v${version}"; + hash = "sha256-w20nrn3wo9Dvv3BILYBzuJTTLXqcWaRAF7SiPtryhwk="; + }) + (fetchFromGitHub { + name = "llvm-project"; + owner = "llvm"; + repo = "llvm-project"; + tag = "llvmorg-${llvmVersion}"; + hash = "sha256-fspqSReX+VD+Nl/Cfq+tDcdPtnQPV1IRopNDfd5VtUs="; + }) + (fetchFromGitHub { + name = "vc-intrinsics"; + owner = "intel"; + repo = "vc-intrinsics"; + tag = "v0.25.0"; + hash = "sha256-ozc1w3V5RqWHwqNHuefZJMN8RAYxrJxH9bd1BEqxfiQ="; + }) + (fetchFromGitHub { + name = "opencl-clang"; + owner = "intel"; + repo = "opencl-clang"; + tag = "v16.0.11"; + hash = "sha256-ema1jTNMHs3pUituVb1NPllc6cA8eYJHtDOjuEzIDWM="; + }) + (fetchFromGitHub { + name = "llvm-spirv"; + owner = "KhronosGroup"; + repo = "SPIRV-LLVM-Translator"; + tag = "v16.0.24"; + hash = "sha256-aTcwfQt2WdOA44jfHdD7x7oxt8emSDexgZnI7MPVqvU="; + }) + ]; + + patches = [ + # Raise minimum CMake version to 3.5 + # https://github.com/intel/intel-graphics-compiler/commit/4f0123a7d67fb716b647f0ba5c1ab550abf2f97d + # https://github.com/intel/intel-graphics-compiler/pull/364 + ./bump-cmake.patch + + # Fix for GCC 15 by adding a previously-implicit `#include ` and + # replacing `` with `` in the the llvm directory. Based + # on https://github.com/intel/intel-graphics-compiler/pull/383. + ./gcc15-llvm-header-fixes.patch + + # Fix for GCC 15 by disabling `-Werror` for `-Wfree-nonheap-object` + # warnings within LLVM. This is in accordance with IGC disabling warnings + # that originate from within LLVM (see `IGC/common/LLVMWarningsPush.hpp`). + ./gcc15-allow-llvm-free-nonheap-object-warning.patch + ]; + + sourceRoot = "."; + + cmakeDir = "../igc"; + + postUnpack = '' + chmod -R +w . + mv opencl-clang llvm-spirv llvm-project/llvm/projects/ + ''; + + postPatch = '' + substituteInPlace igc/IGC/AdaptorOCL/igc-opencl.pc.in \ + --replace-fail '/@CMAKE_INSTALL_INCLUDEDIR@' "/include" \ + --replace-fail '/@CMAKE_INSTALL_LIBDIR@' "/lib" + + chmod +x igc/IGC/Scripts/igc_create_linker_script.sh + patchShebangs --build igc/IGC/Scripts/igc_create_linker_script.sh + + # The build system only applies patches when the sources are in a + # Git repository. + git -C llvm-project init + git -C llvm-project -c user.name=nixbld -c user.email= commit --allow-empty -m stub + substituteInPlace llvm-project/llvm/projects/opencl-clang/cmake/modules/CMakeFunctions.cmake \ + --replace-fail 'COMMAND ''${GIT_EXECUTABLE} am --3way --keep-non-patch --ignore-whitespace -C0 ' \ + 'COMMAND patch -p1 --ignore-whitespace -i ' + + # match default LLVM version with our provided version to apply correct patches + substituteInPlace igc/external/llvm/llvm_preferred_version.cmake \ + --replace-fail "16.0.6" "${llvmVersion}" + ''; + + nativeBuildInputs = [ + bison + cmake + flex + git + ninja + (python3.withPackages ( + ps: with ps; [ + mako + pyyaml + ] + )) + zlib + ]; + + buildInputs = [ + spirv-headers + spirv-tools + ]; + + strictDeps = true; + + # testing is done via intel-compute-runtime + doCheck = false; + + cmakeFlags = [ + "-DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds" + "-DIGC_OPTION__USE_PREINSTALLED_SPIRV_HEADERS=ON" + "-DSPIRV-Headers_INCLUDE_DIR=${spirv-headers}/include" + "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${spirv-headers.src}" + "-Wno-dev" + ]; + + passthru.tests = { + inherit intel-compute-runtime; + }; + + meta = { + description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware"; + homepage = "https://github.com/intel/intel-graphics-compiler"; + changelog = "https://github.com/intel/intel-graphics-compiler/releases/tag/v${version}"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ fleaz ]; + }; +} diff --git a/pkgs/by-name/in/intel-compute-runtime-legacy1/package.nix b/pkgs/by-name/in/intel-compute-runtime-legacy1/package.nix index 424f8fe55c47..b91c58a244d3 100644 --- a/pkgs/by-name/in/intel-compute-runtime-legacy1/package.nix +++ b/pkgs/by-name/in/intel-compute-runtime-legacy1/package.nix @@ -1,11 +1,11 @@ { lib, + callPackage, stdenv, fetchFromGitHub, cmake, pkg-config, intel-gmmlib, - intel-graphics-compiler, level-zero, libva, gitUpdater, @@ -13,6 +13,8 @@ let inherit (lib) cmakeBool; + # intel-graphics-compiler >= 2.36 does no longer support 8th Gen + intel-graphics-compiler = callPackage ./intel-graphics-compiler.nix { }; in stdenv.mkDerivation (finalAttrs: { # https://github.com/intel/compute-runtime/blob/master/LEGACY_PLATFORMS.md diff --git a/pkgs/by-name/in/intel-graphics-compiler/package.nix b/pkgs/by-name/in/intel-graphics-compiler/package.nix index 3c0a5c6c5eaf..99398395bf78 100644 --- a/pkgs/by-name/in/intel-graphics-compiler/package.nix +++ b/pkgs/by-name/in/intel-graphics-compiler/package.nix @@ -11,15 +11,28 @@ intel-compute-runtime, python3, spirv-tools, - spirv-headers, }: let - llvmVersion = "16.0.6"; + llvmVersion = "17.0.6"; + + spirv-headers = stdenv.mkDerivation { + pname = "spirv-headers"; + version = "1.4.341.0-unstable-2026-04-29"; + + src = fetchFromGitHub { + owner = "KhronosGroup"; + repo = "SPIRV-Headers"; + rev = "b8a32968473ce852a809b9de5f04f02a5a9dfa78"; + hash = "sha256-k5lAF7TxJ+8cXDnx7lQxG/3IjSTzYcqBl5PYY2gv9E8="; + }; + + nativeBuildInputs = [ cmake ]; + }; in stdenv.mkDerivation rec { pname = "intel-graphics-compiler"; - version = "2.34.4"; + version = "2.36.3"; # See the repository for expected versions: # @@ -29,14 +42,14 @@ stdenv.mkDerivation rec { owner = "intel"; repo = "intel-graphics-compiler"; tag = "v${version}"; - hash = "sha256-w20nrn3wo9Dvv3BILYBzuJTTLXqcWaRAF7SiPtryhwk="; + hash = "sha256-0GzZQECcngF9b5lZyeIKXeM6w64WzCYFtHOobQKN80o="; }) (fetchFromGitHub { name = "llvm-project"; owner = "llvm"; repo = "llvm-project"; tag = "llvmorg-${llvmVersion}"; - hash = "sha256-fspqSReX+VD+Nl/Cfq+tDcdPtnQPV1IRopNDfd5VtUs="; + hash = "sha256-8MEDLLhocshmxoEBRSKlJ/GzJ8nfuzQ8qn0X/vLA+ag="; }) (fetchFromGitHub { name = "vc-intrinsics"; @@ -49,24 +62,19 @@ stdenv.mkDerivation rec { name = "opencl-clang"; owner = "intel"; repo = "opencl-clang"; - tag = "v16.0.11"; - hash = "sha256-ema1jTNMHs3pUituVb1NPllc6cA8eYJHtDOjuEzIDWM="; + tag = "v17.0.7"; + hash = "sha256-7kQlH1Y4pnNvj/CS2qAVbYUl9FQWBuMew7i8CpORfKE="; }) (fetchFromGitHub { name = "llvm-spirv"; owner = "KhronosGroup"; repo = "SPIRV-LLVM-Translator"; - tag = "v16.0.24"; - hash = "sha256-aTcwfQt2WdOA44jfHdD7x7oxt8emSDexgZnI7MPVqvU="; + tag = "v17.0.24"; + hash = "sha256-s/dNWmT3KXdXK0CSVjqEfsY9r8ONAGMZ5KUy9FeqF0E="; }) ]; patches = [ - # Raise minimum CMake version to 3.5 - # https://github.com/intel/intel-graphics-compiler/commit/4f0123a7d67fb716b647f0ba5c1ab550abf2f97d - # https://github.com/intel/intel-graphics-compiler/pull/364 - ./bump-cmake.patch - # Fix for GCC 15 by adding a previously-implicit `#include ` and # replacing `` with `` in the the llvm directory. Based # on https://github.com/intel/intel-graphics-compiler/pull/383.