艾特反思

数据 社区

技能解读

当前原文的自动摘译,尚未人工审校。

概述

使用 aiter 工作流程优化 AMD MI300 GPU 内核的正确性和性能,然后将每次迭代记录到内核实验数据库中。

1) 定位目标并理解测试

使用提供的上下文来识别目标内核文件、内核及其操作测试。运行一次操作测试以了解输出格式并验证正确性预期。 (注意:后台op测试进程卡住以及jit文件夹下的锁定文件可能会导致op测试运行失败;op测试需要JIT编译,请做好长时间等待的准备)

2) 构建基准 shell 脚本

为本次迭代起一个新名称并创建一个文件夹logs/<新名称>。将 shell 脚本放在该文件夹下 重用现有的 op_test python 脚本 涵盖常见形状:128、256、512、1024、2048、4096(如果适用) 多次重复每个 op 测试并报告正确性和平均耗时。每个配置至少使用 100 次迭代以获得可靠的结果

3)建立基线

测试之前: 检查可能干扰的后台 GPU 进程 使用rocm-smi 或 ps aux | grep python 识别 GPU 任务 停止任何不相关的 GPU 工作负载 清除 JIT 编译缓存以确保干净状态 使用 .venv Python 环境运行基准测试脚本

4)迭代内核优化(一次迭代)

阅读内核源代码,识别瓶颈,并至少调用一次rocprof-compute以加深瓶颈分析。使用kernel-exp-history回顾相关优化历史并提取想法。修改内核文件以提高允许的多个形状的性能。保存更改:(git diff > logs/<new name>/iter<N>_diff.patch) 重新安装 aiter 并清除缓存:

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
数据
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
Python
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Aiter Reflection

## Overview

Optimize AMD MI300 GPU kernels for correctness and performance using the aiter workflow, then record each iteration to the kernel experiment database.

## Workflow

### 1) Locate targets and understand tests

- Use the provided context to identify target kernel files, kernels, and their op tests.
- Run the op tests once to understand output format and verify correctness expectations. (Attention: Stucked background op test processes and lock files under jit folder may cause the op tests running failed; Op tests require JIT compiling, please be prepared to wait for a long time)

### 2) Build a benchmark shell script
- Come up with a new name for this iteration and create a folder logs/<new name>. Put the shell script under this folder
- Reuse the existing op_test python script
- Covers common shapes: 128, 256, 512, 1024, 2048, 4096 if applies
- Repeats each op test multiple times and reports the correctness and the average time consuming.
  - Use at least 100 iterations per configuration for reliable results
  - Include 10-20 warmup iterations to handle JIT compilation overhead
  - Add torch.cuda.synchronize() after each kernel call
  - Use fixed random seed for reproducibility
  - Use high-precision timing (time.perf_counter())
- Implements a robust timeout to avoid hangs.
- Outputs structured timing per shape.

### 3) Establish a baseline

- **Before testing**: Check for background GPU processes that may interfere
  - Use `rocm-smi` or `ps aux | grep python` to identify GPU tasks
  - Stop any unrelated GPU workloads
- Clear JIT compilation cache to ensure clean state
- Run the benchmark script using the `.venv` Python environment
- Save results under logs/<new name> folder with timestamp


### 4) Iterate on kernel optimization (one iteration)

- Read the kernel source, identify bottlenecks, and call `rocprof-compute` at least once to deepen bottleneck analysis.
- Use `kernel-exp-history` to review related optimization history and extract ideas.
- Modify the kernel file to improve performance for multiple shapes allowed.
- Save the changes: (git diff > logs/<new name>/iter<N>_diff.patch)
- Reinstall aiter and clear cache:
  - `python -m pip install -e . --no-build-isolation --no-deps --force-reinstall`
  - `rm -f aiter/jit/*.so && rm -rf aiter/jit/build ~/.aiter`
- Re-run the benchmark to measure the new performance.
- **If results seem suspicious** (unexpected regressions):
  - Verify no background processes are running
  - Re-test baseline with same methodology
  - Check if JIT compilation overhead affected measurements


### 5) Record the iteration

- **Document the results**:
  - Save detailed analysis in logs/<name>/iter<N>_analysis.md
  - Include performance comparison table
  - Document any issues encountered (false regressions, test methodology problems)

- Use `kernel-exp-history` to store in database
- **Verify result quality**: If showing unexpected regression, investigate before recording
- Restore the repo code to the `main` branch state after finishing the iteration


### 6) Repeat iterations

- Repeat step 4 for ten iterations (no stop), each time measuring and recording results.

---
> Source: [AMD-AGI/Apex](https://github.com/AMD-AGI/Apex) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。