Skip to content

Commit a11809e

Browse files
grissom.wangclaude
andcommitted
fix(scraper): self-healing re-scrapes; regenerate true 13.4 corpus
Three scraper defects had silently corrupted the earlier "13.4" scrape: - Doxygen list pages now render entries as self-anchored links (group__X.html#group__X); skipping all '#' links left runtime/driver discovery with 3-4 pages instead of ~130. Anchors are now stripped and deduped at page level. - _remove_toc() matched struct member declarations ("struct [Type](url#a) [field](#a)") as TOC lines and deleted the entire body of 31 runtime struct pages. Member lines are now excluded by keyword prefix and trailing pure-anchor-link shape. - Re-scrapes never cleaned the output dir, so upstream renames/renumbers accumulated orphan files (PTX ch.12 dual dirs, 365 renumbered 9.7.x files = 54% of the corpus). Runs now prune anything not rewritten, with guards: no prune on empty write-sets, refuse >50% deletion, abort --skip-download on incomplete raw caches. Empty Doxygen stub pages are filtered; the hand-maintained ptx INDEX.md is preserved. True 13.4 corpus (previously reported numbers were orphan-polluted or stale): ptx 679->505, runtime 104->101, driver 129->135, math 41->45, cublas 354->320, nccl 57->61. All annotations, counts, tree structures, and renamed PTX section references (9.7.15.5->9.7.17.5 WGMMA etc.) updated; scraper README documents the new behavior. Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent 110ac9d commit a11809e

661 files changed

Lines changed: 45803 additions & 70464 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CLAUDE.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ cuda-optimizer (orchestrator)
188188
└── cuda-code-generator → generate/rewrite .cu files with optimizations
189189
```
190190

191-
`cuda-knowledge` (~1570 markdown files) provides API reference based on CUDA Toolkit 13.4 (PTX ISA 9.4, cuBLAS 13.4, Runtime/Driver/Math API 13.4); `cuda-samples` (SKILL.md ~13 KB, 10 reference files 48 KB; ~50 curated entries) provides concrete working code patterns from official NVIDIA samples with GitHub permalinks and key snippets. Both follow progressive disclosure: lightweight SKILL.md stays in context, detailed references load on demand. All three action skills ground their work in both to reduce hallucination. The optimizer drives this loop: **benchmark → evaluate exit conditions → NCU profile → implement optimizations → repeat** until performance converges (<2% improvement over 2 consecutive rounds).
191+
`cuda-knowledge` (~1170 markdown files) provides API reference based on CUDA Toolkit 13.4 (PTX ISA 9.4, cuBLAS 13.4, Runtime/Driver/Math API 13.4); `cuda-samples` (SKILL.md ~13 KB, 10 reference files 48 KB; ~50 curated entries) provides concrete working code patterns from official NVIDIA samples with GitHub permalinks and key snippets. Both follow progressive disclosure: lightweight SKILL.md stays in context, detailed references load on demand. All three action skills ground their work in both to reduce hallucination. The optimizer drives this loop: **benchmark → evaluate exit conditions → NCU profile → implement optimizations → repeat** until performance converges (<2% improvement over 2 consecutive rounds).
192192

193193
### Kernel Interface Convention
194194

@@ -220,8 +220,8 @@ A single-file script with three scraper classes for different NVIDIA doc formats
220220

221221
```text
222222
skills/
223-
cuda-knowledge/references/ # ~1570 .md files, CUDA Toolkit 13.4 (PTX ISA 9.4)
224-
*-docs/ # Scraped documentation: ptx(870), cublas(357), runtime(104), driver(129), math(45), nccl(61)
223+
cuda-knowledge/references/ # ~1170 .md files, CUDA Toolkit 13.4 (PTX ISA 9.4)
224+
*-docs/ # Scraped documentation: ptx(505), cublas(320), runtime(101), driver(135), math(45), nccl(61)
225225
*.md # 11 search guides with grep patterns per API
226226
cuda-samples/
227227
SKILL.md # Quick reference table, optimization mapping, arch compatibility

‎nvidia-docs-ai-integration-guide.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@
6767

6868
## 3. 覆盖了哪些文档
6969

70-
转换后的文档覆盖 vLLM 开发最常用的 6 套参考资料,总计约 17 MB、1577 个文件(含搜索指南) :
70+
转换后的文档覆盖 vLLM 开发最常用的 6 套参考资料,总计约 15 MB、1178 个文件(含搜索指南) :
7171

7272
| 文档集 | 文件数 | 大小 | 主要内容 |
7373
| --------------------- | ------ | ------ | ---------------------------------------------- |
74-
| PTX ISA 9.4 | 870 | 10 MB | 完整指令集,`wgmma`、`cp.async`、`mbarrier` 等 |
75-
| CUDA Runtime API 13.4 | 104 | 1.1 MB | 37 模块 + 66 数据结构 |
76-
| CUDA Driver API 13.4 | 129 | 1.2 MB | 49 模块(含虚拟内存、 context 管理) |
74+
| PTX ISA 9.4 | 505 | 6.8 MB | 完整指令集,`wgmma`、`cp.async`、`mbarrier` 等 |
75+
| CUDA Runtime API 13.4 | 101 | 1.2 MB | 38 模块 + 62 数据结构 |
76+
| CUDA Driver API 13.4 | 135 | 2.0 MB | 50 模块(含虚拟内存、 context 管理) |
7777
| CUDA Math API 13.4 | 45 | 548 KB | `half` / `bfloat16` / FP8 内置函数,类型转换 |
78-
| cuBLAS 13.4 | 357 | 3.0 MB | GEMM、`cuBLASLt`、FP8 GEMM、epilogue 融合 |
78+
| cuBLAS 13.4 | 320 | 2.9 MB | GEMM、`cuBLASLt`、FP8 GEMM、epilogue 融合 |
7979
| NCCL | 61 | 876 KB | API + 使用指南 + 全量环境变量 |
8080

8181
文档经过清洗:去掉重复 TOC、导航栏、冗余 URL、版权声明等噪音,**体积压缩 76-83%**,只保留你真正需要的内容。

‎nvidia_doc_sync/README.md‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ usage: scrape_cuda_docs.py [-h] [--output-dir OUTPUT_DIR] [--skip-download] [--f
5454

5555
| 参数 | 描述 |
5656
| --------- | ----------------------------------------------------------------------- |
57-
| `ptx` | 抓取 PTX ISA 文档(单页面结构,会被拆分为约 679 个文件) |
57+
| `ptx` | 抓取 PTX ISA 文档(单页面结构,会被拆分为约 505 个文件) |
5858
| `runtime` | 抓取 CUDA Runtime API 文档(多页面结构:包含模块和数据结构) |
5959
| `driver` | 抓取 CUDA Driver API 文档(多页面结构:包含模块和数据结构) |
60-
| `math` | 抓取 CUDA Math API 文档(多页面结构:包含模块和数据结构,约 41 个文件) |
61-
| `cublas` | 抓取 cuBLAS 文档(单页面 Sphinx 结构,按章节拆分为约 354 个文件) |
62-
| `nccl` | 抓取 NCCL 文档(多页面 Sphinx 站点,约 57 个文件,按主题组织) |
60+
| `math` | 抓取 CUDA Math API 文档(多页面结构:包含模块和数据结构,约 45 个文件) |
61+
| `cublas` | 抓取 cuBLAS 文档(单页面 Sphinx 结构,按章节拆分为约 320 个文件) |
62+
| `nccl` | 抓取 NCCL 文档(多页面 Sphinx 站点,约 61 个文件,按主题组织) |
6363

6464
### 3.2 选项参数
6565

@@ -72,6 +72,13 @@ usage: scrape_cuda_docs.py [-h] [--output-dir OUTPUT_DIR] [--skip-download] [--f
7272
| `--force` | `false` | 强制重新下载所有页面,即使文件已被缓存 |
7373
| `-h, --help` | — | 显示帮助信息并退出 |
7474

75+
### 3.3 行为说明(重抓时的自愈逻辑)
76+
77+
- **链接发现**:Doxygen 列表页(`modules.html` / `annotated.html`)中的链接会先剥离 `#锚点` 再按页面去重——NVIDIA 13.x 将列表条目渲染为自锚定链接(`group__X.html#group__X`),直接跳过带 `#` 的链接会导致几乎漏掉全部模块页。
78+
- **空页过滤**:清理阶段会跳过仅有标题和 Source 头、无正文的 Doxygen 占位页(如 `structCUtensorMap`)。
79+
- **孤儿清理(prune)**:每次抓取结束后,输出目录中未被本次重新写入的 `*.md` 会被删除,空目录一并移除——上游重命名/重编号章节时不再留下旧文件副本(PTX 第 12 章的双目录、9.7.x 重编号残留即由此产生)。PTX 顶层手工维护的 `INDEX.md` 会被保留。
80+
- **安全护栏**:本次运行一个文件都没写入时跳过清理;待删文件超过现有 corpus 一半时拒绝执行(更可能是抓取失败而非上游重构);`--skip-download` 检测到原始缓存明显少于现有输出(不完整缓存)时直接中止,避免用残缺缓存缩小语料库并覆盖 `INDEX.md`。
81+
7582
---
7683

7784
## 4. 输出结构
@@ -88,7 +95,7 @@ skills/cuda-knowledge/references/ptx-docs/
8895
├── 1-introduction/
8996
├── 2-programming-model/
9097
├── ...
91-
└── 9-instruction-set/ # 约 186 个文件
98+
└── 9-instruction-set/ # 约 228 个文件
9299
```
93100

94101
内容按照标题层级进行拆分,并组织在带编号的章节目录中。
@@ -104,7 +111,7 @@ skills/cuda-knowledge/references/cublas-docs/
104111
├── 2-using-the-cublas-api/
105112
├── 3-using-the-cublaslt-api/
106113
├── 4-using-the-cublasxt-api/
107-
└── ... # 总计约 354 个文件
114+
└── ... # 总计约 320 个文件
108115
```
109116

110117
与 PTX ISA 采用相同的按标题拆分策略 —— cuBLAS 文档也是一个单页面的 Sphinx HTML 文件。
@@ -131,7 +138,7 @@ skills/cuda-knowledge/references/cuda-{runtime,driver}-docs/
131138
# Math API 文档输出结构示例
132139
skills/cuda-knowledge/references/cuda-math-docs/
133140
├── modules/ # 14 个文件 —— 单/双精度、半精度、bfloat16、FP8/FP6/FP4、SIMD、类型转换、整数等
134-
├── data-structures/ # 26 个文件 —— __half、__nv_bfloat16、__nv_fp8_*、__nv_fp6_*、__nv_fp4_*
141+
├── data-structures/ # 30 个文件 —— __half、__nv_bfloat16、__nv_fp8_*、__nv_fp6_*、__nv_fp4_*、__nv_tf32
135142
└── INDEX.md
136143
```
137144

@@ -144,9 +151,9 @@ skills/cuda-knowledge/references/cuda-math-docs/
144151
```text
145152
# NCCL 文档输出结构示例
146153
skills/cuda-knowledge/references/nccl-docs/
147-
├── usage/ # 11 个文件 —— 通信器、集合通信、流、P2P、CUDA 图等
148-
├── api/ # 12 个文件 —— 集合通信、通信器、P2P、类型、操作、标志、设备 API 等
149-
├── troubleshooting/ # 1 个文件 —— RAS 子系统
154+
├── usage/ # 12 个文件 —— 通信器、集合通信、流、P2P、CUDA 图、CFT 等
155+
├── api/ # 14 个文件 —— 集合通信、通信器、P2P、类型、操作、标志、参数、设备 API 等
156+
├── troubleshooting/ # 7 个文件 —— 诊断、GPU/网络/运行时问题、调优、日志、RAS
150157
├── overview.md # NCCL 概念与拓扑结构
151158
├── setup.md # 安装指南
152159
├── env.md # 完整的环境变量参考

0 commit comments

Comments
 (0)