feat: add public C++ operator API#618
Merged
Merged
Conversation
Collaborator
Author
|
请列出几组通过这样暴露出的 API 的函数签名。 |
voltjia
commented
May 25, 2026
4b54fc5 to
e63f0b0
Compare
e63f0b0 to
b904d28
Compare
voltjia
commented
May 26, 2026
Collaborator
Author
|
Addressed the review concern around Root cause: the earlier Moore run was not pinned to a working card, so I also reran unqualified |
Collaborator
Author
|
请 @crapromer 或 @wooway777 初审,@Ziminli 终审。 |
Ziminli
approved these changes
May 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
include/infini/ops.hfor C++ consumers.infini::ops::functionalingenerated/include/infini/functional_ops.h.libinfiniops.infini::ops::functional::<OpName>.libinfiniops, pkg-config metadata, and CMake package metadata.Motivation
This is the first PR in the public operator API split. It adds the C++ source/link convenience layer first so the later stable C ABI can be implemented as a thin adapter over public C++ operator entrypoints instead of including backend kernel headers directly.
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
All platform tests below were run remotely with unqualified
pytestand the platform bound to physical card 6.pytestResult9206 passed, 8665 skipped, 81 warnings in 362.25sssh nvidia,CUDA_VISIBLE_DEVICES=0inside Docker with--gpus device=6.7704 passed, 8649 skipped, 81 warnings in 575.63sssh iluvatar,CUDA_VISIBLE_DEVICES=6; CoreX compiler bin mounted at/usr/local/corex-4.3.0.20250624/bin.8698 passed, 7655 skipped, 81 warnings in 401.38sssh metax,CUDA_VISIBLE_DEVICES=6,MACA_VISIBLE_DEVICES=6.5899 passed, 10070 skipped, 172 warnings in 991.75sssh cambricon,MLU_VISIBLE_DEVICES=6.8471 passed, 7900 skipped, 99 warnings in 584.02sssh moore,MUSA_VISIBLE_DEVICES=6; no_musa_smoke_passesguard.7405 passed, 8906 skipped, 98 warnings in 552.77sssh ascend,ASCEND_RT_VISIBLE_DEVICES=6; pytest inner return code was 0.Full `pytest` output (optional)
Additional checks:
Benchmark / Performance Impact
N/A. This PR adds public API wrappers and build/install plumbing. It does not change operator kernels or dispatch selection.
Notes for Reviewers
origin/masterat1400daff; current head is4f451af0.infini::ops::functionalto avoid colliding with existing operator classes such asinfini::ops::Add.clang.cindexis unavailable in direct CMake builds.WITH_TORCHgenerated include directory is build-interface-only, which fixes the CMake install/export failure seen in wheel builds._musa_smoke_passeswas removed. The low Moore count was caused by filtering outmusa; selecting physical card 6 withMUSA_VISIBLE_DEVICES=6makes the normaltorch.musa.is_available()path work.ASCEND_RT_VISIBLE_DEVICES=6produced('cpu', 'npu')device discovery before the full pytest run.Generated public C++ signature examples:
Checklist
Title, Branch, and Commits
feat: add public C++ operator API.<type>/...form:feat/cpp-operator-api.origin/master.master.fixup!/squash!/wipcommits remain.Scope and Design
General Code Hygiene
git diff --checkpassed.C++ Specific
clang-formatversion 21.1.0 was run remotely and the final dry-run passed.clang-tidywas not run in this session; this PR does not add kernel code or template-heavy operator implementation code.new/deletewas added by this PR.Python Specific
ruff formatandruff checkwere run remotely and passed.Testing
tests/test_cpp_api.py.Build, CI, and Tooling
pip install .[dev]was not used for the final full-platform runs; each container installed the required build/test packages and then usedpip install . --no-build-isolation --no-deps.GENERATE_PYTHON_BINDINGS=ONpybind target still builds remotely.Documentation
Security and Safety