-
Notifications
You must be signed in to change notification settings - Fork 208
NPU plugin support #2066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tkatila
wants to merge
3
commits into
intel:main
Choose a base branch
from
tkatila:npu-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
NPU plugin support #2066
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
## This is a generated file, do not edit directly. Edit build/docker/templates/intel-npu-plugin.Dockerfile.in instead. | ||
## | ||
## Copyright 2022 Intel Corporation. All Rights Reserved. | ||
## | ||
## Licensed under the Apache License, Version 2.0 (the "License"); | ||
## you may not use this file except in compliance with the License. | ||
## You may obtain a copy of the License at | ||
## | ||
## http://www.apache.org/licenses/LICENSE-2.0 | ||
## | ||
## Unless required by applicable law or agreed to in writing, software | ||
## distributed under the License is distributed on an "AS IS" BASIS, | ||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
## See the License for the specific language governing permissions and | ||
## limitations under the License. | ||
### | ||
ARG CMD=npu_plugin | ||
## FINAL_BASE can be used to configure the base image of the final image. | ||
## | ||
## This is used in two ways: | ||
## 1) make <image-name> BUILDER=<docker|buildah> | ||
## 2) docker build ... -f <image-name>.Dockerfile | ||
## | ||
## The project default is 1) which sets FINAL_BASE=gcr.io/distroless/static | ||
## (see build-image.sh). | ||
## 2) and the default FINAL_BASE is primarily used to build Redhat Certified Openshift Operator container images that must be UBI based. | ||
## The RedHat build tool does not allow additional image build parameters. | ||
ARG FINAL_BASE=registry.access.redhat.com/ubi9-micro:latest | ||
### | ||
## | ||
## GOLANG_BASE can be used to make the build reproducible by choosing an | ||
## image by its hash: | ||
## GOLANG_BASE=golang@sha256:9d64369fd3c633df71d7465d67d43f63bb31192193e671742fa1c26ebc3a6210 | ||
## | ||
## This is used on release branches before tagging a stable version. | ||
## The main branch defaults to using the latest Golang base image. | ||
ARG GOLANG_BASE=golang:1.24-bookworm | ||
### | ||
FROM ${GOLANG_BASE} AS builder | ||
ARG DIR=/intel-device-plugins-for-kubernetes | ||
ARG GO111MODULE=on | ||
ARG LDFLAGS="all=-w -s" | ||
ARG GOFLAGS="-trimpath" | ||
ARG GCFLAGS="all=-spectre=all -N -l" | ||
ARG ASMFLAGS="all=-spectre=all" | ||
ARG GOLICENSES_VERSION | ||
ARG EP=/usr/local/bin/intel_npu_device_plugin | ||
ARG CMD | ||
WORKDIR ${DIR} | ||
COPY . . | ||
RUN (cd cmd/${CMD}; GO111MODULE=${GO111MODULE} GOFLAGS=${GOFLAGS} CGO_ENABLED=0 go install -gcflags="${GCFLAGS}" -asmflags="${ASMFLAGS}" -ldflags="${LDFLAGS}") && install -D /go/bin/${CMD} /install_root${EP} | ||
RUN install -D ${DIR}/LICENSE /install_root/licenses/intel-device-plugins-for-kubernetes/LICENSE \ | ||
&& if [ ! -d "licenses/$CMD" ] ; then \ | ||
GO111MODULE=on GOROOT=$(go env GOROOT) go run github.com/google/go-licenses@${GOLICENSES_VERSION} save "./cmd/$CMD" \ | ||
--save_path /install_root/licenses/$CMD/go-licenses ; \ | ||
else mkdir -p /install_root/licenses/$CMD/go-licenses/ && cd licenses/$CMD && cp -r * /install_root/licenses/$CMD/go-licenses/ ; fi && \ | ||
echo "Verifying installed licenses" && test -e /install_root/licenses/$CMD/go-licenses | ||
### | ||
FROM ${FINAL_BASE} | ||
COPY --from=builder /install_root / | ||
ENTRYPOINT ["/usr/local/bin/intel_npu_device_plugin"] | ||
LABEL vendor='Intel®' | ||
LABEL org.opencontainers.image.source='https://github.com/intel/intel-device-plugins-for-kubernetes' | ||
LABEL maintainer="Intel®" | ||
LABEL version='devel' | ||
LABEL release='1' | ||
LABEL name='intel-npu-plugin' | ||
LABEL summary='Intel® NPU device plugin for Kubernetes' | ||
LABEL description='The NPU device plugin provides access to Intel CPU neural processing unit (NPU) device files' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#define _ENTRYPOINT_ /usr/local/bin/intel_npu_device_plugin | ||
ARG CMD=npu_plugin | ||
|
||
#include "default_plugin.docker" | ||
|
||
LABEL name='intel-npu-plugin' | ||
LABEL summary='Intel® NPU device plugin for Kubernetes' | ||
LABEL description='The NPU device plugin provides access to Intel CPU neural processing unit (NPU) device files' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Intel NPU device plugin for Kubernetes | ||
|
||
Table of Contents | ||
|
||
* [Introduction](#introduction) | ||
* [Modes and Configuration Options](#modes-and-configuration-options) | ||
* [Pre-built Images](#pre-built-images) | ||
* [Installation](#installation) | ||
* [Install with NFD](#install-with-nfd) | ||
* [Install with Operator](#install-with-operator) | ||
* [Verify Plugin Registration](#verify-plugin-registration) | ||
* [Testing and Demos](#testing-and-demos) | ||
|
||
## Introduction | ||
|
||
Intel NPU plugin facilitates Kubernetes workload offloading by providing access to Intel CPU neural processing units supported by the host kernel. | ||
|
||
The following CPU families are currently detected by the plugin: | ||
* Core Ultra Series 1 | ||
* Core Ultra Series 2 | ||
* Core Ultra 200V Series | ||
|
||
Intel NPU plugin may register one resource to the Kubernetes cluster: | ||
| Resource | Description | | ||
|:---- |:-------- | | ||
| npu.intel.com/npu | NPU | | ||
|
||
## Modes and Configuration Options | ||
|
||
| Flag | Argument | Default | Meaning | | ||
|:---- |:-------- |:------- |:------- | | ||
| -shared-dev-num | int | 1 | Number of containers that can share the same NPU device | | ||
|
||
The plugin also accepts a number of other arguments (common to all plugins) related to logging. | ||
Please use the -h option to see the complete list of logging related options. | ||
|
||
## Pre-built Images | ||
|
||
[Pre-built images](https://hub.docker.com/r/intel/intel-npu-plugin) | ||
are available on the Docker hub. These images are automatically built and uploaded | ||
to the hub from the latest main branch of this repository. | ||
|
||
Release tagged images of the components are also available on the Docker hub, tagged with their | ||
release version numbers in the format `x.y.z`, corresponding to the branches and releases in this | ||
repository. | ||
|
||
See [the development guide](../../DEVEL.md) for details if you want to deploy a customized version of the plugin. | ||
|
||
## Installation | ||
|
||
There are multiple ways to install Intel NPU plugin to a cluster. The most common methods are described below. | ||
|
||
> **Note**: Replace `<RELEASE_VERSION>` with the desired [release tag](https://github.com/intel/intel-device-plugins-for-kubernetes/tags) or `main` to get `devel` images. | ||
|
||
> **Note**: Add ```--dry-run=client -o yaml``` to the ```kubectl``` commands below to visualize the YAML content being applied. | ||
|
||
### Install with NFD | ||
|
||
Deploy NPU plugin with the help of NFD ([Node Feature Discovery](https://github.com/kubernetes-sigs/node-feature-discovery)). It detects the presence of Intel NPUs and labels them accordingly. GPU plugin's node selector is used to deploy plugin to nodes which have such a NPU label. | ||
|
||
```bash | ||
# Start NFD - if your cluster doesn't have NFD installed yet | ||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=<RELEASE_VERSION>' | ||
|
||
# Create NodeFeatureRules for detecting NPUs on nodes | ||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>' | ||
|
||
# Create NPU plugin daemonset | ||
$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/npu_plugin/overlays/nfd_labeled_nodes?ref=<RELEASE_VERSION>' | ||
``` | ||
|
||
### Install with Operator | ||
|
||
NPU plugin can be installed with the Intel Device Plugin Operator. It allows configuring NPU plugin parameters without kustomizing the deployment files. The general installation is described in the [install documentation](../operator/README.md#installation). | ||
|
||
### Verify Plugin Registration | ||
|
||
You can verify that the plugin has been installed on the expected nodes by searching for the relevant | ||
resource allocation status on the nodes: | ||
|
||
```bash | ||
$ kubectl get nodes -o=jsonpath="{range .items[*]}{.metadata.name}{'\n'}{' npu: '}{.status.allocatable.npu\.intel\.com/npu}{'\n'}" | ||
master | ||
npu: 1 | ||
``` | ||
|
||
## Testing and Demos | ||
|
||
TODO | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO code names like MeteorLake etc are also useful, because that's e.g. how Wikipedia refers to them: https://en.wikipedia.org/wiki/Meteor_Lake
=> Maybe code names could be in parenthesis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was requested to use the official names. :) But I agree that the codenames are familiar for people, maybe even more familiar.