Unverified Commit 4321bbf1 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

intel-npu-driver: init at 1.26.0 (#382756)

parents 3ed29dab 27a07b0c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21170,6 +21170,12 @@
    matrix = "@pschmitt:one.ems.host";
    keys = [ { fingerprint = "9FBF 2ABF FB37 F7F3 F502  44E5 DC43 9C47 EACB 17F9"; } ];
  };
  pseudocc = {
    email = "pseudoc@163.com";
    github = "pseudocc";
    githubId = 85104110;
    name = "Atlas Yu";
  };
  pshirshov = {
    email = "pshirshov@eml.cc";
    github = "pshirshov";
+31 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.hardware.cpu.intel.npu;
in
{
  options = {
    hardware.cpu.intel.npu = {
      enable = lib.mkEnableOption "Intel NPU support";
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [
      pkgs.intel-npu-driver.validation
      pkgs.level-zero
    ];

    hardware = {
      firmware = [ pkgs.intel-npu-driver.firmware ];
      graphics = {
        enable = true;
        extraPackages = [ pkgs.intel-npu-driver ];
      };
    };
  };
}
+5 −0
Original line number Diff line number Diff line
@@ -205,6 +205,11 @@ sub pciCheck {
        ($device eq "0x4229" || $device eq "0x4230" ||
         $device eq "0x4222" || $device eq "0x4227");

    push @attrs, "hardware.cpu.intel.npu.enable = true;" if
        $vendor eq "0x8086" &&
        ($device eq "0x7d1d" || $device eq "0xad1d" ||
         $device eq "0x643e" || $device eq "0xb03e");

    # Assume that all NVIDIA cards are supported by the NVIDIA driver.
    # There may be exceptions (e.g. old cards).
    # FIXME: do we want to enable an unfree driver here?
+80 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  udev,
  openssl,
  boost,
  cmake,
  git,
  level-zero,
  fetchFromGitHub,
}:

stdenv.mkDerivation rec {
  pname = "intel-npu-driver";
  version = "1.26.0";

  src = fetchFromGitHub {
    owner = "intel";
    repo = "linux-npu-driver";
    tag = "v${version}";
    fetchSubmodules = true;
    hash = "sha256-f3GxvYBfCCK6EGASuHrevFEVcBAyKyWXaIvSNcNcSZQ=";
  };

  buildInputs = [
    udev
    openssl
    boost
    level-zero
  ];

  nativeBuildInputs = [
    cmake
  ];

  outputs = [
    "out"
    "validation"
    "firmware"
  ];

  postPatch = ''
    rm -rf third_party/level-zero
    rm third_party/cmake/level-zero.cmake
    rm third_party/cmake/FindLevelZero.cmake

    substituteInPlace third_party/yaml-cpp/CMakeLists.txt --replace-fail \
      "cmake_minimum_required" \
      "# cmake_minimum_required"

    substituteInPlace third_party/CMakeLists.txt --replace-fail \
      "include(cmake/level-zero.cmake)" \
      ""
    substituteInPlace third_party/level-zero-npu-extensions/ze_graph_ext.h --replace-fail \
    "#include \"ze_api.h\"" \
    "#include <level_zero/ze_api.h>"

    substituteInPlace validation/{kmd-test,umd-test}/CMakeLists.txt --replace-fail \
      "COMPONENT validation-npu" \
      "DESTINATION $validation/bin COMPONENT validation-npu"

    substituteInPlace firmware/CMakeLists.txt --replace-fail \
      "DESTINATION /lib/firmware/updates/intel/vpu/" \
      "DESTINATION $firmware/lib/firmware/intel/vpu/"
  '';

  installPhase = ''
    cmake --install . --component level-zero-npu
    cmake --install . --component validation-npu
    cmake --install . --component fw-npu
  '';

  meta = {
    homepage = "https://github.com/intel/linux-npu-driver";
    description = "Intel NPU (Neural Processing Unit) Standalone Driver";
    platforms = [ "x86_64-linux" ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ pseudocc ];
  };
}