SPDX license update

This commit is contained in:
Jorijn van der Graaf 2026-07-22 18:01:26 +02:00
commit 02af551776
14 changed files with 731 additions and 217 deletions

View file

@ -1,10 +1,13 @@
//SPDX-License-Identifier: LGPL-3.0-only
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
import std;
import Crafter.Build;
namespace fs = std::filesystem;
using namespace Crafter;
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
constexpr std::array<std::string_view, 8> mathInterfaces = {
std::array<fs::path, 8> mathInterfaces = {
"interfaces/Crafter.Math-Basic",
"interfaces/Crafter.Math",
"interfaces/Crafter.Math-Common",
@ -22,45 +25,33 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
cfg.type = ConfigurationType::LibraryStatic;
ApplyStandardArgs(cfg, args);
{
std::array<fs::path, 8> ifaces;
std::ranges::copy(mathInterfaces, ifaces.begin());
std::array<fs::path, 0> impls = {};
cfg.GetInterfacesAndImplementations(ifaces, impls);
cfg.GetInterfacesAndImplementations(mathInterfaces, impls);
}
auto addTest = [&](std::string_view testName, std::string march, std::string mtune, std::string target = {}) {
Test t;
t.config.path = "./";
t.config.name = std::format("{}-{}", testName, march);
t.config.outputName = t.config.name;
t.config.target = target.empty() ? cfg.target : target;
t.config.type = ConfigurationType::Executable;
t.config.march = march;
t.config.mtune = mtune;
t.config.debug = cfg.debug;
std::array<fs::path, 8> ifaces;
std::ranges::copy(mathInterfaces, ifaces.begin());
std::array<fs::path, 1> impls = { fs::path{std::format("tests/{}", testName)} };
t.config.GetInterfacesAndImplementations(ifaces, impls);
cfg.tests.push_back(std::move(t));
};
// SIMD tier matrix: each tier rebuilds the math interfaces with its own
// -march so codegen actually varies. Per-arch gating is just an `if`
// around the AddMarchVariants call.
std::array<MarchTier, 3> x86Tiers = {{
{"sapphirerapids", "native"},
{"x86-64-v4", "generic"},
{"x86-64-v3", "generic"},
}};
// RISC-V tiers mirror the x86 selector: register width is picked from
// the guaranteed VLEN encoded in the march's Zvl* suffix. rv64gcv →
// ZVL128B (matches the RVA23 baseline).
std::array<MarchTier, 3> riscvTiers = {{
{"rv64gcv_zvl512b", "generic"},
{"rv64gcv_zvl256b", "generic"},
{"rv64gcv", "generic"},
}};
const std::string_view target = cfg.target;
const bool isX86 = target.starts_with("x86_64") || target.starts_with("i686");
const bool isRiscv = target.starts_with("riscv");
for (std::string_view name : { "Vector", "Intersection", "Matrix" }) {
if (isX86) {
addTest(name, "sapphirerapids", "native");
addTest(name, "x86-64-v4", "generic");
addTest(name, "x86-64-v3", "generic");
}
if (isRiscv) {
// RISC-V tiers, mirroring the x86 selector: register width is
// picked from the guaranteed VLEN encoded in the march's Zvl*
// suffix. rv64gcv → ZVL128B (matches the RVA23 baseline).
addTest(name, "rv64gcv_zvl512b", "generic");
addTest(name, "rv64gcv_zvl256b", "generic");
addTest(name, "rv64gcv", "generic");
}
if (isX86) cfg.AddMarchVariants(name, mathInterfaces, x86Tiers);
if (isRiscv) cfg.AddMarchVariants(name, mathInterfaces, riscvTiers);
}
return cfg;