You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/architecture/system-blueprint.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,14 +18,17 @@ This page is a full component-level blueprint of the SGEMM optimization system.
18
18
19
19
| Component | Role | Constraints |
20
20
|---|---|---|
21
-
|`main.cu` entry | Parses arguments, selects kernel variant, routes to benchmarking or correctness check | Must not hard-code a variant; selection is runtime |
22
-
|`kernels/sgemm_naive.cuh`| Baseline FP32, one thread per output element | Establishes the cost model; no shared memory |
23
-
|`kernels/sgemm_tiled.cuh`| Tiled FP32 with shared-memory staging | Tile size is a compile-time template parameter |
24
-
|`kernels/sgemm_bank_free.cuh`| Tiled FP32 with padding to eliminate bank conflicts | Padding is the only structural difference from tiled |
25
-
|`kernels/sgemm_double_buffer.cuh`| Overlapped staging and compute using double buffering | Requires at least two staging buffers in shared memory |
26
-
|`kernels/sgemm_tensor_core.cuh`| WMMA-based computation with FP32 entry path | Guarded by device capability and shape divisibility |
27
-
|`utils/cuda_check.h`| RAII-based error propagation for CUDA API and kernel calls | Throws `std::runtime_error` on failure; no silent returns |
28
-
|`utils/matrix.h`| Host-side matrix initialization and reference computation | Row-major layout; reference uses CPU BLAS or naive FP64 loop |
21
+
|`src/main.cu`| Parses arguments, delegates to `CliParser` and `BenchmarkRunner`| Must keep one runtime-controlled entry path |
22
+
|`src/cli_parser.cuh`| Maps CLI flags to benchmark/verification modes | Shape labels and mode switches stay centralized |
23
+
|`src/benchmark_runner.cuh`| Routes each configured run through benchmarking and reporting | Shared host orchestration keeps cross-kernel comparisons consistent |
24
+
|`src/kernels/naive_sgemm.cuh`| Baseline FP32, one thread per output element | Establishes the cost model; no shared memory |
25
+
|`src/kernels/tiled_sgemm.cuh`| Tiled FP32 with shared-memory staging | Tile size is a compile-time template parameter |
26
+
|`src/kernels/bank_conflict_free_sgemm.cuh`| Tiled FP32 with padding to eliminate bank conflicts | Padding is the only structural difference from tiled |
27
+
|`src/kernels/double_buffer_sgemm.cuh`| Overlapped staging and compute using double buffering | Requires two staging buffers in shared memory |
28
+
|`src/kernels/tensor_core_sgemm.cuh`| WMMA-based computation for aligned Tensor Core shapes | Guarded by device capability and shape divisibility |
29
+
|`src/kernels/tensor_core_fallback.cuh`| Safe mixed-precision entry and fallback logic | Must preserve FP32 correctness on unsupported shapes |
30
+
|`src/utils/cuda_utils.cuh`| CUDA error macros, RAII device memory, device metadata | Uses `CUDA_CHECK` / `CUBLAS_CHECK`; no silent failure path |
31
+
|`src/utils/verify.cuh`| cuBLAS-backed oracle verification and tolerance policy | Reference is computed against cuBLAS on the active GPU |
29
32
|`tests/test_sgemm.cu`| cuBLAS-backed oracle correctness suite | Runs only on GPU; not included in hosted CI |
30
33
| Docs site | Narrative layer — architecture, academy, validation, research | VitePress with bilingual routes; no runtime GPU dependency |
All CUDA API calls and kernel launches are wrapped in `cudaCheck()`. This ensures that any failure path immediately terminates with a traceable error rather than silently propagating incorrect results through the pipeline.
62
+
All CUDA API calls and kernel launches are wrapped in `CUDA_CHECK`, and cuBLAS calls are wrapped in `CUBLAS_CHECK`. This ensures that any failure path immediately terminates with a traceable error rather than silently propagating incorrect results through the pipeline.
60
63
61
64
**Consequence:** Test code cannot accidentally swallow an error and then compare incorrect output against the cuBLAS oracle, which would make a failing kernel appear to pass.
62
65
@@ -85,7 +88,7 @@ The blueprint explicitly separates compile-time-verifiable invariants from runti
85
88
| Invariant class | Verifiable where |
86
89
|---|---|
87
90
| File structure, docs, OpenSpec alignment | Hosted CI |
88
-
| CUDA code compiles without warning | Hosted CI (compile-only)|
91
+
| CUDA code compiles and runs on a real CUDA toolchain | Local GPU-capable machine|
89
92
| Correctness under cuBLAS oracle | Local GPU run |
90
93
| Benchmark numbers and speedup ratios | Local GPU run with named hardware |
0 commit comments