You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the second PR in the public operator API split. After the public C++ functional API exists, the stable C ABI can be implemented on top of that layer instead of depending on private dispatch or backend kernel headers.
Target base branch: master.
Closes #N/A
Type of Change
feat - new feature / new operator / new platform
fix - bug fix
N/A - perf - performance improvement (no behavioral change)
refactor - code restructuring without behavior change
test - adding or fixing tests only
N/A - docs - documentation only
build / ci - build system or CI configuration
N/A - chore - tooling, formatting, or other non-code changes
N/A - Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)
Platforms Affected
CPU (WITH_CPU)
NVIDIA (WITH_NVIDIA)
Iluvatar (WITH_ILUVATAR)
MetaX (WITH_METAX)
Cambricon (WITH_CAMBRICON)
Moore (WITH_MOORE)
Ascend (WITH_ASCEND)
PyTorch C++ bindings (WITH_TORCH)
Build system / CMake / CI
Python bindings / user-facing API
Test Results on Supported Platforms
Branch head: a8fa2760. Full platform runs used the requested accelerator visibility settings. The pytest command itself was invoked as plain pytest.
Platform
Status
pytest Result
Notes
NVIDIA
Pass
9209 passed, 8665 skipped, 81 warnings in 364.51s (0:06:04)
The C ABI remains the stable ABI boundary. The C++ functional API remains a source/link convenience layer.
InfiniOpsTensor is now an opaque handle, not a public value struct. It stores caller-owned buffer metadata internally and never owns or frees the caller's buffer.
InfiniOpsHandle and InfiniOpsConfig are opaque handles with setter/getter APIs for stream, workspace, and implementation index.
Operator-specific C declarations and wrappers are generated into generated/include/infini/c_ops.h and generated/src/c_ops.inc; src/infini/ops.cc keeps only the common C ABI adapter code.
The earlier _musa_smoke_passes workaround is not present after the rebase. Moore coverage is restored by using the requested visibility environment.
PR title follows Conventional Commits: feat: build C API on functional operator API.
Branch name follows the expected <type>/... form: feat/operator-c-api.
Commit messages follow Conventional Commits.
Branch is rebased onto current origin/master.
No stray merge commits from master.
No fixup! / squash! / wip commits remain.
Scope and Design
Changes are scoped to the C ABI, tests, and required build/export integration.
No dead code, commented-out blocks, debug prints, or ownerless TODOs were added.
No unrelated formatting churn was added.
Public API changes are intentional and reflected in tests.
General Code Hygiene
Comments were added only where they explain non-obvious behavior.
Modified and added files end with a single trailing newline.
git diff --check passed.
Comments and error messages are in English.
Comments and error messages are complete sentences where applicable.
C++ Specific
Code follows the repository's Google C++ style conventions to the extent verified by clang-format.
clang-format --dry-run -Werror passed remotely.
N/A - clang-tidy was not run in this session; this PR only adds the C ABI adapter layer and generated wrapper/build plumbing, not kernel code.
Operator-facing parameter order is preserved: handle/config first for API control, then inputs, then outputs.
No explicit exceptions are thrown through the C ABI; C++ allocation/runtime failures are caught and returned as InfiniOpsStatus.
Error paths return InfiniOpsStatus and expose details through infiniOpsGetLastError.
N/A - no kernel files or launchers were added.
N/A - no new operator implementation classes were added.
The C ABI uses opaque handle ownership internally and releases those handles through destroy APIs.
Python Specific
Python changes are limited to smoke tests and generator code.
ruff format --check and ruff check were run remotely and passed.
Python smoke/full tests passed remotely on supported platforms.
Testing
Full remote pytest results for all six requested platforms are recorded above.
Iluvatar pytest passed after the host maintenance issue was resolved.
New C ABI smoke coverage exists in tests/test_c_api.py.
Existing external C++ smoke coverage remains in tests/test_cpp_api.py.
N/A - no new operator numerical tests were added.
Regression coverage was added for C API header/link behavior.
Build, CI, and Tooling
Full build/install plus plain pytest was run remotely on NVIDIA, MetaX, Iluvatar, Cambricon, Moore, and Ascend.
CMake configure/build/install paths were verified remotely.
src/infini/ops.cc builds as CXX, not CUDA.
No new runtime dependency was added.
Documentation
N/A - README-level public C ABI documentation is deferred; this PR documents the ABI surface in include/infini/ops.h and smoke tests.
Public API surface is represented in include/infini/ops.h and covered by smoke tests.
Public ABI ownership semantics are represented by opaque handles and setter/getter APIs.
Security and Safety
No secrets, access tokens, internal URLs, customer data, or personal hardware identifiers were committed.
No third-party code was added.
Tensor validation checks null pointers, shape, stride, byte size, dtype/device validity, and overflow-sensitive size calculations before calling the C++ API.
@voltjiavoltjia
changed the title
(削除) feat: add operator C API (削除ここまで)
(追記) feat: build C API on functional operator API (追記ここまで)
May 20, 2026
Rebased #617 onto current origin/master after #618 landed and force-pushed feat/operator-c-api at 9ea42a8b.
Updated the PR description with the new test table. Re-run results with physical card 6:
NVIDIA: 9210 passed, 8664 skipped, 81 warnings in 361.58s
MetaX: 8701 passed, 7655 skipped, 81 warnings in 419.40s
Cambricon: 5902 passed, 10070 skipped, 172 warnings in 990.43s
Moore: 8474 passed, 7900 skipped, 99 warnings in 614.53s using MUSA_VISIBLE_DEVICES=6
Ascend: 7400 passed, 8914 skipped, 71 warnings in 559.30s, PYTEST_INNER_RC=0
Iluvatar is blocked by the remote Docker daemon before pytest starts: new container creation fails with error creating overlay mount ... no space left on device. I pruned stopped containers and unused images, reclaiming about 154GB total, but new container creation still fails, so this needs host-level Docker/overlay cleanup or daemon repair before it can be re-run safely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Summary
include/infini/ops.h.InfiniOpsTensorDescriptorand descriptor create/destroy APIs.InfiniOpsTensor,InfiniOpsHandle, andInfiniOpsConfigopaque C handles.infiniOpsAdd.infini::ops::functional::<OpName>.include/infini/c_ops.hgenerated only; the source-tree hand-written copy was removed.origin/masterafter feat: add public C++ operator API #618 landed.Motivation
This is the second PR in the public operator API split. After the public C++ functional API exists, the stable C ABI can be implemented on top of that layer instead of depending on private dispatch or backend kernel headers.
Target base branch:
master.Closes #N/A
Type of Change
feat- new feature / new operator / new platformfix- bug fixperf- performance improvement (no behavioral change)refactor- code restructuring without behavior changetest- adding or fixing tests onlydocs- documentation onlybuild/ci- build system or CI configurationchore- tooling, formatting, or other non-code changes!in the Conventional Commits prefix or aBREAKING CHANGE:footer)Platforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Test Results on Supported Platforms
Branch head:
a8fa2760. Full platform runs used the requested accelerator visibility settings. The pytest command itself was invoked as plainpytest.pytestResult9209 passed, 8665 skipped, 81 warnings in 364.51s (0:06:04)WITH_CPU=ON,WITH_NVIDIA=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; lognvidia.log.7707 passed, 8649 skipped, 81 warnings in 641.09s (0:10:41)WITH_CPU=ON,WITH_ILUVATAR=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; logiluvatar.log.8701 passed, 7655 skipped, 81 warnings in 418.01s (0:06:58)WITH_CPU=ON,WITH_METAX=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; logmetax.log.5902 passed, 10070 skipped, 172 warnings in 999.13s (0:16:39)WITH_CPU=ON,WITH_CAMBRICON=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; logcambricon.log.8474 passed, 7900 skipped, 99 warnings in 585.92s (0:09:45)WITH_CPU=ON,WITH_MOORE=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; logmoore.log.7400 passed, 8914 skipped, 71 warnings in 634.38s (0:10:34)WITH_CPU=ON,WITH_ASCEND=ON,WITH_TORCH=ON,GENERATE_PYTHON_BINDINGS=ON; pytest printedPYTEST_INNER_RC=0; outer container exit was137, matching the known post-pytest container teardown behavior.Full `pytest` output summaries
Additional remote style/check commands:
Focused C ABI verification:
Benchmark / Performance Impact
N/A. This PR changes API wrapping, validation, and build/test integration. It does not change operator kernels or dispatch selection.
Notes for Reviewers
master; feat: add public C++ operator API #618 has landed and this branch was rebased on top oforigin/master.InfiniOpsTensoris now an opaque handle, not a public value struct. It stores caller-owned buffer metadata internally and never owns or frees the caller's buffer.InfiniOpsHandleandInfiniOpsConfigare opaque handles with setter/getter APIs for stream, workspace, and implementation index.generated/include/infini/c_ops.handgenerated/src/c_ops.inc;src/infini/ops.cckeeps only the common C ABI adapter code._musa_smoke_passesworkaround is not present after the rebase. Moore coverage is restored by using the requested visibility environment.Generated C ABI signature example:
Checklist
Title, Branch, and Commits
feat: build C API on functional operator API.<type>/...form:feat/operator-c-api.origin/master.master.fixup!/squash!/wipcommits remain.Scope and Design
General Code Hygiene
git diff --checkpassed.C++ Specific
clang-format.clang-format --dry-run -Werrorpassed remotely.clang-tidywas not run in this session; this PR only adds the C ABI adapter layer and generated wrapper/build plumbing, not kernel code.InfiniOpsStatus.InfiniOpsStatusand expose details throughinfiniOpsGetLastError.Python Specific
ruff format --checkandruff checkwere run remotely and passed.Testing
tests/test_c_api.py.tests/test_cpp_api.py.Build, CI, and Tooling
pytestwas run remotely on NVIDIA, MetaX, Iluvatar, Cambricon, Moore, and Ascend.src/infini/ops.ccbuilds as CXX, not CUDA.Documentation
include/infini/ops.hand smoke tests.include/infini/ops.hand covered by smoke tests.Security and Safety