From d388a02d6e0e6f3f086a014bb2c9322cb2fde7f6 Mon Sep 17 00:00:00 2001 From: aimol Date: Sun, 15 Nov 2026 13:35:07 +0800 Subject: [PATCH 1/4] Register aimol.tensorvia 0.3.1 Form A: the release tarball carries the library's own mcpp.toml at its root (`git archive v0.3.1`, no -/ wrap layer), so the pointer is the literal path, as gcc.libstdcxx does. linux and windows only: the CPU backend is AVX2 (``) and the package withdrew its macOS claim in 0.3.1 rather than publish a tarball that cannot compile on Apple silicon. The CI leg skips the member on macOS for the same reason. The test member selects no accelerator, so it exercises the CPU artifact an unqualified consumer gets: import the module, run CPU ops, read back scalars. --- .github/workflows/validate.yml | 16 +++++++++ mcpp.toml | 1 + pkgs/t/tensorvia.lua | 46 ++++++++++++++++++++++++ tests/examples/tensorvia/mcpp.toml | 17 +++++++++ tests/examples/tensorvia/tests/smoke.cpp | 35 ++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 pkgs/t/tensorvia.lua create mode 100644 tests/examples/tensorvia/mcpp.toml create mode 100644 tests/examples/tensorvia/tests/smoke.cpp 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..7300b8dc --- /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.1, 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.1'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.1/tensorvia-0.3.1.tar.gz", sha256 = "92bb3f9430b528d3f4bbe997f61e068f1b66f6af2dd39dd95afc30e158df548d" }, + }, + windows = { + ['0.3.1'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.1/tensorvia-0.3.1.tar.gz", sha256 = "92bb3f9430b528d3f4bbe997f61e068f1b66f6af2dd39dd95afc30e158df548d" }, + }, + }, + + -- 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.1` 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..727df9e0 --- /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.1" 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; +} From c8e31921f43ea64e47e200cc886e17bca971400a Mon Sep 17 00:00:00 2001 From: aimol Date: Sun, 15 Nov 2026 14:10:38 +0800 Subject: [PATCH 2/4] aimol.tensorvia 0.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0.3.1 在 Windows 的 clang 腿编译不过:`-march=x86-64-v3` 之前按 os 门控, Windows 看不到它,AVX2 intrinsics 报 always_inline 失败。0.3.2 改成按 arch + compiler 门控,描述符与 member 跟着升版本、换 sha256。 --- pkgs/t/tensorvia.lua | 8 ++++---- tests/examples/tensorvia/mcpp.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/t/tensorvia.lua b/pkgs/t/tensorvia.lua index 7300b8dc..ed08d441 100644 --- a/pkgs/t/tensorvia.lua +++ b/pkgs/t/tensorvia.lua @@ -1,7 +1,7 @@ -- 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.1, then +-- 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 @@ -31,16 +31,16 @@ package = { xpm = { linux = { - ['0.3.1'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.1/tensorvia-0.3.1.tar.gz", sha256 = "92bb3f9430b528d3f4bbe997f61e068f1b66f6af2dd39dd95afc30e158df548d" }, + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "518fd35e045a8763fb3d1f52a40b62d7d2c0e16e5af5ceb8cb2b04dcc59f193a" }, }, windows = { - ['0.3.1'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.1/tensorvia-0.3.1.tar.gz", sha256 = "92bb3f9430b528d3f4bbe997f61e068f1b66f6af2dd39dd95afc30e158df548d" }, + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "518fd35e045a8763fb3d1f52a40b62d7d2c0e16e5af5ceb8cb2b04dcc59f193a" }, }, }, -- 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.1` with no `-/` wrap layer, so the + -- 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 index 727df9e0..781c7e38 100644 --- a/tests/examples/tensorvia/mcpp.toml +++ b/tests/examples/tensorvia/mcpp.toml @@ -14,4 +14,4 @@ version = "0.1.0" aimol = { path = "../../.." } [dev-dependencies] -aimol.tensorvia = "0.3.1" +aimol.tensorvia = "0.3.2" From 8b1df98bc6bc21873c9d8ff5ec23cfef687ac5bb Mon Sep 17 00:00:00 2001 From: aimol Date: Sun, 15 Nov 2026 23:33:13 +0800 Subject: [PATCH 3/4] aimol.tensorvia 0.3.2 (republished tarball) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第一次发的 0.3.2 缺 Windows 修复,索引的 windows-default 腿编不过: 把 __cpuid 定义成函数宏,MSVC 拉进来的 里那句 `void __cpuid(int[4], int);` 正好被宏吃掉。tag 和 tarball 一起重发, sha256 随之改变,url 和版本号不变。 --- pkgs/t/tensorvia.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/t/tensorvia.lua b/pkgs/t/tensorvia.lua index ed08d441..07a0a5c4 100644 --- a/pkgs/t/tensorvia.lua +++ b/pkgs/t/tensorvia.lua @@ -31,10 +31,10 @@ package = { xpm = { linux = { - ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "518fd35e045a8763fb3d1f52a40b62d7d2c0e16e5af5ceb8cb2b04dcc59f193a" }, + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "dbdb24dc42ad83838fc4b24b99a72059acb02bcf78c266d047c58c363f38fcca" }, }, windows = { - ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "518fd35e045a8763fb3d1f52a40b62d7d2c0e16e5af5ceb8cb2b04dcc59f193a" }, + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "dbdb24dc42ad83838fc4b24b99a72059acb02bcf78c266d047c58c363f38fcca" }, }, }, From 0c38f81a338c1717af21c93201d7adb5d51e0544 Mon Sep 17 00:00:00 2001 From: aimol Date: Sun, 15 Nov 2026 23:49:23 +0800 Subject: [PATCH 4/4] aimol.tensorvia 0.3.2 (tarball republished again) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第一版只修了 的 __cpuid 宏撞车,编译过了但链接炸: __builtin_cpu_supports 引用 libgcc 的 __cpu_model / __cpu_features2, 而 -fms-runtime-lib=dll -fuse-ld=lld 的线上没有 libgcc。这个问题原来 一直被编译错误挡着,看不见。改成自己问 CPUID,tag 和 tarball 再重发一次, sha256 从 dbdb24dc… 变成 f5170e41…,url 和版本号不变。 --- pkgs/t/tensorvia.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/t/tensorvia.lua b/pkgs/t/tensorvia.lua index 07a0a5c4..e29c7040 100644 --- a/pkgs/t/tensorvia.lua +++ b/pkgs/t/tensorvia.lua @@ -31,10 +31,10 @@ package = { xpm = { linux = { - ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "dbdb24dc42ad83838fc4b24b99a72059acb02bcf78c266d047c58c363f38fcca" }, + ['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 = "dbdb24dc42ad83838fc4b24b99a72059acb02bcf78c266d047c58c363f38fcca" }, + ['0.3.2'] = { url = "https://github.com/Aimol-l/Tensorvia/releases/download/v0.3.2/tensorvia-0.3.2.tar.gz", sha256 = "f5170e419fa4b37a04f02fdd71d66332a83031c4b823f09128c0066f980b9cf5" }, }, },