Skip to content

完成 LLAISYS 作业 1–4,支持 CPU、NVIDIA CUDA 与 天数BI-V150 - #62

Open
KevinQing17 wants to merge 4 commits into
InfiniTensor:mainfrom
KevinQing17:main
Open

完成 LLAISYS 作业 1–4,支持 CPU、NVIDIA CUDA 与 天数BI-V150 #62
KevinQing17 wants to merge 4 commits into
InfiniTensor:mainfrom
KevinQing17:main

Conversation

@KevinQing17

Copy link
Copy Markdown

本次提交完成了作业 1–4,主要包括:

  • 实现 Tensor 的 load、contiguity、view、permute 和 slice 语义;
  • 实现要求的 8 个 CPU 算子,并支持 FP32、FP16 和 BF16;
  • 实现带 KV Cache 的 Qwen2 / DeepSeek-R1-Distill-Qwen 贪心推理;
  • 实现 CUDA 兼容运行时以及全部 8 个 GPU 算子;
  • 通过统一后端同时支持 NVIDIA CUDA 和 Iluvatar BI-V150 / CoreX;
  • 增加可复现的 CPU、CUDA 边界测试以及 Tiny 模型端到端验证。

支持平台

平台 工具链 状态
Linux CPU GCC / Xmake Release Runtime、Tensor、8 个算子、Tiny Qwen2 以及真实 1.5B 模型推理均通过
NVIDIA RTX 4090 CUDA 13.2 / compute 8.9 完整构建、全部测试以及真实 1.5B 模型推理均通过
Iluvatar BI-V150 CoreX 4.4.0 完整构建、全部测试以及真实 1.5B 模型推理均通过

在 CPU 和两种 GPU 平台上,DeepSeek-R1-Distill-Qwen-1.5B 生成的 128-token 序列均与 Hugging Face 参考实现完全一致。

在验证环境中,CPU 后端完成 LLAISYS 推理生成耗时为 454.33 秒。

CI

GitHub Actions 已通过 Ubuntu 和 Windows Server 2022 的 Release 构建任务:

https://github.com/KevinQing17/llaisys-26s/actions/runs/31520743364

Validation notes

  • CUDA 边界测试覆盖:
    • 16,776,961 个元素的 grid-stride Add;
    • 65,536 行 RMSNorm;
    • 序列长度为 32,769 的 Attention;
    • head dimension 为 257;
    • zero-reduction Linear;
    • FP16 cancellation 场景。
  • Tiny Qwen2 验证覆盖:
    • 确定性生成;
    • one-shot prefill;
    • token-by-token prefill;
    • split prefill;
    • KV Cache reset。
  • 真实 1.5B 模型验证采用 greedy decoding,并对完整 token 序列进行逐项精确比较。

Implement Tensor operations, CPU operators, Qwen2 inference, CUDA/CoreX backends, and validation tests.

Source attribution: Portions of the CUDA runtime, GPU operators, and related CPU/interface/test code are based on public upstream PR wooway777#27 at commit 170a845; Tensor, Qwen2, numerical, interface, and validation fixes were made in this branch.
Replace runtime, operator, bindings, and CUDA/CoreX build implementations while preserving the existing test suite. Add manual GitHub Actions dispatch support.
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