Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .agents/docs/2026-10-24-implementation-checkpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ONNX Runtime mwrap implementation checkpoints

## CPU interface checkpoint

- Upstream official SDK: 1.25.1, hashes recorded in upstream/sources.lock.toml.
- Exports: 277 C declarations/enumerators and 107 public Ort declarations from Clang AST.
- LLVM 23.1.3: module inference and header coexistence, 2 passed.
- GCC 16.1.0: module inference and header coexistence, 2 passed.
- Actual mcpp new/list-templates followed by generated project build/run passed.
- Linux SDK runtime closure requires declared gcc-runtime; GCC consumers use toolchain-coupled C++ runtime.
- Provider candidate: mcpp-index-mwrap/pkgs/c/compat.onnxruntime.lua.
- Pending: C API/header inventory completion, isolated deployment, Windows/macOS CI, release/index consumption, remote PR.
- Organization repository creation is resolved through the existing authorized GitHub account; the default local account is unchanged.

## SDK deployment and native CI checkpoint

- An isolated MCPP_HOME with no ORT SDK successfully downloaded and installed the current SDK provider, then passed LLVM inference and header/module coexistence tests.
- The SDK provider is pinned to mcpp-index commit 3067e52abc0165b453ea3acac4022895ebf7d9bc for reproducible candidate CI.
- Native CI covers Linux GCC/LLVM, macOS arm64 and Windows MSVC ABI, including actual mcpp template rendering, build and execution.
- tools/test_candidate.py stages the candidate source and index routing outside the checkout; local --cold-sdk additionally verifies installation into a fresh home.
- Pending CI results, API inventory completion and release/index archive consumption remain release gates.

## Expanded public SDK surface checkpoint

- First native CI run 40019919136 passed all four jobs, including actual template execution.
- Expanded exports cover the CPU provider factory, plugin EP callbacks, Ort::Custom helpers, provider option aliases and legacy custom-op resource types.
- Added the independent .config module for 69 enabled SDK configuration/metadata keys. GCC cannot directly export upstream internal-linkage variables; equivalent inline pointers preserve spelling/type, with explicit header-mixing limits documented in upstream/api-coverage.md.
- Expanded Linux GCC/LLVM consumer tests passed; AST regeneration --check passed with the exact resolved LLVM compiler and SDK include path. Native CI rerun remains required on this expanded head.

## Windows SDK header parity correction

- Expanded native CI passed on Linux GCC/LLVM and macOS; Windows revealed that its official SDK omits core/providers/custom_op_context.h and resource.h.
- Added exact official v1.25.1 source copies under upstream/include, verified byte-for-byte against both the official raw source and Linux SDK; individual hashes and source URLs are recorded and checked by the API auditor.
- This preserves the helper API on Windows without inventing declarations, linking another runtime or removing those interfaces from other platforms.
8 changes: 8 additions & 0 deletions .agents/docs/2026-10-25-unified-mwrap-checkpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Unified mwrap first release

Package/module: `mcpplibs.mwrap.onnxruntime`; upstream version: `1.25.1`.

This checkpoint migrates wrapper identity while retaining upstream API names and SDK sources.
Default README is English with a mandatory Chinese counterpart; original section order is preserved.
Validation and release evidence are recorded in the PR and the index ecosystem ledger.
No old release tag or source resource is rewritten.
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
MCPP_VERSION: "2026.10.24.1"
SDK_INDEX_COMMIT: "3067e52abc0165b453ea3acac4022895ebf7d9bc"

jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include:
- name: linux-llvm
os: ubuntu-latest
suffix: linux-x86_64
ext: tar.gz
toolchain: llvm@23.1.3
audit: --audit
- name: linux-gcc
os: ubuntu-latest
suffix: linux-x86_64
ext: tar.gz
toolchain: gcc@16.1.0
audit: ""
- name: macos-arm64
os: macos-15
suffix: macosx-arm64
ext: tar.gz
toolchain: llvm@23.1.3
audit: ""
- name: windows-msvc-abi
os: windows-latest
suffix: windows-x86_64
ext: zip
toolchain: llvm@23.1.3
audit: ""
steps:
- uses: actions/checkout@v4

