fix: Add generate wrapper change#796
Open
baominghelly wants to merge 1 commit into
Open
Conversation
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
scripts/generate_wrappers.pyto prefer parsed base-header type spellings when libclang reports ambiguous or degraded parameter types.std::vector<Tensor>,std::vector<int64_t>andstd::optional<std::vector<int64_t>>.Call/Maketemplate instantiations and deduplicate repeated instantiation entries.tests/test_generate_wrappers.pyfor the Histogram overload case where libclang can misreport reused parameter names asint.Motivation
The wrapper generator could produce invalid C++ when libclang degraded some operator parameter types. In particular, Histogram overload generation could emit an incorrect template signature such as
Tensor, Tensor, int, ...instead of preserving the base-header signature withint64_tand optional vector types.The same issue also affected generated explicit instantiations for tensor-list style parameters, where types could be normalized incorrectly, leading to compile errors in generated wrapper code.
Type of Change
fix— bug fixtest— adding or fixing tests onlyPlatforms Affected
WITH_TORCH)Smoke Test Result
build and install passed.

unit test passed.

Test Results on Supported Platforms
WITH_NVIDIA/WITH_TORCHtests/test_generate_wrappers.py: 11 passedBenchmark / Performance Impact
N/A. This only changes wrapper code generation and regression tests.
Notes for Reviewers
This change is intentionally scoped to wrapper generation. The main invariant is that generated wrapper signatures should match the operator base headers when parameter names uniquely identify the overload, instead of relying only on libclang's reported type spelling.