Skip to content

feat(kunlun): add Kunlun XPU runtime backend - #57

Open
rubik-hua wants to merge 2 commits into
InfiniTensor:masterfrom
rubik-hua:feat/kunlun-backend
Open

rubik-hua wants to merge 2 commits into
InfiniTensor:masterfrom
rubik-hua:feat/kunlun-backend

Conversation

@rubik-hua

Copy link
Copy Markdown

Register Kunlun as device type 10 (kKunlun) and wire the XRE runtime as a native backend:

  • cmake: WITH_KUNLUN option with device autodetection (/dev/xpu*); SDK root accepts a bare XRE tree or a torch_xmlir package root
  • src/native/kunlun: device_/runtime_/data_type_ shims over the xpu_* C API; runtime_ carries its own stream create/destroy/synchronize and a device-wide xpu_wait() as DeviceSynchronize (XRE has no whole-device sync)
  • link libxpurt.so; expose only the xpu/kernel XTDK header subtree to host compilation

端到端验证
XPU_VISIBLE_DEVICES=7 python3 examples/test_infer.py --device=kunlun --model=/mnt/infini/infrahi/infinilm-models/DeepSeek-R1-Distill-Qwen-7B --enable-paged-attn --attn flash-attn --prompt "你是谁"
image

Register Kunlun as device type 10 (kKunlun) and wire the XRE runtime as a
native backend:

- cmake: WITH_KUNLUN option with device autodetection (/dev/xpu*); SDK root
  accepts a bare XRE tree or a torch_xmlir package root
- src/native/kunlun: device_/runtime_/data_type_ shims over the xpu_* C API;
  runtime_ carries its own stream create/destroy/synchronize and a
  device-wide xpu_wait() as DeviceSynchronize (XRE has no whole-device sync)
- link libxpurt.so; expose only the xpu/kernel XTDK header subtree to host
  compilation
@rubik-hua
rubik-hua force-pushed the feat/kunlun-backend branch from 74d32e3 to 77ec2d5 Compare December 2, 2026 10:29
…N consumer fixes

  - Implement EventQuery/EventCreateWithFlags via xpu_event_*; zero-init EventElapsedTime output
  - Correct FreeAsync/DeviceSynchronize comments to measured behavior (xpu_free does not fence, xpu_wait waits only the
  default stream)
  - Fix KUNLUN_HOME probe (python-detect torch_xmlir; /usr/local/xpu has no XTDK) and add `so` suffix to xpurt lookup in
  install config

This branch has not been deployed

No deployments
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