Skip to content

feat(cambricon): add copy provider - #927

Open
baominghelly wants to merge 1 commit into
masterfrom
feat/cambricon-copy
Open

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

Conversation

@baominghelly

@baominghelly baominghelly commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a CNNL-based Cambricon provider for Copy using cnnlCopy_v2.
  • Extend the shared CNNL tensor descriptor helper for scalar tensors and add scalar/strided KV-cache Copy coverage.

Motivation

Cambricon currently has no native provider for the non-deprecated Copy operator. This prevents layout-preserving, broadcast, and strided-output copy paths from running through InfiniOps on MLU devices.

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 Copy-only Cambricon build passed:

cmake -S /workspace/src/InfiniOps-pr-copy \
  -B /workspace/build/infiniops-pr-copy \
  -DWITH_CAMBRICON=ON \
  -DGENERATE_PYTHON_BINDINGS=ON \
  -DINFINI_OPS_OPS=copy \
  -DCMAKE_BUILD_TYPE=Release
cmake --build /workspace/build/infiniops-pr-copy --parallel 32

[100%] Built target ops

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 build passed 42 targeted Copy tests passed
Moore No N/A - not affected N/A - not affected
Ascend No N/A - not affected N/A - not affected
Targeted pytest output
PYTHONPATH=/workspace/build/infiniops-pr-copy-site \
LD_LIBRARY_PATH=/workspace/build/infiniops-pr-copy-site/infini:/workspace/install/infini-rt/lib:/usr/local/neuware/lib64 \
/torch/venv3/pytorch/bin/python3.10 -m pytest -q tests/test_copy.py --devices cambricon

..........................................                               [100%]
42 passed in 0.25s

Benchmark / Performance Impact

N/A. This adds a previously missing Cambricon provider and does not replace an existing implementation.

Notes for Reviewers

  • The provider supports scalar, broadcast, non-contiguous input, and strided output tensors, including KV-cache slice writes.
  • CNNL execution uses the caller's queue and validates caller-provided workspace capacity.
  • The shared descriptor update represents scalar tensors as a one-element CNNL array and uses the 64-bit descriptor interface.
  • No deprecated RearrangeInfinilm provider is added.

@baominghelly baominghelly changed the title feat(cambricon): add copy provider feat(cambricon): add Copy implementation Aug 12, 2026
@baominghelly
baominghelly marked this pull request as ready for review August 12, 2026 09:19
@baominghelly
baominghelly requested review from a team and voltjia August 12, 2026 09:19
@baominghelly baominghelly changed the title feat(cambricon): add Copy implementation feat(cambricon): add copy provider Aug 24, 2026
@baominghelly
baominghelly marked this pull request as draft August 24, 2026 02:01
@baominghelly
baominghelly marked this pull request as ready for review August 24, 2026 02:20
@baominghelly
baominghelly marked this pull request as draft August 24, 2026 02:42
@baominghelly
baominghelly marked this pull request as ready for review August 24, 2026 06:05
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