Skip to content

feat(cambricon): add fill provider - #961

Draft
baominghelly wants to merge 1 commit into
masterfrom
feat/cambricon-fill
Draft

feat(cambricon): add fill provider#961
baominghelly wants to merge 1 commit into
masterfrom
feat/cambricon-fill

Conversation

@baominghelly

Copy link
Copy Markdown
Contributor

Summary

  • Add a native Cambricon slot 0 provider for fill in src/native/cambricon/ops/fill/.
  • Support host scalar and scalar Tensor values, contiguous and strided outputs, in-place execution, and empty tensors.
  • Use a dedicated raw 64-bit path for int64 and uint64, and skip unsupported Cambricon float64 test cases.

Motivation

InfiniOps did not have a native Cambricon provider for the canonical fill operator. This prevented Cambricon builds that explicitly select implementation 0 from executing fill operations through InfiniOps.

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

A targeted Cambricon operator build and test were run after rebasing onto the latest master. The repository-wide smoke build and smoke test set were not run, so this PR remains Draft.

cmake -S . -B /workspace/build/rebase-fill-20260901 \
  -DAUTO_DETECT_DEVICES=OFF \
  -DAUTO_DETECT_BACKENDS=OFF \
  -DWITH_CPU=ON \
  -DWITH_CAMBRICON=ON \
  -DWITH_TORCH=OFF \
  -DWITH_LINKED=OFF \
  -DGENERATE_OPERATOR_CALL_INSTANTIATIONS=ON \
  -DGENERATE_PYTHON_BINDINGS=ON \
  -DINFINI_OPS_OPS=fill \
  -DINFINI_RT_ROOT=/workspace/install/infinirt-master-test \
  -DPython_EXECUTABLE=/torch/venv3/pytorch/bin/python3.10 \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/workspace/build/rebase-fill-20260901-site/infini
cmake --build /workspace/build/rebase-fill-20260901 --parallel "$(nproc)"
cmake --install /workspace/build/rebase-fill-20260901
PYTHONNOUSERSITE=1 \
PYTHONPATH=/workspace/build/rebase-fill-20260901-site \
LD_LIBRARY_PATH=/workspace/build/rebase-fill-20260901-site/infini:/workspace/install/infinirt-master-test/lib:/usr/local/neuware/lib64:/usr/local/neuware/lib \
/torch/venv3/pytorch/bin/python3.10 -m pytest -q \
  tests/test_fill.py --devices cambricon --maxfail=1

[100%] Built target ops
48 passed, 6 skipped in 0.34s

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA No N/A - not affected N/A - not affected
Iluvatar No N/A - not affected N/A - not affected
MetaX No N/A - not affected N/A - not affected
Cambricon Yes Targeted fill build passed tests/test_fill.py: 48 passed, 6 skipped; repository smoke/full suite not run
Moore No N/A - not affected N/A - not affected
Ascend No N/A - not affected N/A - not affected
Full `pytest` output (optional)
..............................ssssss..................                   [100%]
48 passed, 6 skipped in 0.34s

Benchmark / Performance Impact

N/A — no performance benchmark was run.

Notes for Reviewers

  • FillUnion handles FP16, BF16, FP32, and integer types up to 32 bits using NRAM-sized chunks.
  • FillRaw64Union handles int64 and uint64 by copying the exact 8-byte value, avoiding unreliable typed 64-bit scalar handling in the MLU kernel path.
  • Contiguous outputs use bulk NRAM-to-GDRAM copies. Strided outputs use the shared logical-index-to-offset helper added by the merged Cambricon mul provider.
  • Cambricon float64 is intentionally not registered and its six test cases are skipped. Unsigned 16/32/64-bit paths are compiled but are not exercised by the current torch_mlu pytest input set.
  • clang-format --dry-run --Werror and git diff --check origin/master...HEAD passed. The repository-wide smoke and full suites were not run.

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