From 2c9d3c5c3558c04689a774458a93cc8a27d26da3 Mon Sep 17 00:00:00 2001 From: Mirza Arnaut Date: Fri, 20 Dec 2024 02:27:09 +0100 Subject: [PATCH] Try to build dpcpp open-source version --- flake.lock | 68 ++++++++++++++-------------- pkgs/default.nix | 1 + pkgs/dpcpp/default.nix | 91 ++++++++++++++++++++++++++++++++++++++ pkgs/dpcpp/proprietary.nix | 72 ++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+), 34 deletions(-) create mode 100644 pkgs/dpcpp/default.nix create mode 100644 pkgs/dpcpp/proprietary.nix diff --git a/flake.lock b/flake.lock index 0926448..09fabd3 100644 --- a/flake.lock +++ b/flake.lock @@ -69,17 +69,17 @@ "cpu-microcodes": { "flake": false, "locked": { - "lastModified": 1733678768, - "narHash": "sha256-Ar2rEPOEMr69BDdQsqsLbspHMZFIWfsL/6VjbhbrboA=", + "lastModified": 1734191706, + "narHash": "sha256-fdS2hRAgWEukflu2eOpCXe3cVg0L0lcRqdxbLOiMZg0=", "owner": "platomav", "repo": "CPUMicrocodes", - "rev": "cec026c72d15f7f39b30e9e848bb6c41eab7b754", + "rev": "bebd9ed9a3c3c21996eb77373d3408296b0b9d3d", "type": "github" }, "original": { "owner": "platomav", "repo": "CPUMicrocodes", - "rev": "cec026c72d15f7f39b30e9e848bb6c41eab7b754", + "rev": "bebd9ed9a3c3c21996eb77373d3408296b0b9d3d", "type": "github" } }, @@ -126,11 +126,11 @@ ] }, "locked": { - "lastModified": 1734088167, - "narHash": "sha256-OIitVU+IstPbX/NWn2jLF+/sT9dVKcO2FKeRAzlyX6c=", + "lastModified": 1734343412, + "narHash": "sha256-b7G8oFp0Nj01BYUJ6ENC9Qf/HsYAIZvN9k/p0Kg/PFU=", "owner": "nix-community", "repo": "disko", - "rev": "d32f2d1750d61a476a236526b725ec5a32e16342", + "rev": "a08bfe06b39e94eec98dd089a2c1b18af01fef19", "type": "github" }, "original": { @@ -312,11 +312,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1734120292, - "narHash": "sha256-L6f2Biwy5To1Nv6K+aw+zZo+UKPAFEGLzRy9n4BrdZQ=", + "lastModified": 1734542518, + "narHash": "sha256-9hBhC7sVQFyK6AyUR615/hCRgZ/KjltR776oXx5UQiY=", "owner": "helix-editor", "repo": "helix", - "rev": "e14c346ee74a44051b2c07c2255a6ab80142dbe7", + "rev": "9e4da4b95052ecfc759d33d78255eb9956279d15", "type": "github" }, "original": { @@ -332,11 +332,11 @@ ] }, "locked": { - "lastModified": 1733951536, - "narHash": "sha256-Zb5ZCa7Xj+0gy5XVXINTSr71fCfAv+IKtmIXNrykT54=", + "lastModified": 1734366194, + "narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=", "owner": "nix-community", "repo": "home-manager", - "rev": "1318c3f3b068cdcea922fa7c1a0a1f0c96c22f5f", + "rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f", "type": "github" }, "original": { @@ -402,11 +402,11 @@ ] }, "locked": { - "lastModified": 1733733360, - "narHash": "sha256-q6pp7uqkAxbsENjJr2U7vPVEoLX0m7ouCTBg/0J5v3g=", + "lastModified": 1734338723, + "narHash": "sha256-BpJs2QnVwdE4Btsx2BcBmdsq86H7QJYv2GmoOkr1ii4=", "owner": "Mic92", "repo": "nix-ld", - "rev": "0c74021f8e3779a68684e893a5fb9a72078d5e18", + "rev": "911665df070e3d6c970e5a248fc4a38550bd5689", "type": "github" }, "original": { @@ -432,11 +432,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1733861262, - "narHash": "sha256-+jjPup/ByS0LEVIrBbt7FnGugJgLeG9oc+ivFASYn2U=", + "lastModified": 1734352517, + "narHash": "sha256-mfv+J/vO4nqmIOlq8Y1rRW8hVsGH3M+I2ESMjhuebDs=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "cf737e2eba82b603f54f71b10cb8fd09d22ce3f5", + "rev": "b12e314726a4226298fe82776b4baeaa7bcf3dcd", "type": "github" }, "original": { @@ -479,11 +479,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1734119587, - "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "lastModified": 1734424634, + "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "type": "github" }, "original": { @@ -495,11 +495,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1734083684, - "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", + "lastModified": 1734323986, + "narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", + "rev": "394571358ce82dff7411395829aa6a3aad45b907", "type": "github" }, "original": { @@ -626,11 +626,11 @@ ] }, "locked": { - "lastModified": 1733965552, - "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=", + "lastModified": 1734546875, + "narHash": "sha256-6OvJbqQ6qPpNw3CA+W8Myo5aaLhIJY/nNFDk3zMXLfM=", "owner": "Mic92", "repo": "sops-nix", - "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004", + "rev": "ed091321f4dd88afc28b5b4456e0a15bd8374b4d", "type": "github" }, "original": { @@ -772,11 +772,11 @@ "cpu-microcodes": "cpu-microcodes" }, "locked": { - "lastModified": 1734096298, - "narHash": "sha256-oomfM3+C9DDqsDGCXLUmgCYureNbRh7BXCT1X7TZkRg=", + "lastModified": 1734353399, + "narHash": "sha256-d2Pc1JUcwRRI5nt5Jk5+teIjhLhUaq8i4r2FGuE5/bE=", "owner": "e-tho", "repo": "ucodenix", - "rev": "e88dfdc91f22093054a82443675bed1b556e20e0", + "rev": "a70edcafd9a93b8df1d32e664de921669420024e", "type": "github" }, "original": { @@ -813,11 +813,11 @@ "zen-browser-specific": "zen-browser-specific" }, "locked": { - "lastModified": 1734235629, - "narHash": "sha256-s2yr4KdY5qXHyOuLCWJm/CG7miiOR+G1PA2aqe3iJCA=", + "lastModified": 1734322091, + "narHash": "sha256-cxLNS4FzV8QKjRcTjYUU/cvUKd4x76GIy38Ol37l/6s=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "26237f7bcc5e61b040e1771e7adfe4dc71dd9075", + "rev": "8d85b77fd5d7861020eb0aee663ac256719a063e", "type": "github" }, "original": { diff --git a/pkgs/default.nix b/pkgs/default.nix index 06264b7..23dc9f3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -7,6 +7,7 @@ # }, # }: pkgs: rec { + # dpcpp = pkgs.callPackage ./dpcpp { }; # banana-cursor = pkgs.callPackage ./banana-cursor/package.nix {}; zluda-rocm5 = pkgs.callPackage ./zluda-rocm5/package.nix { }; # candy-icons = pkgs.callPackage ./candy-icons/package.nix { }; diff --git a/pkgs/dpcpp/default.nix b/pkgs/dpcpp/default.nix new file mode 100644 index 0000000..426971e --- /dev/null +++ b/pkgs/dpcpp/default.nix @@ -0,0 +1,91 @@ +{ + lib, + stdenv, + fetchFromGitHub, + + cmake, + python3, + ninja, + hwloc, + perl, + + level-zero, +}: +let + date = "2024-12-19"; + + vc-intrinsics = fetchFromGitHub { + owner = "intel"; + repo = "vc-intrinsics"; + rev = "v0.21.0"; + sha256 = "sha256-Ujekj1EeUuOsb1dXMk9XYYe0b1ZzKU7xygLkH8F71d8="; + }; + + unified-runtime = fetchFromGitHub { + owner = "oneapi-src"; + repo = "unified-runtime"; + rev = "v0.11.1"; + sha256 = "sha256-WxbkisEZNTvZ+4xa/cUjaaTDWY3rOCdJraxKtRqbZL0="; + }; + + compute-runtime = fetchFromGitHub { + owner = "intel"; + repo = "compute-runtime"; + rev = "24.39.31294.12"; + sha256 = "sha256-7GNtAo20DgxAxYSPt6Nh92nuuaS9tzsQGH+sLnsvBKU="; + }; +in +stdenv.mkDerivation { + pname = "dpcpp"; + version = "0-unstable-${date}"; + + src = fetchFromGitHub { + owner = "intel"; + repo = "llvm"; + rev = "nightly-${date}"; + sha256 = "rtGeE/7cTSgTg+KxuZOfc6HDHG4Fgte0jjh4nYLo/E8="; + }; + + buildInputs = [ + level-zero + ]; + + nativeBuildInputs = [ + cmake + python3 + ninja + hwloc + perl + ]; + + unpackPhase = ":"; + + configurePhase = ":"; + + buildPhase = '' + export LEVEL_ZERO_DIR=${level-zero} + python3 $src/buildbot/configure.py \ + --obj-dir=$PWD \ + --cmake-opt="-DLLVMGenXIntrinsics_SOURCE_DIR=${vc-intrinsics}" \ + --cmake-opt="-DSYCL_UR_USE_FETCH_CONTENT=OFF" \ + --cmake-opt="-DSYCL_UR_SOURCE_DIR=${unified-runtime}" \ + --cmake-opt="-DUR_LEVEL_ZERO_LOADER_LIBRARY=${level-zero}/lib" \ + --cmake-opt="-DUR_LEVEL_ZERO_INCLUDE_DIR=${level-zero}" \ + --cmake-opt="-DCOMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE=${compute-runtime}" + python3 $src/buildbot/compile.py + ''; + + # installPhase = '' + # ''; + + # postInstallPhase = '' + # ''; + + meta = with lib; { + homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"; + description = "Intel's C, C++, SYCL, and Data Parallel C++ (DPC++) compilers for Intel processor-based systems"; + license = licenses.free; + platforms = platforms.linux; + maintainers = with maintainers; [ arunoruto ]; + }; +} diff --git a/pkgs/dpcpp/proprietary.nix b/pkgs/dpcpp/proprietary.nix new file mode 100644 index 0000000..b557c72 --- /dev/null +++ b/pkgs/dpcpp/proprietary.nix @@ -0,0 +1,72 @@ +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + + ncurses, + xorg, +}: +let + pname = "dpcpp"; + version = "2025.0.4.20"; + + installer = stdenv.mkDerivation { + name = "${pname}-installer-${version}"; + + src = fetchurl { + url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/84c039b6-2b7d-4544-a745-3fcf8afd643f/intel-${pname}-cpp-compiler-${version}_offline.sh"; + sha256 = "A8qubgwz5h0SoFSrnFyDkZzdfSW3OSl3keR3dOx/ti0="; + executable = true; + }; + + unpackPhase = '' + mkdir -p $out + $src -x -f $out + ''; + + nativeBuildInputs = [ + autoPatchelfHook + ncurses + stdenv.cc.cc.lib + xorg.libXau + ]; + }; +in +stdenv.mkDerivation { + inherit pname; + inherit version; + + src = installer; + + dontPatchELF = true; + + nativeBuildInputs = [ + # autoPatchelfHook + # ncurses + ]; + + unpackPhase = ":"; + + # configurePhase = ":"; + + # buildPhase = '' + # ''; + + installPhase = '' + mkdir -p $out + ls -la $src/intel-dpcpp-cpp-compiler-${version}_offline/install.sh + $src/intel-dpcpp-cpp-compiler-${version}_offline/install.sh -s --eula=accept --install-dir=$out + ''; + + # postInstallPhase = '' + # ''; + + meta = with lib; { + homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"; + description = "Intel's C, C++, SYCL, and Data Parallel C++ (DPC++) compilers for Intel processor-based systems"; + license = licenses.free; + platforms = platforms.linux; + maintainers = with maintainers; [ arunoruto ]; + }; +}