赛题 #37: ReduceSum, SortPair, TopkPair 算法优化 #8

Open
xingjian wants to merge 5 commits from xingjian/GPUKernelContest:main into main
First-time contributor

赛题 #37: ReduceSum, SortPair, TopkPair 算法优化

性能提升 (对比 Thrust 基准)

算法 1M 数据 128M 数据 512M 数据 1G 数据
ReduceSum +73% +16% +3% +1%
SortPair +68% +9% +9% +9%
TopkPair +75% +11% +11% +11%

优化技术

  1. ReduceSum:

    • 自定义 kernel:Warp shuffle reduction
    • 向量化加载 (float4)
    • 连续内存访问模式
  2. SortPair / TopkPair:

    • 使用 mccub DeviceRadixSort (MetaX CUB library)
    • 优化的临时缓冲区管理

测试环境

  • GPU: MetaX C500 (64GB)
  • MACA: 3.0.0.8
  • 所有正确性测试通过

关联 Issue

Closes #37

加分项说明

  • 使用 LLM 辅助生成代码
  • 代码规范、清晰
  • 性能优化明显
## 赛题 #37: ReduceSum, SortPair, TopkPair 算法优化 ### 性能提升 (对比 Thrust 基准) | 算法 | 1M 数据 | 128M 数据 | 512M 数据 | 1G 数据 | |------|--------|----------|----------|--------| | **ReduceSum** | +73% | +16% | +3% | +1% | | **SortPair** | +68% | +9% | +9% | +9% | | **TopkPair** | +75% | +11% | +11% | +11% | ### 优化技术 1. **ReduceSum**: - 自定义 kernel:Warp shuffle reduction - 向量化加载 (float4) - 连续内存访问模式 2. **SortPair / TopkPair**: - 使用 mccub DeviceRadixSort (MetaX CUB library) - 优化的临时缓冲区管理 ### 测试环境 - GPU: MetaX C500 (64GB) - MACA: 3.0.0.8 - 所有正确性测试通过 ✅ ### 关联 Issue Closes #37 ### 加分项说明 - ✅ 使用 LLM 辅助生成代码 - ✅ 代码规范、清晰 - ✅ 性能优化明显
xingjian added 4 commits 2025-12-03 15:08:37 +08:00
b1355c19d9 feat(S1/37): Optimize ReduceSum, SortPair, TopkPair algorithms
Performance improvements (vs Thrust baseline):
- ReduceSum: +73% (1M), +16% (128M), +3% (512M), +1% (1G)
- SortPair: +68% (1M), +9% (128M-1G)
- TopkPair: +75% (1M), +11% (128M-1G)

Optimization techniques:
- ReduceSum: Custom kernel with warp shuffle + vectorized float4 load + contiguous memory access
- SortPair: mccub DeviceRadixSort (MetaX CUB library)
- TopkPair: mccub DeviceRadixSort with optimized buffer management

All tests passed on MetaX C500 GPU (MACA 3.0.0.8)

Issue: #37
a087148618 docs(S1/37): Add optimization report with LLM prompts
- Detailed performance analysis for all three algorithms
- Hardware-specific optimization strategies documented
- LLM (Claude) prompts recorded for bonus points
- Experience summary and lessons learned
6aecbb980e docs(S1/37): Update report with reusable LLM prompt templates
- Added 5 general-purpose prompt templates for GPU optimization
- Included prompt usage tips and best practices
- Removed verbose process descriptions
- Templates can be reused for other GPU optimization tasks
ffcd1fadad docs(S1/37): Separate LLM prompt templates into standalone file
- Created LLM_PROMPT_TEMPLATES.md with 5 reusable prompt templates
- Updated OPTIMIZATION_REPORT.md to reference the templates file
- Keep optimization strategies in main report
xingjian added 1 commit 2025-12-03 15:23:17 +08:00
659b02bbe8 docs(S1/37): Remove unused section and clarify prompt usage
- Deleted the unused section on using Claude for assistance
- Streamlined the document for better clarity and focus on prompt templates
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b xingjian-main main
git pull main

Step 2:

Merge the changes and update on Gitea.
git checkout main
git merge --no-ff xingjian-main
git push origin main
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ccf-ai-infra/GPUKernelContest#8
No description provided.