Skip to content

fix: repair native example builds - #954

Merged
voltjia merged 1 commit into
masterfrom
fix/repair-native-example-builds
Aug 26, 2026
Merged

fix: repair native example builds#954
voltjia merged 1 commit into
masterfrom
fix/repair-native-example-builds

Conversation

@voltjia

@voltjia voltjia commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Enable the default CPU backend through the WITH_CPU CMake variable when
    no accelerator backend is selected, so raw CMake builds include the CPU
    sources and dependencies.
  • Update the GEMM examples to use InfiniRT's current
    kMemcpyHostToDevice and kMemcpyDeviceToHost runtime constants.

Motivation

Raw CMake builds exposed two inconsistent backend/runtime paths:

  • The default CPU fallback previously added only a preprocessor definition,
    leaving the WITH_CPU CMake variable disabled while backend sources were
    selected.
  • The GEMM examples still referenced removed, non-k InfiniRT memcpy
    constants, causing gemm and gemm_dispatch to fail compilation.

This restores the documented default CPU fallback and makes the examples
compatible with the current InfiniRT runtime API.

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)
  • Mars (WITH_MARS)
  • 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

InfiniOps commit: 00d139f5f39e398aca0d8f40f824bc21584c2f90
InfiniRT commit:  6b256e0ab0853d9e2a7ef059bac22c847bd02251
Environment: ssh nvidia, accelerator-dev/nvidia:latest

Pre-fix reproduction:
- NVIDIA builds of gemm and gemm_dispatch reproduced the missing
  MemcpyHostToDevice/MemcpyDeviceToHost member errors.

Exact-commit smoke validation:
$ INFINI_RT_ROOT=<prefix> scripts/dev/test.sh cpu --smoke
99 passed, 29 skipped, 6302 deselected in 7.25s

$ INFINI_RT_ROOT=<prefix> scripts/dev/test.sh nvidia --smoke
99 passed, 31 skipped, 7918 deselected in 16.50s

Direct raw CMake validation:
- Fresh default configuration with no backend option: CPU all-target build
  passed and gemm ran successfully.
- Explicit WITH_CPU=ON: gemm and gemm_dispatch targets built successfully.
- WITH_NVIDIA=ON and GENERATE_PYTHON_BINDINGS=OFF: all-target build passed;
  gemm and gemm_dispatch ran successfully; max_abs_diff: 0.

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
CPU Yes Local smoke and raw default/explicit CMake builds passed Clean full build/install passed; 2 unrelated test-selection failures
NVIDIA Yes Local smoke/raw examples and CI v2 shadow passed Clean full build/install passed; 34 unrelated MoE-path failures
Iluvatar Yes Primary and CI v2 shadow smoke passed Native examples not run locally
MetaX Yes Primary and CI v2 shadow smoke passed Native examples not run locally
Mars Yes Not tested - hardware/CI unavailable Backend owner validation required
Cambricon Yes CI blocked by unrelated existing linker failure Native examples not run locally
Moore Yes CI pending Native examples not run locally
Ascend Yes Primary smoke passed; shadow hit runner network failure Native examples not run locally
Full `pytest` output (optional)
CPU:
$ INFINI_RT_ROOT=<prefix> scripts/dev/test.sh cpu
Clean full build/install passed (646 overloads across 495 ops).
Pytest completed 11174 collected items with 2 failures in the NVIDIA-only
get_cutlass_moe_mm_data binding checks. The report plugin then raised a
NoneType/string sorting TypeError. Focused without the report plugin:
2 failed, 19 skipped in 0.32s.

NVIDIA:
$ INFINI_RT_ROOT=<prefix> scripts/dev/test.sh nvidia
Clean full build/install passed; pytest completed 13090 collected items.
Failures were limited to get_cutlass_moe_mm_data (2) and moe_wna16_gemm (32),
after which the same report-plugin TypeError occurred. Focused without the
report plugin: 34 failed, 50 passed, 4 skipped in 27.01s.

Benchmark / Performance Impact

N/A. This is a build/configuration compatibility fix; no
performance-sensitive runtime path changes.

Notes for Reviewers

  • The memcpy changes preserve the existing copy directions and runtime
    behavior.
  • A repository-wide scan found no other uses of the removed InfiniRT runtime
    member names.
  • CPU and NVIDIA smoke plus direct raw CMake validation passed on the exact
    commit. Both clean full builds/installations also passed.
  • Full-suite failures are outside this three-file diff. CPU lacks the
    NVIDIA-only GetCutlassMoeMmData binding but two generic precondition tests
    do not skip CPU. NVIDIA additionally has 32 existing moe_wna16_gemm
    numerical failures. Failed records then expose a separate tests/report.py
    None/string sorting bug.
  • Current CI snapshot: build, formatting, Ruff, Iluvatar, MetaX, primary
    Ascend, and NVIDIA CI v2 shadow passed. Primary NVIDIA failed while pip
    downloaded Ruff over SSL; Ascend shadow failed fetching the CI repository.
    Cambricon hit an existing generated-code linker conflict, and Moore remains
    pending.
  • Other affected accelerator native examples were not run locally because
    their hardware is unavailable; backend CI/owner validation is required.

@voltjia
voltjia marked this pull request as ready for review August 26, 2026 08:00
@voltjia
voltjia requested a review from a team August 26, 2026 08:00
@voltjia
voltjia merged commit 2d05aca into master Aug 26, 2026
14 of 20 checks passed
@voltjia
voltjia deleted the fix/repair-native-example-builds branch August 26, 2026 08:00
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