feat: add minimal returning calls for Add and Gemm#761
Open
voltjia wants to merge 1 commit into
Open
Conversation
f557a7a to
e1a1191
Compare
19 tasks
e1a1191 to
5852b4d
Compare
Ziminli
requested changes
Jun 26, 2026
Comment on lines
+12
to
+13
| using Operator<Add>::Call; | ||
|
|
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
Callsupport forAddandGemmonly.Operator<Key>::Call(...)entry insrc/operator.h, so future hooks can stay centralized.MakeReturnValue(...)for output construction;operator.hthen reuses the existing in-placeCall(..., out)path.Calloverloads available viausing Operator<Op>::Call.Add::Call(...)andGemm::Call(...), plus existing in-place API regression coverage intests/test_cpp_api.py.Motivation
Returning tensor APIs are easier for external users than explicitly allocating and passing output tensors. InfiniOps still does not own tensor storage: the returning path delegates allocation to the external tensor type through
Empty(...), then calls the existing in-place operator implementation.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)Smoke Test Result
Test Results on Supported Platforms
Full `pytest` output (optional)
Benchmark / Performance Impact
N/A. This adds a convenience API that allocates an output through the caller-provided tensor type and then reuses the existing in-place operator path.
Notes for Reviewers
TensorViewconstructor InfiniRT#10 forTensorViewconstruction from tensor-like objects.tests/test_cpp_api.pycompiles an external temporary C++ source against installed headers and links-linfiniops -linfinirt, so the new API is validated in the same form an external library would use it.Add::Call(x, y)andGemm::Call(a, b); other operators and more complex Gemm attribute forms are left out of scope.