- name: Mwrap identity and bilingual README contract
run: python3 tools/check_mwrap_release.py

- name: Checkout the candidate SDK provider
uses: actions/checkout@v4
with:
repository: mcpplibs/mcpp-index
ref: ${{ env.SDK_INDEX_COMMIT }}
path: candidate-index

- name: Install pinned mcpp
shell: bash
env:
MCPP_ARCHIVE: mcpp-${{ env.MCPP_VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}
MCPP_ROOT: mcpp-${{ env.MCPP_VERSION }}-${{ matrix.suffix }}
run: |
mkdir -p "$RUNNER_TEMP/mwrap-mcpp"
cd "$RUNNER_TEMP/mwrap-mcpp"
curl -L -fsS -o "$MCPP_ARCHIVE" \
"https://github.com/mcpp-community/mcpp/releases/download/v${MCPP_VERSION}/${MCPP_ARCHIVE}"
case "$MCPP_ARCHIVE" in
*.zip) powershell -NoProfile -Command "Expand-Archive -Force -Path '${MCPP_ARCHIVE}' -DestinationPath '.'" ;;
*) tar -xzf "$MCPP_ARCHIVE" ;;
esac
root="$PWD/$MCPP_ROOT"
mkdir -p "$HOME/.mcpp/registry"
cp -a "$root/registry/." "$HOME/.mcpp/registry/"
if [[ "$RUNNER_OS" == Windows ]]; then
echo "$(cygpath -m "$root/bin")" >> "$GITHUB_PATH"
else
echo "$root/bin" >> "$GITHUB_PATH"
fi

- name: SDK installation, module consumers and actual project template
shell: bash
run: |
python3 tools/test_candidate.py --index "$PWD/candidate-index" \
--toolchain '${{ matrix.toolchain }}' --template ${{ matrix.audit }}
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release
on:
push:
tags: ["mwrap-*"]
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check tag, upstream version and bilingual entry pages
run: python3 tools/check_mwrap_release.py --tag "$GITHUB_REF_NAME"
- name: Require successful source CI at this exact commit
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
result=$(gh run list --repo "$GITHUB_REPOSITORY" --workflow ci.yml --commit "$GITHUB_SHA" --limit 1 --json status,conclusion --jq '.[0] | .status == "completed" and .conclusion == "success"')
test "$result" = true || { echo 'No successful source CI at the tag commit'; exit 1; }
- name: Build immutable source asset and publish
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#mwrap-}"
repo="${GITHUB_REPOSITORY#*/}"
asset="${repo}-${version}.tar.gz"
git archive --format=tar.gz --prefix="${repo}-${version}/" "$GITHUB_SHA" > "$RUNNER_TEMP/$asset"
(cd "$RUNNER_TEMP" && sha256sum "$asset" > "$asset.sha256")
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo 'Release already exists; refusing to change immutable assets'; exit 1
fi
extra=()
if [[ "$version" == *-rc* ]]; then extra+=(--prerelease); fi
gh release create "$GITHUB_REF_NAME" "$RUNNER_TEMP/$asset" "$RUNNER_TEMP/$asset.sha256" \
--repo "$GITHUB_REPOSITORY" --verify-tag --title "$repo $version" \
--notes "Module wrapper for upstream $version. New mwrap package identities become installable after mcpp-index publication; see the bilingual README for the tested support scope." "${extra[@]}"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target/
.mcpp/
.xlings/
mcpp.lock
compile_commands.json
__pycache__/
*.pyc
1 change: 1 addition & 0 deletions .xlings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"workspace":{"xim:mcpp":"2026.10.24.1"}}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
# onnxruntime-m
ONNX Runtime C and C++ APIs as mcpplibs.mwrap C++ modules

> ONNX Runtime 1.25.1 C/C++ APIs as C++23 modules; Ort:: names are preserved.

