fix: export operator call instantiations#623
Draft
voltjia wants to merge 2 commits into
Draft
Conversation
a02cb31 to
ca40c6f
Compare
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
infini::ops::functionallayer added by feat: add public C++ operator API #618.Operator<Op>::Calltemplate instantiations intolibinfiniops.soand generatedextern templatedeclarations for C++ consumers.#include <infini/ops.h>as the public C++ entrypoint for existing operator classes and adds an external C++ smoke test forinfini::ops::Add::Call.Motivation
Closes #593
Downstream C++ consumers should not need backend kernel headers or vendor compilers just to call existing
Operator<Op>::CallAPIs. Explicit template instantiation keeps the existing operator class API and moves backend-dependent instantiation intolibinfiniops.so, avoiding the extrafunctionalwrapper layer.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 onlybuild/ci— build system or CI configurationdocs— documentation onlychore— tooling, formatting, or other non-code changesOperator<Op>::Callsurface rather than introducing an ABI break.Platforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Test Results on Supported Platforms
pytestResulttests/test_cpp_api.py: 1 passedssh nvidia,infiniops-ci/nvidia:latest, CPU-only buildtests/test_cpp_api.py: 1 passedssh nvidia, card 6 via Docker--gpus 'device=6'GENERATE_PYTHON_BINDINGS=ON, targetopsbuilt on NVIDIAValidation commands
Benchmark / Performance Impact
N/A — this PR changes build/codegen/linkage for C++ operator calls, not operator kernels or performance paths.
Notes for Reviewers
<infini/ops.h>to get the generatedextern templatedeclarations before callinginfini::ops::<Op>::Call.Callsignatures.Operator::Callnow takesconst Args&...to make the instantiation signature stable across lvalue/rvalue call sites.Checklist
Title, Branch, and Commits
<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type.master.fixup!/squash!/wipcommits remain.Scope and Design
functionalplus exportingCallinstantiations.General Code Hygiene
C++ Specific
clang-format --dry-run --Werror include/infini/ops.h src/operator.hpassed onssh nvidia.clang-tidywas not run in this pass; this PR does not add new kernel logic.clang-format.new/deletewas introduced.Python Specific
ruff check scripts/generate_wrappers.py tests/test_cpp_api.pypassed.ruff format --check scripts/generate_wrappers.py tests/test_cpp_api.pypassed.pytest.skipconventions are preserved.Testing
pytestwas not run on every supported platform in this PR creation pass; the table above records tested and untested platforms explicitly.tests/.pytest.mark.auto_act_and_assertis not applicable to this external compile/link smoke test.Add::Callsmoke fails on the previous behavior with an empty backend dispatch and passes with this PR.Build, CI, and Tooling
pip install .[dev]was not run; CMake build/install validation was run instead.compile_commands.jsonregeneration was not separately checked.clang-format.ymlandruff.ymlchecks passed for touched files.Documentation
<infini/ops.h>as the entrypoint.Security and Safety