Add system integration for highway

pull/9642/head
LN Liberda 2025-10-08 05:24:30 +02:00
parent 1f1a5e9c3f
commit 3e5c4590da
1 changed files with 15 additions and 10 deletions

View File

@ -719,6 +719,9 @@ pub fn addSimd(
}
// Highway
if (b.systemIntegrationOption("highway", .{})) {
m.linkSystemLibrary("libhwy", dynamic_link_opts);
} else {
if (b.lazyDependency("highway", .{
.target = target,
.optimize = optimize,
@ -729,6 +732,7 @@ pub fn addSimd(
highway_dep.artifact("highway").getEmittedBin(),
);
}
}
// utfcpp - This is used as a dependency on our hand-written C++ code
if (b.lazyDependency("utfcpp", .{
@ -746,6 +750,7 @@ pub fn addSimd(
m.addIncludePath(b.path("src"));
{
// From hwy/detect_targets.h
const HWY_AVX10_2: c_int = 1 << 3;
const HWY_AVX3_SPR: c_int = 1 << 4;
const HWY_AVX3_ZEN4: c_int = 1 << 6;
const HWY_AVX3_DL: c_int = 1 << 7;
@ -756,7 +761,7 @@ pub fn addSimd(
// The performance difference between AVX2 and AVX512 is not
// significant for our use case and AVX512 is very rare on consumer
// hardware anyways.
const HWY_DISABLED_TARGETS: c_int = HWY_AVX3_SPR | HWY_AVX3_ZEN4 | HWY_AVX3_DL | HWY_AVX3;
const HWY_DISABLED_TARGETS: c_int = HWY_AVX10_2 | HWY_AVX3_SPR | HWY_AVX3_ZEN4 | HWY_AVX3_DL | HWY_AVX3;
m.addCSourceFiles(.{
.files = &.{