Skip to content

Commit 38686de

Browse files
authored
Merge pull request #373 from babichjacob/main
Expose CPU extension features in llama-cpp-sys-2, and automatically enable them in llama-cpp-2
2 parents fc04a8a + 45361ee commit 38686de

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

llama-cpp-2/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ vulkan = ["llama-cpp-sys-2/vulkan"]
2121
native = ["llama-cpp-sys-2/native"]
2222
sampler = []
2323

24+
[target.'cfg(target_feature = "avx")'.dependencies]
25+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["avx"] }
26+
[target.'cfg(target_feature = "avx2")'.dependencies]
27+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["avx2"] }
28+
[target.'cfg(target_feature = "avx512f")'.dependencies]
29+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["avx512"] }
30+
[target.'cfg(target_feature = "avx512vbmi")'.dependencies]
31+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["avx512_vmbi"] }
32+
[target.'cfg(target_feature = "avx512vnni")'.dependencies]
33+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["avx512_vnni"] }
34+
[target.'cfg(target_feature = "f16c")'.dependencies]
35+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["f16c"] }
36+
[target.'cfg(target_feature = "fma")'.dependencies]
37+
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features = ["fma"] }
38+
2439
[target.'cfg(all(target_os = "macos", any(target_arch = "aarch64", target_arch = "arm64")))'.dependencies]
2540
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", features=["metal"], version = "0.1.48" }
2641

llama-cpp-sys-2/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ cc = { workspace = true, features = ["parallel"] }
5353
once_cell = "1.19.0"
5454

5555
[features]
56+
avx = []
57+
avx2 = []
58+
avx512 = []
59+
avx512_vmbi = []
60+
avx512_vnni = []
5661
cuda = []
62+
f16c = []
63+
fma = []
5764
metal = []
5865
vulkan = []
5966
native = []

0 commit comments

Comments
 (0)