Skip to content

Commit 003a0c8

Browse files
committed
docs(20): lane 表那一列是规则「声明的」载荷,不是使用者要写的
1 parent 5731d82 commit 003a0c8

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

docs/20-heterogeneous-builds.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,19 @@ names: `tests/unit/test_core_vendor_probes.cpp` asserts that no vendor tool
479479
name appears in `src/` once comments are stripped, with the file count as its
480480
own denominator.
481481

482-
| feature of `mcpp:plugins` | module | compiler it drives | payloads it needs | `[build] accel` |
482+
| feature of `mcpp:plugins` | module | compiler it drives | payloads it declares | `[build] accel` |
483483
|---|---|---|---|---|
484484
| `rules-cuda` | `mcpp.rules.cuda` | the project's own clang (`-x cuda`), or nvcc with a GCC toolchain | `xim:cuda-nvcc`, `xim:cuda-cudart`, `xim:libcurand`, `xim:cuda-cccl` | `cuda12.9+{sm_89} ptx>=89` |
485485
| `rules-hip` | `mcpp.rules.hip` | the project's own clang (`-x cuda`) on the NVIDIA platform | the above plus `xim:hip-nvidia` | `hip, cuda12.9+{sm_89}` |
486486
| `rules-sycl` | `mcpp.rules.sycl` | the `xim:dpcpp` payload's clang (`-fsycl`) | `xim:dpcpp`, `xim:gcc`, `xim:cuda-nvcc` for an NVIDIA target | `sycl` or `sycl, cuda12.9+{sm_89}` |
487487
| `rules-spirv` | `mcpp.rules.spirv` | `glslangValidator` or `glslc` | `xim:glslang` or `xim:shaderc` | `vulkan1.2` |
488488
| `rules-ascendc` | `mcpp.rules.ascendc` | `bisheng` (`-x asc`) from the CANN toolkit | `xim:cann-toolkit` | `ascend8.5+{dav-c220}` |
489489

490+
The payload column is what each rule declares for itself under
491+
`cfg(accelerator = ...)`, listed so the cost of a lane is legible before it is
492+
taken. A project writes none of it -- see *The toolkit comes with the rule*
493+
above.
494+
490495
Two chunks, not one, in the `accel` value of the HIP and SYCL rows. The first
491496
names the programming model and the second names the device, so a device is
492497
spelled once in this ecosystem however many models reach it: `sm_89` is the

docs/zh/20-heterogeneous-builds.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,17 @@ sources = ["src/cpu/*.cpp"]
399399
`tests/unit/test_core_vendor_probes.cpp` 断言剥掉注释后 `src/` 里不出现任何厂商工具名,
400400
并自带分母(枚举到的文件数)。
401401

402-
| `mcpp:plugins` 的 feature | 模块 | 它驱动的编译器 | 它需要的载荷 | `[build] accel` |
402+
| `mcpp:plugins` 的 feature | 模块 | 它驱动的编译器 | 它声明的载荷 | `[build] accel` |
403403
|---|---|---|---|---|
404404
| `rules-cuda` | `mcpp.rules.cuda` | 工程自己的 clang(`-x cuda`),或 GCC 工具链下的 nvcc | `xim:cuda-nvcc``xim:cuda-cudart``xim:libcurand``xim:cuda-cccl` | `cuda12.9+{sm_89} ptx>=89` |
405405
| `rules-hip` | `mcpp.rules.hip` | NVIDIA 平台上是工程自己的 clang(`-x cuda`) | 上面那些,再加 `xim:hip-nvidia` | `hip, cuda12.9+{sm_89}` |
406406
| `rules-sycl` | `mcpp.rules.sycl` | `xim:dpcpp` 载荷里的 clang(`-fsycl`) | `xim:dpcpp``xim:gcc`,NVIDIA 目标另加 `xim:cuda-nvcc` | `sycl``sycl, cuda12.9+{sm_89}` |
407407
| `rules-spirv` | `mcpp.rules.spirv` | `glslangValidator``glslc` | `xim:glslang``xim:shaderc` | `vulkan1.2` |
408408
| `rules-ascendc` | `mcpp.rules.ascendc` | CANN 工具包里的 `bisheng`(`-x asc`) | `xim:cann-toolkit` | `ascend8.5+{dav-c220}` |
409409

410+
载荷那一列是每条规则在 `cfg(accelerator = ...)` 之下**为自己**声明的东西,列出来是为了
411+
让一条 lane 的代价在选它之前就可读。工程一个字都不用写——见上文「工具包跟着规则来」。
412+
410413
HIP 与 SYCL 两行的 `accel` 值是**两段**而不是一段。第一段命名编程模型,第二段命名设备,
411414
于是一个设备在本生态里只有一种拼法,无论有多少个模型去够它:`sm_89` 无论被哪条规则读到
412415
都是同一个 `sm_89`。只写 `accel = "sycl"` 而没有第二段,则编译到 SPIR-V,由运行期挑设备。

0 commit comments

Comments
 (0)