Merge pull request #257354 from SuperSandro2000/intel-graphics-compiler
intel-graphics-compiler: 1.0.12812.26 -> 1.0.14828.8
This commit is contained in:
commit
71f3ef26f2
|
@ -5,7 +5,7 @@
|
||||||
, runCommandLocal
|
, runCommandLocal
|
||||||
, bison
|
, bison
|
||||||
, flex
|
, flex
|
||||||
, llvmPackages_11
|
, llvmPackages_14
|
||||||
, opencl-clang
|
, opencl-clang
|
||||||
, python3
|
, python3
|
||||||
, spirv-tools
|
, spirv-tools
|
||||||
|
@ -19,32 +19,29 @@ let
|
||||||
vc_intrinsics_src = fetchFromGitHub {
|
vc_intrinsics_src = fetchFromGitHub {
|
||||||
owner = "intel";
|
owner = "intel";
|
||||||
repo = "vc-intrinsics";
|
repo = "vc-intrinsics";
|
||||||
rev = "v0.11.0";
|
rev = "v0.13.0";
|
||||||
sha256 = "sha256-74JBW7qU8huSqwqgxNbvbGj1DlJJThgGhb3owBYmhvI=";
|
hash = "sha256-A9G1PH0WGdxU2u/ODrou53qF9kvrmE0tJSl9cFIOus0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
llvmPkgs = llvmPackages_11 // {
|
inherit (llvmPackages_14) lld llvm;
|
||||||
spirv-llvm-translator = spirv-llvm-translator.override { llvm = llvm; };
|
inherit (if buildWithPatches then opencl-clang else llvmPackages_14) clang libclang;
|
||||||
} // lib.optionalAttrs buildWithPatches opencl-clang;
|
spirv-llvm-translator' = spirv-llvm-translator.override { inherit llvm; };
|
||||||
|
|
||||||
inherit (llvmPackages_11) lld llvm;
|
|
||||||
inherit (llvmPkgs) clang libclang spirv-llvm-translator;
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "intel-graphics-compiler";
|
pname = "intel-graphics-compiler";
|
||||||
version = "1.0.12812.26";
|
version = "1.0.14828.8";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "intel";
|
owner = "intel";
|
||||||
repo = "intel-graphics-compiler";
|
repo = "intel-graphics-compiler";
|
||||||
rev = "igc-${version}";
|
rev = "igc-${version}";
|
||||||
sha256 = "sha256-KpaDaDYVp40H7OscDGUpzEMgIOIk397ANi+8sDk4Wow=";
|
hash = "sha256-BGmZVBEw7XlgbQcWgRK+qbJS9U4Sm9G8g9m0GRUhmCI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake bison flex python3 ];
|
nativeBuildInputs = [ bison cmake flex python3 ];
|
||||||
|
|
||||||
buildInputs = [ spirv-headers spirv-tools spirv-llvm-translator llvm lld ];
|
buildInputs = [ lld llvm spirv-headers spirv-llvm-translator' spirv-tools ];
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
|
@ -52,15 +49,6 @@ stdenv.mkDerivation rec {
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace external/SPIRV-Tools/CMakeLists.txt \
|
|
||||||
--replace '$'''{SPIRV-Tools_DIR}../../..' \
|
|
||||||
'${spirv-tools}' \
|
|
||||||
--replace 'SPIRV-Headers_INCLUDE_DIR "/usr/include"' \
|
|
||||||
'SPIRV-Headers_INCLUDE_DIR "${spirv-headers}/include"' \
|
|
||||||
--replace 'set_target_properties(SPIRV-Tools' \
|
|
||||||
'set_target_properties(SPIRV-Tools-shared' \
|
|
||||||
--replace 'IGC_BUILD__PROJ__SPIRV-Tools SPIRV-Tools' \
|
|
||||||
'IGC_BUILD__PROJ__SPIRV-Tools SPIRV-Tools-shared'
|
|
||||||
substituteInPlace IGC/AdaptorOCL/igc-opencl.pc.in \
|
substituteInPlace IGC/AdaptorOCL/igc-opencl.pc.in \
|
||||||
--replace '/@CMAKE_INSTALL_INCLUDEDIR@' "/include" \
|
--replace '/@CMAKE_INSTALL_INCLUDEDIR@' "/include" \
|
||||||
--replace '/@CMAKE_INSTALL_LIBDIR@' "/lib"
|
--replace '/@CMAKE_INSTALL_LIBDIR@' "/lib"
|
||||||
|
@ -71,24 +59,20 @@ stdenv.mkDerivation rec {
|
||||||
prebuilds = runCommandLocal "igc-cclang-prebuilds" { } ''
|
prebuilds = runCommandLocal "igc-cclang-prebuilds" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
ln -s ${clang}/bin/clang $out/
|
ln -s ${clang}/bin/clang $out/
|
||||||
ln -s clang $out/clang-${lib.versions.major (lib.getVersion clang)}
|
|
||||||
ln -s ${opencl-clang}/lib/* $out/
|
ln -s ${opencl-clang}/lib/* $out/
|
||||||
ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c.h $out/
|
ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c.h $out/
|
||||||
ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c-base.h $out/
|
ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c-base.h $out/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-Wno-dev"
|
|
||||||
"-DVC_INTRINSICS_SRC=${vc_intrinsics_src}"
|
"-DVC_INTRINSICS_SRC=${vc_intrinsics_src}"
|
||||||
"-DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds"
|
|
||||||
"-DCCLANG_BUILD_PREBUILDS=ON"
|
"-DCCLANG_BUILD_PREBUILDS=ON"
|
||||||
"-DCCLANG_BUILD_PREBUILDS_DIR=${prebuilds}"
|
"-DCCLANG_BUILD_PREBUILDS_DIR=${prebuilds}"
|
||||||
"-DIGC_PREFERRED_LLVM_VERSION=${lib.getVersion llvm}"
|
"-DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds"
|
||||||
|
"-DIGC_OPTION__VC_INTRINSICS_MODE=Source"
|
||||||
|
"-Wno-dev"
|
||||||
];
|
];
|
||||||
|
|
||||||
# causes redefinition of _FORTIFY_SOURCE
|
|
||||||
hardeningDisable = [ "fortify3" ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/intel/intel-graphics-compiler";
|
homepage = "https://github.com/intel/intel-graphics-compiler";
|
||||||
description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware";
|
description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware";
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
|
, applyPatches
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, cmake
|
, cmake
|
||||||
, git
|
, git
|
||||||
, llvmPackages_11
|
, llvmPackages_14
|
||||||
, spirv-llvm-translator
|
, spirv-llvm-translator
|
||||||
, buildWithPatches ? true
|
, buildWithPatches ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
llvmPkgs = llvmPackages_11 // {
|
|
||||||
inherit spirv-llvm-translator;
|
|
||||||
};
|
|
||||||
|
|
||||||
addPatches = component: pkg: pkg.overrideAttrs (oldAttrs: {
|
addPatches = component: pkg: pkg.overrideAttrs (oldAttrs: {
|
||||||
postPatch = oldAttrs.postPatch or "" + ''
|
postPatch = oldAttrs.postPatch or "" + ''
|
||||||
for p in ${passthru.patchesOut}/${component}/*; do
|
for p in ${passthru.patchesOut}/${component}/*; do
|
||||||
|
@ -22,8 +19,13 @@ let
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
llvmPkgs = llvmPackages_14;
|
||||||
|
inherit (llvmPkgs) llvm;
|
||||||
|
spirv-llvm-translator' = spirv-llvm-translator.override { inherit llvm; };
|
||||||
|
libclang = if buildWithPatches then passthru.libclang else llvmPkgs.libclang;
|
||||||
|
|
||||||
passthru = rec {
|
passthru = rec {
|
||||||
spirv-llvm-translator = llvmPkgs.spirv-llvm-translator.override { llvm = llvmPackages_11.llvm; };
|
spirv-llvm-translator = spirv-llvm-translator';
|
||||||
llvm = addPatches "llvm" llvmPkgs.llvm;
|
llvm = addPatches "llvm" llvmPkgs.llvm;
|
||||||
libclang = addPatches "clang" llvmPkgs.libclang;
|
libclang = addPatches "clang" llvmPkgs.libclang;
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ let
|
||||||
|
|
||||||
patchesOut = stdenv.mkDerivation {
|
patchesOut = stdenv.mkDerivation {
|
||||||
pname = "opencl-clang-patches";
|
pname = "opencl-clang-patches";
|
||||||
inherit (library) version src patches;
|
inherit version src;
|
||||||
# Clang patches assume the root is the llvm root dir
|
# Clang patches assume the root is the llvm root dir
|
||||||
# but clang root in nixpkgs is the clang sub-directory
|
# but clang root in nixpkgs is the clang sub-directory
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -52,56 +54,66 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
library = let
|
version = "unstable-2023-06-12";
|
||||||
inherit (llvmPackages_11) llvm;
|
src = applyPatches {
|
||||||
inherit (if buildWithPatches then passthru else llvmPkgs) libclang spirv-llvm-translator;
|
src = fetchFromGitHub {
|
||||||
in
|
owner = "intel";
|
||||||
stdenv.mkDerivation {
|
repo = "opencl-clang";
|
||||||
pname = "opencl-clang";
|
# https://github.com/intel/opencl-clang/compare/ocl-open-140
|
||||||
version = "unstable-2022-03-16";
|
rev = "cf95b338d14685e4f3402ab1828bef31d48f1fd6";
|
||||||
|
hash = "sha256-To1RlQX9IJ+1zAwEXaW7ua3VNfjK9mu7pgsRPsfa8g8=";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "intel";
|
|
||||||
repo = "opencl-clang";
|
|
||||||
rev = "bbdd1587f577397a105c900be114b56755d1f7dc";
|
|
||||||
sha256 = "sha256-qEZoQ6h4XAvSnJ7/gLXBb1qrzeYa6Jp6nij9VFo8MwQ=";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
# Build script tries to find Clang OpenCL headers under ${llvm}
|
|
||||||
# Work around it by specifying that directory manually.
|
|
||||||
./opencl-headers-dir.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
# Uses linker flags that are not supported on Darwin.
|
|
||||||
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
||||||
sed -i -e '/SET_LINUX_EXPORTS_FILE/d' CMakeLists.txt
|
|
||||||
substituteInPlace CMakeLists.txt \
|
|
||||||
--replace '-Wl,--no-undefined' ""
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake git llvm.dev ];
|
|
||||||
|
|
||||||
buildInputs = [ libclang llvm spirv-llvm-translator ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DPREFERRED_LLVM_VERSION=${lib.getVersion llvm}"
|
|
||||||
"-DOPENCL_HEADERS_DIR=${libclang.lib}/lib/clang/${lib.getVersion libclang}/include/"
|
|
||||||
|
|
||||||
"-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF"
|
|
||||||
"-DSPIRV_TRANSLATOR_DIR=${spirv-llvm-translator}"
|
|
||||||
];
|
|
||||||
|
|
||||||
inherit passthru;
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
homepage = "https://github.com/intel/opencl-clang/";
|
|
||||||
description = "A clang wrapper library with an OpenCL-oriented API and the ability to compile OpenCL C kernels to SPIR-V modules";
|
|
||||||
license = licenses.ncsa;
|
|
||||||
platforms = platforms.all;
|
|
||||||
maintainers = with maintainers; [ ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# Build script tries to find Clang OpenCL headers under ${llvm}
|
||||||
|
# Work around it by specifying that directory manually.
|
||||||
|
./opencl-headers-dir.patch
|
||||||
|
|
||||||
|
# fix CMake throwing errors
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/intel/opencl-clang/commit/321e3b99c1a8d54c8475f5ae998452069cc5eb71.patch";
|
||||||
|
hash = "sha256-cATbH+AMVtcabhl3EkzAH7w3wGreUV53hQYHVUUEP4g=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
# fix not be able to find clang from PATH
|
||||||
|
substituteInPlace cl_headers/CMakeLists.txt \
|
||||||
|
--replace " NO_DEFAULT_PATH" ""
|
||||||
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
|
# Uses linker flags that are not supported on Darwin.
|
||||||
|
sed -i -e '/SET_LINUX_EXPORTS_FILE/d' CMakeLists.txt
|
||||||
|
substituteInPlace CMakeLists.txt \
|
||||||
|
--replace '-Wl,--no-undefined' ""
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
library
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "opencl-clang";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake git llvm.dev ];
|
||||||
|
|
||||||
|
buildInputs = [ libclang llvm spirv-llvm-translator' ];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DPREFERRED_LLVM_VERSION=${lib.getVersion llvm}"
|
||||||
|
"-DOPENCL_HEADERS_DIR=${libclang.lib}/lib/clang/${lib.getVersion libclang}/include/"
|
||||||
|
|
||||||
|
"-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF"
|
||||||
|
"-DSPIRV_TRANSLATOR_DIR=${spirv-llvm-translator'}"
|
||||||
|
];
|
||||||
|
|
||||||
|
inherit passthru;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://github.com/intel/opencl-clang/";
|
||||||
|
description = "A clang wrapper library with an OpenCL-oriented API and the ability to compile OpenCL C kernels to SPIR-V modules";
|
||||||
|
license = licenses.ncsa;
|
||||||
|
maintainers = with maintainers; [ ];
|
||||||
|
platforms = platforms.all;
|
||||||
|
# error: invalid value 'CL3.0' in '-cl-std=CL3.0'
|
||||||
|
broken = stdenv.isDarwin;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue