diff options
author | Naveen Saini <naveen.kumar.saini@intel.com> | 2024-05-29 11:09:46 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2024-05-29 18:13:30 +0800 |
commit | b47467609da1a955ed63b8ada893fe0fb9312d3c (patch) | |
tree | 1925f11055bb3ee8f08d5b8c2c7de81ec34d7ecc | |
parent | 28b193723b5a7a23f50d82166d9f3be752124454 (diff) | |
download | meta-intel-b47467609da1a955ed63b8ada893fe0fb9312d3c.tar.gz |
linux-npu-driver: add recipe
This recipe enables User Mode Driver for Intel® NPU device.
Intel® NPU device is an AI inference accelerator integrated
with Intel client CPUs, starting from Intel® Core™ Ultra generation
of CPUs (formerly known as Meteor Lake).
It enables energy-efficient execution of artificial neural network tasks.
https://github.com/intel/linux-npu-driver
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
4 files changed, 243 insertions, 0 deletions
diff --git a/conf/include/maintainers.inc b/conf/include/maintainers.inc index 9849d0d8..990fbb08 100644 --- a/conf/include/maintainers.inc +++ b/conf/include/maintainers.inc | |||
@@ -31,6 +31,7 @@ RECIPE_MAINTAINER:pn-libxcam = "Naveen Saini <naveen.kumar.saini@intel.com>" | |||
31 | RECIPE_MAINTAINER:pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>" | 31 | RECIPE_MAINTAINER:pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>" |
32 | RECIPE_MAINTAINER:pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>" | 32 | RECIPE_MAINTAINER:pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>" |
33 | RECIPE_MAINTAINER:pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>" | 33 | RECIPE_MAINTAINER:pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>" |
34 | RECIPE_MAINTAINER:pn-linux-npu-driver = "Naveen Saini <naveen.kumar.saini@intel.com>" | ||
34 | RECIPE_MAINTAINER:pn-lms = "Anuj Mittal <anuj.mittal@intel.com>" | 35 | RECIPE_MAINTAINER:pn-lms = "Anuj Mittal <anuj.mittal@intel.com>" |
35 | RECIPE_MAINTAINER:pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>" | 36 | RECIPE_MAINTAINER:pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>" |
36 | RECIPE_MAINTAINER:pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>" | 37 | RECIPE_MAINTAINER:pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>" |
diff --git a/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0001-Fix-the-compilation-warning-when-using-gcc-13-25.patch b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0001-Fix-the-compilation-warning-when-using-gcc-13-25.patch new file mode 100644 index 00000000..2748d7ab --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0001-Fix-the-compilation-warning-when-using-gcc-13-25.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From b57297c14d94dac9bdef7570b7b33d70b10171f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jozef Wludzik <jozef.wludzik@intel.com> | ||
3 | Date: Tue, 26 Mar 2024 14:43:29 +0100 | ||
4 | Subject: [PATCH 1/2] Fix the compilation warning when using gcc-13 (#25) | ||
5 | |||
6 | Added missing headers. Fixed compilation error about casting from | ||
7 | unsigned to signed int. | ||
8 | |||
9 | Upstream-Status: Backport [https://github.com/intel/linux-npu-driver/commit/4bcbf2abe94eb4d9c083bd616b58e309a82d008a] | ||
10 | |||
11 | Signed-off-by: Jozef Wludzik <jozef.wludzik@intel.com> | ||
12 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
13 | --- | ||
14 | umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp | 7 ++++--- | ||
15 | umd/vpu_driver/include/umd_common.hpp | 1 + | ||
16 | validation/umd-test/umd_prime_buffers.h | 9 +++++++-- | ||
17 | validation/umd-test/utilities/data_handle.h | 1 + | ||
18 | 4 files changed, 13 insertions(+), 5 deletions(-) | ||
19 | |||
20 | diff --git a/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp b/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp | ||
21 | index f206ebe..682e5b4 100644 | ||
22 | --- a/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp | ||
23 | +++ b/umd/level_zero_driver/ext/source/graph/vcl_symbols.hpp | ||
24 | @@ -5,12 +5,13 @@ | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | -#include <dlfcn.h> | ||
29 | -#include <memory> | ||
30 | - | ||
31 | #include "vpux_driver_compiler.h" | ||
32 | #include "vpu_driver/source/utilities/log.hpp" | ||
33 | |||
34 | +#include <array> | ||
35 | +#include <dlfcn.h> | ||
36 | +#include <memory> | ||
37 | + | ||
38 | class Vcl { | ||
39 | public: | ||
40 | static Vcl &sym() { | ||
41 | diff --git a/umd/vpu_driver/include/umd_common.hpp b/umd/vpu_driver/include/umd_common.hpp | ||
42 | index 0c874a3..5ad9be2 100644 | ||
43 | --- a/umd/vpu_driver/include/umd_common.hpp | ||
44 | +++ b/umd/vpu_driver/include/umd_common.hpp | ||
45 | @@ -7,6 +7,7 @@ | ||
46 | |||
47 | #pragma once | ||
48 | |||
49 | +#include <cstdint> | ||
50 | #include <limits> | ||
51 | #include <linux/kernel.h> | ||
52 | #include <stdexcept> | ||
53 | diff --git a/validation/umd-test/umd_prime_buffers.h b/validation/umd-test/umd_prime_buffers.h | ||
54 | index 6f7c7de..ab4814c 100644 | ||
55 | --- a/validation/umd-test/umd_prime_buffers.h | ||
56 | +++ b/validation/umd-test/umd_prime_buffers.h | ||
57 | @@ -6,12 +6,17 @@ | ||
58 | */ | ||
59 | |||
60 | #pragma once | ||
61 | + | ||
62 | +#include "umd_test.h" | ||
63 | + | ||
64 | #include <fcntl.h> | ||
65 | -#include <linux/kernel.h> | ||
66 | #include <linux/dma-buf.h> | ||
67 | #include <linux/dma-heap.h> | ||
68 | +#include <linux/kernel.h> | ||
69 | +#include <stdint.h> | ||
70 | #include <sys/ioctl.h> | ||
71 | #include <sys/mman.h> | ||
72 | +#include <unistd.h> | ||
73 | |||
74 | #define ALLIGN_TO_PAGE(x) __ALIGN_KERNEL((x), (UmdTest::PAGE_SIZE)) | ||
75 | |||
76 | @@ -60,7 +65,7 @@ class PrimeBufferHelper { | ||
77 | return false; | ||
78 | |||
79 | bufferFd = heapAlloc.fd; | ||
80 | - buffers.insert({heapAlloc.fd, {size, nullptr}}); | ||
81 | + buffers.insert({static_cast<int>(heapAlloc.fd), {size, nullptr}}); | ||
82 | return true; | ||
83 | } | ||
84 | |||
85 | diff --git a/validation/umd-test/utilities/data_handle.h b/validation/umd-test/utilities/data_handle.h | ||
86 | index d6e0ec0..5d937b2 100644 | ||
87 | --- a/validation/umd-test/utilities/data_handle.h | ||
88 | +++ b/validation/umd-test/utilities/data_handle.h | ||
89 | @@ -6,6 +6,7 @@ | ||
90 | */ | ||
91 | |||
92 | #include <linux/kernel.h> | ||
93 | +#include <stdint.h> | ||
94 | #include <string> | ||
95 | #include <vector> | ||
96 | |||
97 | -- | ||
98 | 2.43.0 | ||
99 | |||
diff --git a/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0002-Fix-compilation-failure-with-GCC-14.patch b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0002-Fix-compilation-failure-with-GCC-14.patch new file mode 100644 index 00000000..9fb97354 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver/0002-Fix-compilation-failure-with-GCC-14.patch | |||
@@ -0,0 +1,110 @@ | |||
1 | From a9f51fd88effb7d324609e692ca7da576d6dad2e Mon Sep 17 00:00:00 2001 | ||
2 | From: Naveen Saini <naveen.kumar.saini@intel.com> | ||
3 | Date: Tue, 28 May 2024 10:23:42 +0800 | ||
4 | Subject: [PATCH 2/2] Fix compilation failure with GCC-14 | ||
5 | |||
6 | umd/level_zero_driver/core/source/event/event.cpp:65:31: error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'? | ||
7 | | 65 | associatedJobs.erase(std::remove_if(associatedJobs.begin(), | ||
8 | | | ^~~~~~~~~ | ||
9 | | | remove_cv | ||
10 | |||
11 | | umd/vpu_driver/source/command/vpu_command.cpp: In member function 'void VPU::VPUCommand::appendAssociateBufferObject(VPU::VPUBufferObject*)': | ||
12 | | umd/vpu_driver/source/command/vpu_command.cpp:126:20: error: 'find' is not a member of 'std'; did you mean 'bind'? | ||
13 | | 126 | auto it = std::find(bufferObjects.begin(), bufferObjects.end(), bo); | ||
14 | | | ^~~~ | ||
15 | | | bind | ||
16 | |||
17 | | umd/vpu_driver/source/command/vpu_command_buffer.cpp: In member function 'bool VPU::VPUCommandBuffer::addCommand(VPU::VPUCommand*, uint64_t&, uint64_t&)': | ||
18 | | umd/vpu_driver/source/command/vpu_command_buffer.cpp:185:24: error: 'find' is not a member of 'std'; did you mean 'bind'? | ||
19 | | 185 | auto it = std::find(bufferHandles.begin(), bufferHandles.end(), bo->getHandle()); | ||
20 | | | ^~~~ | ||
21 | | | bind | ||
22 | |||
23 | | umd/level_zero_driver/ext/source/graph/elf_parser.cpp:301:32: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'? | ||
24 | | 301 | std::max_element(stride_begin + TENSOR_5D_STRIDE_C, stride_end)); | ||
25 | | | ^~~~~~~~~~~ | ||
26 | | | tuple_element | ||
27 | | umd/level_zero_driver/ext/source/graph/elf_parser.cpp:315:37: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'? | ||
28 | | 315 | auto max_stride_val = *std::max_element(stride_begin + TENSOR_4D_STRIDE_C, stride_end); | ||
29 | | | ^~~~~~~~~~~ | ||
30 | |||
31 | | umd/level_zero_driver/tools/source/metrics/metric.cpp: In member function 'void L0::MetricContext::deactivateMetricGroups(int)': | ||
32 | | umd/level_zero_driver/tools/source/metrics/metric.cpp:275:38: error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'? | ||
33 | | 275 | activatedMetricGroups.erase(std::remove_if(activatedMetricGroups.begin(), | ||
34 | | | ^~~~~~~~~ | ||
35 | | | remove_cv | ||
36 | |||
37 | Upstream-Status: Submitted [https://github.com/intel/linux-npu-driver/pull/30] | ||
38 | |||
39 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
40 | --- | ||
41 | umd/level_zero_driver/core/source/event/event.cpp | 1 + | ||
42 | umd/level_zero_driver/ext/source/graph/elf_parser.cpp | 1 + | ||
43 | umd/level_zero_driver/tools/source/metrics/metric.cpp | 1 + | ||
44 | umd/vpu_driver/source/command/vpu_command.cpp | 1 + | ||
45 | umd/vpu_driver/source/command/vpu_command_buffer.cpp | 1 + | ||
46 | 5 files changed, 5 insertions(+) | ||
47 | |||
48 | diff --git a/umd/level_zero_driver/core/source/event/event.cpp b/umd/level_zero_driver/core/source/event/event.cpp | ||
49 | index a92248f..196d176 100644 | ||
50 | --- a/umd/level_zero_driver/core/source/event/event.cpp | ||
51 | +++ b/umd/level_zero_driver/core/source/event/event.cpp | ||
52 | @@ -14,6 +14,7 @@ | ||
53 | |||
54 | #include <level_zero/ze_api.h> | ||
55 | #include <thread> | ||
56 | +#include <algorithm> | ||
57 | |||
58 | namespace L0 { | ||
59 | |||
60 | diff --git a/umd/level_zero_driver/ext/source/graph/elf_parser.cpp b/umd/level_zero_driver/ext/source/graph/elf_parser.cpp | ||
61 | index a1c8e14..dfbd61d 100644 | ||
62 | --- a/umd/level_zero_driver/ext/source/graph/elf_parser.cpp | ||
63 | +++ b/umd/level_zero_driver/ext/source/graph/elf_parser.cpp | ||
64 | @@ -21,6 +21,7 @@ | ||
65 | #include <vpux_headers/metadata.hpp> | ||
66 | #include <vpux_elf/types/vpu_extensions.hpp> | ||
67 | #include <vpux_elf/utils/error.hpp> | ||
68 | +#include <algorithm> | ||
69 | |||
70 | namespace L0 { | ||
71 | |||
72 | diff --git a/umd/level_zero_driver/tools/source/metrics/metric.cpp b/umd/level_zero_driver/tools/source/metrics/metric.cpp | ||
73 | index b67750f..9497311 100644 | ||
74 | --- a/umd/level_zero_driver/tools/source/metrics/metric.cpp | ||
75 | +++ b/umd/level_zero_driver/tools/source/metrics/metric.cpp | ||
76 | @@ -7,6 +7,7 @@ | ||
77 | |||
78 | #include "level_zero_driver/tools/source/metrics/metric.hpp" | ||
79 | #include "vpu_driver/source/utilities/log.hpp" | ||
80 | +#include <algorithm> | ||
81 | |||
82 | namespace L0 { | ||
83 | |||
84 | diff --git a/umd/vpu_driver/source/command/vpu_command.cpp b/umd/vpu_driver/source/command/vpu_command.cpp | ||
85 | index f4ca23f..75331d9 100644 | ||
86 | --- a/umd/vpu_driver/source/command/vpu_command.cpp | ||
87 | +++ b/umd/vpu_driver/source/command/vpu_command.cpp | ||
88 | @@ -14,6 +14,7 @@ | ||
89 | #include <cstdint> | ||
90 | #include <vector> | ||
91 | #include <map> | ||
92 | +#include <algorithm> | ||
93 | |||
94 | namespace VPU { | ||
95 | |||
96 | diff --git a/umd/vpu_driver/source/command/vpu_command_buffer.cpp b/umd/vpu_driver/source/command/vpu_command_buffer.cpp | ||
97 | index c4ad052..bbb80ec 100644 | ||
98 | --- a/umd/vpu_driver/source/command/vpu_command_buffer.cpp | ||
99 | +++ b/umd/vpu_driver/source/command/vpu_command_buffer.cpp | ||
100 | @@ -11,6 +11,7 @@ | ||
101 | #include "vpu_driver/source/command/vpu_command_buffer.hpp" | ||
102 | #include "vpu_driver/source/command/vpu_copy_command.hpp" | ||
103 | #include "vpu_driver/source/utilities/log.hpp" | ||
104 | +#include <algorithm> | ||
105 | |||
106 | namespace VPU { | ||
107 | |||
108 | -- | ||
109 | 2.43.0 | ||
110 | |||
diff --git a/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver_1.2.0.bb b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver_1.2.0.bb new file mode 100644 index 00000000..03e409af --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-core/linux-npu-driver/linux-npu-driver_1.2.0.bb | |||
@@ -0,0 +1,33 @@ | |||
1 | SUMMARY = "User Mode Driver for Intel® NPU device" | ||
2 | HOMEPAGE = "https://github.com/intel/linux-npu-driver" | ||
3 | LICENSE = "MIT & Apache-2.0" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=37acda99f3f9c108e62d970fe0e08027 \ | ||
5 | file://third-party-programs.txt;md5=dbf0d7a91947cccc5410e9760d9acae5 \ | ||
6 | file://third_party/vpux_elf/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" | ||
7 | |||
8 | SRC_URI = "git://github.com/intel/linux-npu-driver.git;protocol=https;name=linux-npu-driver;branch=main;lfs=1 \ | ||
9 | git://github.com/openvinotoolkit/npu_plugin_elf.git;protocol=https;destsuffix=git/third_party/vpux_elf;name=vpux-elf;nobranch=1 \ | ||
10 | git://github.com/jbeder/yaml-cpp.git;protocol=https;destsuffix=git/third_party/yaml-cpp;name=yaml-cpp;nobranch=1 \ | ||
11 | git://github.com/intel/level-zero-npu-extensions.git;protocol=https;destsuffix=git/third_party/level-zero-vpu-extensions;name=lzvext;nobranch=1 \ | ||
12 | git://github.com/google/googletest.git;protocol=https;destsuffix=git/third_party/googletest;name=googletest;nobranch=1 \ | ||
13 | file://0001-Fix-the-compilation-warning-when-using-gcc-13-25.patch \ | ||
14 | file://0002-Fix-compilation-failure-with-GCC-14.patch \ | ||
15 | " | ||
16 | |||
17 | SRCREV_linux-npu-driver = "9d1dd3daa01ebd97a4ac2e8279ddd6e2cb109244" | ||
18 | SRCREV_vpux-elf = "03878c115d13aa1ce6af5329c5759fc1cc94a3fb" | ||
19 | SRCREV_yaml-cpp = "0579ae3d976091d7d664aa9d2527e0d0cff25763" | ||
20 | SRCREV_lzvext = "0e1c471356a724ef6d176ba027a68e210d90939e" | ||
21 | SRCREV_googletest = "b796f7d44681514f58a683a3a71ff17c94edb0c1" | ||
22 | SRCREV_FORMAT = "linux-npu-driver_vpux-elf_yaml-cpp_lzvext_googletest" | ||
23 | |||
24 | S = "${WORKDIR}/git" | ||
25 | |||
26 | inherit cmake | ||
27 | |||
28 | DEPENDS = "level-zero" | ||
29 | |||
30 | PACKAGES =+ "${PN}-firmware ${PN}-tests" | ||
31 | |||
32 | FILES:${PN}-firmware = "${libdir}/firmware/updates/intel/vpu/*" | ||
33 | FILES:${PN}-tests = "${bindir}" | ||