with one click
ptx-grammar-modification
PTX ANTLR4 语法修改流程 — 强制 TDD 流程、错误分类、测试验证
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
PTX ANTLR4 语法修改流程 — 强制 TDD 流程、错误分类、测试验证
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
PTX-EMU 项目经验沉淀 — 跨模块状态翻译、递归锁、分 Phase commit、基线 worktree、qualifier 类型判断等具体失败模式与可复用 checklist。来自 2026-06 barrier module 迁移 + 2026-07 cute_rmsnorm float 类型判断实战
ADR 合规检查 — 开发完成后对照 ADR 检查清单验证实现是否符合架构决策
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
PTX-EMU 专用调试技能 - 自动化调试配置选择和场景化调试方法
| name | ptx-grammar-modification |
| description | PTX ANTLR4 语法修改流程 — 强制 TDD 流程、错误分类、测试验证 |
| when_to_use | PTX-EMU 项目中出现以下**任一**匹配时触发: - ANTLR 解析错误: "no viable alternative", "mismatched input", "extraneous input" - PTX 文件解析失败: "Failed to parse PTX file" - 修改了 src/grammar/*.g4 文件 - 需要添加新的 PTX 指令语法 |
| skills_required | ["test-driven-development"] |
遇到错误 → 是 ANTLR 解析错误? → 是 → 🛑 使用本技能
→ 否 → 普通 C++ 调试流程
no viable alternative / mismatched input)docs/ptx/ 对应章节./tests/ptx/test_all_ptx.shcuobjdump -xptx 提取 PTX → 复制到 tests/ptx/.g4 → cmake --build build --target GenerateParser./tests/ptx/test_all_ptx.sh 全部通过才能交付# 1. RED - 运行测试确认失败
./tests/ptx/test_all_ptx.sh
# 2. GREEN - 修复语法
# 修改 src/grammar/ptxLexer.g4 和/或 ptxParser.g4
cmake --build build --target GenerateParser
cmake --build build --target cudart
# 3. REFACTOR - 验证
./tests/ptx/test_all_ptx.sh # 全部通过
cd build && ctest -L ptx # PTX 测试全绿
ctest 代替 ./tests/ptx/test_all_ptx.shdocs/ptx/ 就改语法build/antlr4_generated_src/ 中的生成文件| 内容 | 路径 |
|---|---|
| 语法文件 | src/grammar/ptxLexer.g4, ptxParser.g4 |
| 重新生成 | cmake --build build --target GenerateParser |
| 生成输出 | build/antlr4_generated_src/ |
| PTX 文档 | docs/ptx/README.md |
| 批量测试 | ./tests/ptx/test_all_ptx.sh |
| 错误 | 原因 | 解决 |
|---|---|---|
| 忘记重新生成解析器 | 改 .g4 后未运行 GenerateParser | cmake --build build --target GenerateParser |
| 破坏现有语法 | 新规则影响已有解析 | 运行 test_all_ptx.sh 检查回归 |
| Token 定义错误 | 词法 token 与 PTX 语法不匹配 | Token 必须精确匹配(含前导点) |
| 手动编辑生成文件 | 修改 build/antlr4_generated_src/ | 永远不要手动编辑生成文件 |