Skip to content

build(nvidia): expose public NZ matmul APIs - #1056

Merged
baominghelly merged 1 commit into
masterfrom
merge/fm9g70-nvidia-public-nz
Nov 25, 2026
Merged

baominghelly merged 1 commit into
masterfrom
merge/fm9g70-nvidia-public-nz

Conversation

@wooway777

@wooway777 wooway777 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add matmul_weight_nz and trans_matmul_weight_nz to the NVIDIA dense sampling torch-free no-Marlin profile as public_api_only.
  • Keep the public C++ API and generated factory/dispatch surface available for downstream builds without enabling the Ascend NZ providers in the NVIDIA profile.
  • Do not change any operator implementation, provider selection at runtime, kernel behavior, or dispatch priority.

Motivation

The InfiniLM dense pre-transpose/NZ path references:

  • infini::ops::MatmulWeightNz
  • infini::ops::TransMatmulWeightNz

The standard NVIDIA no-Marlin profile previously omitted both APIs. As a result, downstream C++ compilation failed even when the NZ path was not executed on NVIDIA:

error: incomplete type ‘infini::ops::detail::OperatorFactory<infini::ops::MatmulWeightNz>’
error: incomplete type ‘infini::ops::detail::OperatorFactory<infini::ops::TransMatmulWeightNz>’

Marking the two operators as public_api_only preserves the operator-pruning boundary: the public API and required factory instantiation are generated, but no NVIDIA provider implementation is built or activated. This keeps the standard NVIDIA workflow self-contained and unblocks the downstream InfiniLM build.

Related downstream branch: InfiniLM/merge/fm9g70-serving-performance.

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
  • 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

Build and targeted operator tests were run on NVIDIA CUDA 13.1 with the modified standard profile, WITH_NVIDIA=ON, and Python bindings enabled.

[100%] Built target infiniops
[100%] Built target ops
python -m pytest -q tests/test_flash_attn_with_kvcache.py tests/test_rotary_embedding.py --devices nvidia

Running 162 items in this shard
25 passed, 137 skipped in 1.28s
python -m pytest -q tests/test_flash_attn_varlen_func.py --devices nvidia

Running 76 items in this shard
12 passed, 4 failed, 60 skipped in 0.92s

The four flash_attn_varlen_func failures are the pre-existing paged + causal + ALiBi provider-support failures observed before this profile change. They are unrelated to the two public-only API entries and do not change with this PR.

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes Passed Targeted tests: 25 passed, 137 skipped; varlen has 4 pre-existing provider-support failures unchanged by this PR
Iluvatar No N/A Not affected
MetaX No N/A Not affected
Cambricon No N/A Not affected
Moore No N/A Not affected
Ascend No N/A Public API only; no Ascend provider is enabled by the NVIDIA profile
Full `pytest` output (optional)

Not run. This is a build-profile-only change; targeted NVIDIA validation covers the changed profile and public API generation.

Benchmark / Performance Impact

N/A. This PR does not add or modify an active operator implementation and does not change runtime dispatch. It only ensures that public API/factory symbols required by downstream C++ code are generated in the standard NVIDIA no-Marlin profile.

Notes for Reviewers

  • public_api_only is intentionally used instead of enabling a provider. The NVIDIA build remains pruned and does not compile an NZ kernel implementation.
  • No vendor-specific kernel source is introduced by this PR.
  • The change is needed for downstream C++ users that reference the public NZ matmul API even when their NVIDIA runtime path does not execute it.

@wooway777
wooway777 requested a review from a team November 25, 2026 05:52
@baominghelly
baominghelly merged commit 5c597e4 into master Nov 25, 2026
12 of 20 checks passed
@baominghelly
baominghelly deleted the merge/fm9g70-nvidia-public-nz branch November 25, 2026 06: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.

2 participants