Skip to content

fix: export active implementation query - #924

Merged
voltjia merged 1 commit into
masterfrom
fix/export-active-implementation-query
Aug 13, 2026
Merged

fix: export active implementation query#924
voltjia merged 1 commit into
masterfrom
fix/export-active-implementation-query

Conversation

@voltjia

@voltjia voltjia commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Generate extern template declarations and matching explicit instantiations for Operator<Op>::active_implementation_indices(Device::Type) in the installed operator call surface.
  • Extend generator coverage and the installed C++ Add smoke so the query must link successfully and report native implementation index 0 on CPU.

Motivation

Downstream C++ consumers currently instantiate the query from installed public headers, where native implementation specializations are not visible, so a supported backend can incorrectly report no active implementations. Generating the query instantiation beside the existing operator call and default-implementation instantiations gives it the same specialization visibility as library dispatch.

No issue is linked.

Type of Change

  • feat - new feature / new operator / new platform
  • fix - bug fix
  • perf - performance improvement (no behavioral change)
  • refactor - code restructuring without behavior change
  • test - adding or fixing tests only
  • docs - documentation only
  • build / ci - build system or CI configuration
  • chore - tooling, formatting, or other non-code changes
  • 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

Smoke Test Result

No platform kernel or Python binding changes are included. The focused shared-codegen tests and the installed-prefix C++ API smoke passed.

$ python3 -m pytest -q tests/test_generate_wrappers.py
26 passed in 0.25s

$ python3 -m pytest -q tests/test_cpp_api.py::test_cpp_operator_call_instantiation_smoke
1 passed in 1.05s

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA No N/A - No backend code changed. N/A - No backend code changed.
Iluvatar No N/A - No backend code changed. N/A - No backend code changed.
MetaX No N/A - No backend code changed. N/A - No backend code changed.
Cambricon No N/A - No backend code changed. N/A - No backend code changed.
Moore No N/A - No backend code changed. N/A - No backend code changed.
Ascend No N/A - No backend code changed. N/A - No backend code changed.

Benchmark / Performance Impact

N/A. The change only exports an existing query through generated C++ template instantiations.

Notes for Reviewers

Please focus on whether the query declaration and definition are generated in the same operator-specific translation units as the existing default-implementation lookup. The CPU build used WITH_TORCH=OFF, GENERATE_OPERATOR_CALL_INSTANTIATIONS=ON, and INFINI_OPS_OPS=add, then compiled and ran the smoke against the installed headers and libraries.

@voltjia
voltjia requested a review from a team August 11, 2026 23:48
@voltjia
voltjia merged commit 7f4201e into master Aug 13, 2026
20 checks passed
@voltjia
voltjia deleted the fix/export-active-implementation-query branch August 13, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant