diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8cb247cc..20e75916 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1576,6 +1576,22 @@ jobs: mine="${kept# }" fi + # `tensorvia`: the package declares linux and windows only. Its CPU + # backend is AVX2 (``), and the macOS runners are arm64, + # so the 0.3.1 tarball has no macOS table at all. Resolution refuses + # it naming the platform; the leg would only re-measure that. + if [ "${{ matrix.platform }}" = "macos" ]; then + kept="" + for m in $mine; do + case "$m" in + tensorvia) + echo "skipping '$m' on the macOS leg: the package has no macOS artifact" ;; + *) kept="$kept $m" ;; + esac + done + mine="${kept# }" + fi + echo "MEMBERS=$mine" >> "$GITHUB_ENV" echo "shard ${{ matrix.shard }}/${{ matrix.shards }}: ${mine:-}" diff --git a/mcpp.toml b/mcpp.toml index 6a523cc7..3ed9d994 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -222,6 +222,7 @@ members = [ "tests/examples/quill-module", "tests/examples/mp-units-module", "tests/examples/tinyhttps", + "tests/examples/tensorvia", "tests/examples/usockets", "tests/examples/opencl", "tests/examples/sycl-runtime", diff --git a/pkgs/t/tensorvia.lua b/pkgs/t/tensorvia.lua new file mode 100644 index 00000000..e29c7040 --- /dev/null +++ b/pkgs/t/tensorvia.lua @@ -0,0 +1,46 @@ +-- aimol.tensorvia — C++23 module tensor library with CPU, Vulkan, CUDA and SYCL +-- backends (`import tensorvia;`). +-- +-- Emitted by `mcpp emit xpkg` from the package's own manifest @ v0.3.2, then +-- hand-maintained: `name` is the single atomic segment with the namespace +-- beside it, `maintainers` stays here (mcpp.toml has no such key), and the +-- `mcpp` pointer is the literal path rather than a `*/` glob. Those edits are +-- deliberate, so the "AUTO-GENERATED / do not edit by hand" banner is not +-- carried on this file. +-- +-- NO `macosx` TABLE. The CPU backend is AVX2 (`_simd_math.h` includes +-- ``), so the package's own `platforms` names linux and windows +-- only; 0.3.1 withdrew the macOS claim rather than publishing a tarball that +-- cannot compile on Apple silicon. +package = { + spec = "1", + namespace = "aimol", + name = "tensorvia", + description = "Tensorvia: C++23 module tensor library with CPU, Vulkan, CUDA and SYCL backends", + licenses = {"MIT"}, + repo = "https://github.com/Aimol-l/Tensorvia", + type = "package", + maintainers = {"Aimol-l"}, + + extensions = { + autoupdate = { + tag = "v${version}", + url = "https://github.com/Aimol-l/Tensorvia/releases/download/${tag}/tensorvia-${version}.tar.gz", + }, + }, + + xpm = { + linux = { + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "f5170e419fa4b37a04f02fdd71d66332a83031c4b823f09128c0066f980b9cf5" }, + }, + windows = { + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "f5170e419fa4b37a04f02fdd71d66332a83031c4b823f09128c0066f980b9cf5" }, + }, + }, + + -- Form A: the tarball carries the library's own manifest at its root; + -- modules, features and the build program are declared there. The release + -- asset is `git archive v0.3.2` with no `-/` wrap layer, so the + -- pointer is the literal path (same as gcc.libstdcxx). + mcpp = "mcpp.toml", +} diff --git a/tests/examples/tensorvia/mcpp.toml b/tests/examples/tensorvia/mcpp.toml new file mode 100644 index 00000000..781c7e38 --- /dev/null +++ b/tests/examples/tensorvia/mcpp.toml @@ -0,0 +1,17 @@ +# aimol.tensorvia test project: the module imports, CPU tensors round-trip +# through ops, and reductions read back the scalar the API contract promises. +# No accelerator is selected here, so this member exercises exactly the CPU +# artifact an unqualified consumer gets; the device lanes need a GPU and their +# payloads stay unpulled in CI. +[package] +name = "tensorvia-tests" +version = "0.1.0" + +[indices] +# A member-level [indices] REPLACES the inherited table: the root's `compat` +# alias cannot resolve `aimol.*`. Point the `aimol` alias at this repo instead +# (the same shape taskflow-module uses for `taskflow`). +aimol = { path = "../../.." } + +[dev-dependencies] +aimol.tensorvia = "0.3.2" diff --git a/tests/examples/tensorvia/tests/smoke.cpp b/tests/examples/tensorvia/tests/smoke.cpp new file mode 100644 index 00000000..b1b5004f --- /dev/null +++ b/tests/examples/tensorvia/tests/smoke.cpp @@ -0,0 +1,35 @@ +// aimol.tensorvia smoke: import the module, run CPU ops, and read back +// scalars. Every check can fail; a non-zero exit is the signal. +import std; +import tensorvia; + +namespace { + +int failures = 0; + +void check(bool ok, std::string_view what) { + if (!ok) { + std::println("FAIL: {}", what); + ++failures; + } +} + +} // namespace + +int main() { + const Tensor ones = ops::Ones({4, 4}, DataType::FLOAT32); + check(ops::Sum(ones).item() == 16.0f, "Sum(Ones(4x4)) == 16"); + + const Tensor twos = ops::Add(ones, ones); + check(ops::Sum(twos).item() == 32.0f, "Sum(Ones+Ones) == 32"); + + // Add(tensor, scalar) then Relu: the negative half clamps to zero. + const Tensor clamped = ops::Relu(ops::Add(ones, -3.0f)); + check(ops::Sum(clamped).item() == 0.0f, "Relu(1-3) == 0"); + + // The library's version constant reaches a string_view consumer. + check(!tensorvia::version.empty(), "version is non-empty"); + + std::println("tensorvia smoke: {} failures", failures); + return failures == 0 ? 0 : 1; +}