**English** · [简体中文](README.zh.md) · [Upstream](https://github.com/microsoft/onnxruntime) · [Releases](https://github.com/mcpplibs/onnxruntime-m/releases) · [mcpp](https://github.com/mcpp-community/mcpp) · [Index](https://github.com/mcpplibs/mcpp-index)

[![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![CI](https://github.com/mcpplibs/onnxruntime-m/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mcpplibs/onnxruntime-m/actions/workflows/ci.yml)

## Modules

- `import mcpplibs.mwrap.onnxruntime;`: Ort:: and C inference APIs
- `import mcpplibs.mwrap.onnxruntime.config;`: Session and runtime configuration keys
- `import mcpplibs.mwrap.onnxruntime.macros;`: API-version macro mappings

> More Modules API -> [Usage and API](docs/usage.md)

## Quick start

```sh
mcpp new inference --template mcpplibs.mwrap.onnxruntime@1.25.1
cd inference
mcpp run
```

```toml
[dependencies]
mcpplibs.mwrap.onnxruntime = "1.25.1"
```

## Existing projects

```cpp
import mcpplibs.mwrap.onnxruntime;
int main() { Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "example"); }
```

Linux GCC consumers set `cxx_runtime = "toolchain-coupled"` in `[target.x86_64-linux-gnu]` for the SDK exception runtime.

## Scope

Official CPU SDK: Linux x86_64 glibc, Windows x86_64 MSVC ABI, macOS ARM64.
GPU, musl and MinGW need separate SDKs. The template executes an embedded Identity model.
`.config` exposes configuration keys; `.macros` maps API version. Text macros use `<mwrap/onnxruntime/macros.hpp>` before imports.

## Documentation

[Usage and mixing limits](docs/usage.md) · [SDK provenance](upstream) · [Tests](tests) · [MIT](LICENSE)
The SDK retains its MIT license and ThirdPartyNotices.txt.
50 changes: 50 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# onnxruntime-m

> ONNX Runtime 1.25.1 C/C++ API 的 C++23 模块封装,保留 Ort:: 名称。

[English](README.md) · **简体中文** · [Upstream](https://github.com/microsoft/onnxruntime) · [Releases](https://github.com/mcpplibs/onnxruntime-m/releases) · [mcpp](https://github.com/mcpp-community/mcpp) · [Index](https://github.com/mcpplibs/mcpp-index)

[![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![CI](https://github.com/mcpplibs/onnxruntime-m/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mcpplibs/onnxruntime-m/actions/workflows/ci.yml)

## 模块

- `import mcpplibs.mwrap.onnxruntime;`: Ort:: 与 C 推理 API
- `import mcpplibs.mwrap.onnxruntime.config;`: 会话与运行时配置键
- `import mcpplibs.mwrap.onnxruntime.macros;`: API 版本宏映射

> More Modules API -> [模块与 API](docs/usage.md)

## 快速开始

```sh
mcpp new inference --template mcpplibs.mwrap.onnxruntime@1.25.1
cd inference
mcpp run
```

```toml
[dependencies]
mcpplibs.mwrap.onnxruntime = "1.25.1"
```

## 已有项目

```cpp
import mcpplibs.mwrap.onnxruntime;
int main() { Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "example"); }
```

Linux GCC 消费者在 `[target.x86_64-linux-gnu]` 设置 `cxx_runtime = "toolchain-coupled"`,共享 SDK 异常运行时。

## 支持范围

官方 CPU SDK:Linux x86_64 glibc、Windows x86_64 MSVC ABI、macOS ARM64。
GPU、musl、MinGW 需要独立 SDK;模板实际执行内嵌 Identity 模型。
`.config` 导出配置键,`.macros` 映射 API 版本;文本宏在 import 前包含 `<mwrap/onnxruntime/macros.hpp>`。

## 文档

[使用与混用限制](docs/usage.md) · [SDK 来源](upstream) · [测试](tests) · [MIT](LICENSE)
SDK 保留 MIT 许可证与 ThirdPartyNotices.txt。
Loading
Loading