9 , intel-compute-runtime
15 , spirv-llvm-translator
17 , buildWithPatches ? true
21 vc_intrinsics_src = fetchFromGitHub {
23 repo = "vc-intrinsics";
25 hash = "sha256-vOK7xfOR+aDpdGd8oOFLJc1Ct1S5BCJmLN6Ubn5wlkQ=";
28 inherit (llvmPackages_14) lld llvm;
29 inherit (if buildWithPatches then opencl-clang else llvmPackages_14) clang libclang;
30 spirv-llvm-translator' = spirv-llvm-translator.override { inherit llvm; };
33 stdenv.mkDerivation rec {
34 pname = "intel-graphics-compiler";
35 version = "1.0.17384.11";
37 src = fetchFromGitHub {
39 repo = "intel-graphics-compiler";
40 rev = "igc-${version}";
41 hash = "sha256-O4uMaPauRv2aMgM2B7XdzCcjI5JghsjX5XbkeloLyck=";
45 substituteInPlace IGC/AdaptorOCL/igc-opencl.pc.in \
46 --replace-fail '/@CMAKE_INSTALL_INCLUDEDIR@' "/include" \
47 --replace-fail '/@CMAKE_INSTALL_LIBDIR@' "/lib"
49 chmod +x IGC/Scripts/igc_create_linker_script.sh
50 patchShebangs --build IGC/Scripts/igc_create_linker_script.sh
53 nativeBuildInputs = [ bash bison cmake flex (python3.withPackages (ps : with ps; [ mako pyyaml ])) ];
55 buildInputs = [ lld llvm spirv-headers spirv-llvm-translator' spirv-tools ];
59 # testing is done via intel-compute-runtime
62 # Handholding the braindead build script
63 # cmake requires an absolute path
64 prebuilds = runCommandLocal "igc-cclang-prebuilds" { } ''
66 ln -s ${clang}/bin/clang $out/
67 ln -s ${opencl-clang}/lib/* $out/
68 ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c.h $out/
69 ln -s ${lib.getLib libclang}/lib/clang/${lib.getVersion clang}/include/opencl-c-base.h $out/
73 "-DVC_INTRINSICS_SRC=${vc_intrinsics_src}"
74 "-DCCLANG_BUILD_PREBUILDS=ON"
75 "-DCCLANG_BUILD_PREBUILDS_DIR=${prebuilds}"
76 "-DIGC_OPTION__SPIRV_TOOLS_MODE=Prebuilds"
77 "-DIGC_OPTION__VC_INTRINSICS_MODE=Source"
82 inherit intel-compute-runtime;
86 description = "LLVM-based compiler for OpenCL targeting Intel Gen graphics hardware";
87 homepage = "https://github.com/intel/intel-graphics-compiler";
88 changelog = "https://github.com/intel/intel-graphics-compiler/releases/tag/${src.rev}";
89 license = licenses.mit;
90 platforms = platforms.linux;
91 maintainers = with maintainers; [ SuperSandro2000 ];