Skip to content

Commit a27b2b9

Browse files
LessUpCopilot
andcommitted
chore: finalize repository closeout
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c68411c commit a27b2b9

29 files changed

Lines changed: 334 additions & 382 deletions

File tree

.clang-tidy

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
# Clang-tidy configuration for SGEMM Optimization Project
3-
# Focuses on correctness and performance issues, avoids style nitpicks
3+
# Focuses on correctness/performance issues and avoids naming rules that fight
4+
# CUDA, cuBLAS, WMMA, and Google Test conventions.
45

56
Checks: >
67
-*,
@@ -11,7 +12,6 @@ Checks: >
1112
-modernize-use-trailing-return-type,
1213
-modernize-use-nodiscard,
1314
performance-*,
14-
readability-identifier-naming,
1515
-readability-function-cognitive-complexity,
1616
-readability-identifier-length,
1717
-readability-magic-numbers
@@ -21,27 +21,5 @@ WarningsAsErrors: ''
2121
HeaderFilterRegex: '.*'
2222

2323
CheckOptions:
24-
- key: readability-identifier-naming.NamespaceCase
25-
value: lower_case
26-
- key: readability-identifier-naming.FunctionCase
27-
value: lower_case
28-
- key: readability-identifier-naming.VariableCase
29-
value: lower_case
30-
- key: readability-identifier-naming.ConstantCase
31-
value: UPPER_CASE
32-
- key: readability-identifier-naming.ConstantPrefix
33-
value: 'k'
34-
- key: readability-identifier-naming.ParameterCase
35-
value: lower_case
36-
- key: readability-identifier-naming.StructCase
37-
value: lower_case
38-
- key: readability-identifier-naming.ClassCase
39-
value: lower_case
40-
- key: readability-identifier-naming.EnumConstantCase
41-
value: lower_case
42-
- key: readability-identifier-naming.MemberCase
43-
value: lower_case
44-
- key: readability-identifier-naming.PrivateMemberSuffix
45-
value: '_'
4624
- key: performance-move-const-arg.CheckTriviallyCopyableMove
4725
value: '0'

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ Index:
55
Background: Build
66

77
Diagnostics:
8+
# CUDA toolkit headers and generated compile flags vary across machines; keep
9+
# clangd focused on semantic navigation rather than noisy include hygiene.
810
UnusedIncludes: None

.github/copilot-instructions.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
# Copilot Instructions
22

3-
This repository is in a **closeout-oriented** phase. Optimize for consolidation, clarity, and archive-ready stability.
3+
Use `AGENTS.md` for shared repository rules and `openspec/AGENTS.md` for OpenSpec workflow details. This file only records Copilot-specific deltas.
44

5-
## Repository Rules
5+
## Copilot Defaults
66

7-
- Treat `openspec/specs/*` as the authoritative stable spec source.
8-
- Use active change artifacts under `openspec/changes/<change>/` as the implementation contract.
9-
- Prefer deleting or merging redundant docs, workflows, and configs over preserving duplicate files.
10-
- Keep `README.md` as the repo entry point and `index.md` + `docs/` as the public landing/documentation surface.
11-
12-
## Working Preferences
13-
14-
- Prefer CMake-based validation and `openspec validate --all` for repository-wide changes.
15-
- Use `gh` for repository metadata and GitHub-side operations.
16-
- Assume `clangd` + `compile_commands.json` is the shared LSP baseline.
17-
- Avoid adding project-level instructions unless they are specific to this repository and do not duplicate existing guidance.
7+
- Prefer concise, surgical changes on `master`; do not create release/version branch automation.
8+
- Use `gh` for repository metadata, Actions inspection, and GitHub-side maintenance.
9+
- Prefer CMake/OpenSpec validation commands already documented in `AGENTS.md`; do not invent extra tooling.
10+
- Keep generated guidance repository-specific to CUDA SGEMM, GitHub Pages, and OpenSpec closeout work.

.github/workflows/openspec-validation.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ on:
1313
- 'README.md'
1414
- 'README.zh-CN.md'
1515
- '_config.yml'
16+
- '_includes/**'
17+
- '_sass/**'
18+
- 'assets/**'
1619
- 'docs/**'
20+
- 'index.md'
1721
- 'openspec/**'
1822
- 'specs.md'
23+
- 'zh/**'
1924
push:
2025
branches: [master]
2126
paths:
@@ -28,9 +33,14 @@ on:
2833
- 'README.md'
2934
- 'README.zh-CN.md'
3035
- '_config.yml'
36+
- '_includes/**'
37+
- '_sass/**'
38+
- 'assets/**'
3139
- 'docs/**'
40+
- 'index.md'
3241
- 'openspec/**'
3342
- 'specs.md'
43+
- 'zh/**'
3444
workflow_dispatch:
3545

3646
jobs:
@@ -73,9 +83,9 @@ jobs:
7383
- name: Validate ID uniqueness
7484
run: |
7585
# Match complete IDs only, exclude sub-IDs like REQ-KERNEL-001.1
76-
req_dups=$(grep -rh "REQ-" openspec/specs/ 2>/dev/null | grep -oE "REQ-[A-Z]+-[0-9]+(?!\.[0-9])" | sort | uniq -d)
77-
dec_dups=$(grep -rh "DEC-" openspec/specs/ 2>/dev/null | grep -oE "DEC-[A-Z]+-[0-9]+(?!\.[0-9])" | sort | uniq -d)
78-
con_dups=$(grep -rh "CON-" openspec/specs/ 2>/dev/null | grep -oE "CON-[A-Z]+-[0-9]+(?!\.[0-9])" | sort | uniq -d)
86+
req_dups=$(grep -rhPo "REQ-[A-Z]+-[0-9]+(?!\.[0-9])" openspec/specs/ 2>/dev/null | sort | uniq -d)
87+
dec_dups=$(grep -rhPo "DEC-[A-Z]+-[0-9]+(?!\.[0-9])" openspec/specs/ 2>/dev/null | sort | uniq -d)
88+
con_dups=$(grep -rhPo "CON-[A-Z]+-[0-9]+(?!\.[0-9])" openspec/specs/ 2>/dev/null | sort | uniq -d)
7989
8090
test -z "$req_dups" || (echo "::error::Duplicate REQ IDs found: $req_dups" && exit 1)
8191
test -z "$dec_dups" || (echo "::error::Duplicate DEC IDs found: $dec_dups" && exit 1)
@@ -85,7 +95,7 @@ jobs:
8595
run: |
8696
legacy_files=$(grep -RInE '(^|[[:space:]`(])specs/(product|rfc|testing)/' \
8797
AGENTS.md CLAUDE.md CHANGELOG.md CONTRIBUTING.md README.md README.zh-CN.md \
88-
specs.md openspec/README.md openspec/AGENTS.md docs .github/workflows 2>/dev/null || true)
98+
specs.md zh/specs.md openspec/README.md openspec/AGENTS.md docs zh/docs .github/workflows 2>/dev/null || true)
8999
if [ -n "$legacy_files" ]; then
90100
echo "::error::Legacy spec path references found:"
91101
echo "$legacy_files"
@@ -100,3 +110,10 @@ jobs:
100110
echo "$nav_orders"
101111
exit 1
102112
fi
113+
114+
zh_nav_orders=$(grep -rh "nav_order:" zh/docs/ 2>/dev/null | sort | uniq -d)
115+
if [ -n "$zh_nav_orders" ]; then
116+
echo "::error::Duplicate nav_order values found in zh/docs/:"
117+
echo "$zh_nav_orders"
118+
exit 1
119+
fi

.github/workflows/pages.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# GitHub Pages Deployment
2-
# Builds and deploys the project documentation site to GitHub Pages
3-
# Uses Jekyll with just-the-docs theme
2+
# Builds and deploys the public documentation portal.
43

54
name: Deploy to GitHub Pages
65

@@ -40,16 +39,6 @@ jobs:
4039
- name: Setup Pages
4140
uses: actions/configure-pages@v5
4241

43-
- name: Cache Jekyll build
44-
uses: actions/cache@v4
45-
with:
46-
path: |
47-
.jekyll-cache
48-
_site
49-
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.md', '**/*.yml') }}
50-
restore-keys: |
51-
${{ runner.os }}-jekyll-
52-
5342
- name: Build with Jekyll
5443
uses: actions/jekyll-build-pages@v1
5544
with:

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ If two files say the same thing, keep one and remove the other.
3131
4. `/review` before large deletions, workflow changes, or archive
3232
5. `/opsx:archive` only after specs, docs, workflows, and validation agree
3333

34+
## Branch and Worktree Policy
35+
36+
- `master` is the only long-lived branch.
37+
- Short-lived local branches or worktrees are allowed only as temporary isolation for a specific task.
38+
- Before closeout, merge completed work back to `master`, delete temporary branches/worktrees, and ensure local and remote branch lists contain no stale task branches.
39+
- Do not add release/version branch automation; this repository favors a single-mainline closeout flow.
40+
3441
## Repository Boundaries
3542

3643
### Code

CLAUDE.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
11
# CLAUDE.md
22

3-
Claude-specific operating notes for this repository.
3+
Claude-specific deltas for this repository. Shared repository rules live in `AGENTS.md`; OpenSpec rules live in `openspec/AGENTS.md`.
44

5-
## Preferred Command Flow
5+
## Command Flow
66

7-
1. Use `/opsx:explore` if the cleanup scope or trade-offs are not clear.
8-
2. Use `/opsx:propose` and `/opsx:apply` for any non-trivial repo-wide cleanup.
9-
3. Use `/review` before:
10-
- deleting multiple files
11-
- changing workflow topology
12-
- archiving an OpenSpec change
13-
4. Use `/opsx:archive` only after specs, docs, workflows, and validation are aligned.
7+
1. Use `/opsx:explore`, `/opsx:propose`, `/opsx:apply`, `/review`, and `/opsx:archive` for non-trivial repository-wide changes.
8+
2. Use `/review` before deleting multiple files, changing workflow topology, or archiving an OpenSpec change.
9+
3. Avoid `/fleet` unless the work is genuinely independent and will not create branch/worktree cleanup debt.
1410

15-
## How to Work Here
11+
## Claude Operating Notes
1612

17-
- The repository is in a **finish-and-stabilize** phase, not a feature-expansion phase.
18-
- Prefer one longer implementation pass over many small speculative branches.
19-
- Use subagents for bounded research or log inspection, not for broad uncontrolled fan-out.
20-
- Avoid `/fleet` by default; only use it when tasks are truly independent and parallelizable.
21-
22-
## Tooling Baseline
23-
24-
- Regenerate `compile_commands.json` through the normal CMake configure step.
25-
- Treat `clangd` as the shared C/CUDA navigation baseline across tools.
26-
- Prefer `gh` for About/topics/homepage, Actions, issues, and PR metadata.
27-
- Prefer skills/native CLI over heavyweight MCP integration unless a concrete gain is obvious.
28-
- Use `/review` as the primary quality gate before major cleanup milestones.
29-
- Use `/research` or remote-only assistance sparingly, mainly when repository-local evidence is insufficient.
30-
31-
## Repository-Specific Reminders
32-
33-
- `openspec/specs/*` is the stable source of truth.
34-
- `README.md` is the repository entry point; `index.md` + `docs/` are the public landing/documentation surface.
35-
- Remove or merge redundant docs instead of preserving decorative placeholders.
36-
- Keep instructions concise and repository-specific; do not re-import generic AI handbook content.
13+
- Keep one long-running closeout pass on `master` unless isolation is necessary; temporary worktrees must be merged and removed before completion.
14+
- Prefer repository-local evidence, OpenSpec artifacts, `gh`, and clangd/compile commands over remote-only research.
15+
- Do not duplicate `AGENTS.md` content here; update the shared guide if a rule applies to all AI tools.

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Stable specs live under `openspec/specs/`. Active changes live under `openspec/c
2828
4. `/review` before major deletions, workflow changes, or archive
2929
5. `/opsx:archive` once tasks, docs, specs, and validation all agree
3030

31+
## Branch model
32+
33+
`master` is the only long-lived branch. Use a short-lived local branch or worktree only when a task needs isolation, then merge it back to `master` and delete the temporary branch/worktree before closeout. Do not introduce release/version branch automation for routine changes.
34+
3135
## Validation
3236

3337
```bash

README.md

Lines changed: 24 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,56 @@
22

33
[![CI](https://github.com/LessUp/sgemm-optimization/actions/workflows/ci.yml/badge.svg)](https://github.com/LessUp/sgemm-optimization/actions/workflows/ci.yml)
44
[![Pages](https://github.com/LessUp/sgemm-optimization/actions/workflows/pages.yml/badge.svg)](https://lessup.github.io/sgemm-optimization/)
5-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.md)
66
![CUDA](https://img.shields.io/badge/CUDA-11.0+-76B900?logo=nvidia&logoColor=white)
77
![C++](https://img.shields.io/badge/C%2B%2B-17-00599C?logo=c%2B%2B&logoColor=white)
88

99
English | [简体中文](README.zh-CN.md)
1010

11-
Progressive CUDA SGEMM tutorial and reference implementation, from naive kernels to Tensor Core WMMA. Includes cuBLAS-backed verification, benchmark harness, and OpenSpec-governed repository rules.
11+
A compact CUDA SGEMM learning project that walks from a readable baseline kernel to Tensor Core WMMA, with cuBLAS verification and a CMake-first build.
1212

13-
## Why this repository exists
13+
## What makes it useful
1414

15-
- **Show the optimization ladder clearly**: naive → tiled → bank-conflict-free → double-buffer → Tensor Core WMMA
16-
- **Stay readable**: each optimization lives in its own kernel file with a consistent launch interface
17-
- **Stay verifiable**: kernels are checked against cuBLAS with separate tolerances for FP32 and Tensor Core paths
18-
- **Stay maintainable**: OpenSpec keeps docs, workflow, and validation rules aligned
19-
20-
## Optimization ladder
21-
22-
| Stage | Kernel | What you learn |
23-
|------:|--------|----------------|
24-
| 1 | [Naive](docs/kernel-naive/) | Thread-to-output mapping and baseline cost |
25-
| 2 | [Tiled](docs/kernel-tiled/) | Shared-memory blocking and data reuse |
26-
| 3 | [Bank-Free](docs/kernel-bank-free/) | Padding away 32-way bank conflicts |
27-
| 4 | [Double Buffer](docs/kernel-double-buffer/) | Latency hiding through staged tiles |
28-
| 5 | [Tensor Core](docs/kernel-tensor-core/) | WMMA usage with guarded FP32 fallback |
15+
- **One optimization ladder**: naive -> tiled -> bank-conflict-free -> double-buffer -> Tensor Core.
16+
- **Comparable kernel interfaces**: every FP32 kernel uses the same `(A, B, C, M, K, N, stream)` launcher shape.
17+
- **Verification-first harness**: kernel output is checked against cuBLAS with separate tolerances for FP32 and Tensor Core paths.
18+
- **Learning-oriented docs**: GitHub Pages carries the full walkthrough instead of duplicating it in the README.
2919

3020
## Quick start
3121

3222
```bash
3323
git clone https://github.com/LessUp/sgemm-optimization.git
3424
cd sgemm-optimization
3525

36-
# Recommended: CMake
3726
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
3827
cmake --build build -j$(nproc)
3928
./build/bin/sgemm_benchmark -a
4029
ctest --test-dir build
4130
```
4231

43-
```bash
44-
# Quick local alternative
45-
make GPU_ARCH=sm_86
46-
make benchmark
47-
make test
48-
```
49-
50-
## Where to start
51-
52-
| If you want to... | Start here |
53-
|-------------------|------------|
54-
| Build and run once | [Getting Started](docs/getting-started/) |
55-
| Learn the optimization path | [Learning Path](docs/learning-path/) |
56-
| Understand repository structure | [Architecture](docs/architecture/) |
57-
| See performance context | [Benchmark Results](docs/benchmark-results/) |
58-
| Inspect governance rules | [Specifications](specs/) |
32+
Runtime tests and benchmarks require a CUDA-capable local machine. Hosted CI is limited to compile-time, formatting, repository-structure, OpenSpec, and Pages checks.
5933

60-
## Validation boundary
34+
## Start here
6135

62-
- **Local GPU machine**: runtime tests, correctness checks, benchmarking
63-
- **GitHub Actions**: format/style, CUDA compile, OpenSpec checks, Pages deployment
36+
| Goal | Entry point |
37+
|------|-------------|
38+
| Use the project site | [GitHub Pages](https://lessup.github.io/sgemm-optimization/) |
39+
| Build and run once | [Getting Started](docs/getting-started.md) |
40+
| Follow the kernel ladder | [Learning Path](docs/learning-path.md) |
41+
| Inspect the source layout | [Architecture](docs/architecture.md) |
42+
| Read the normative specs | [Specifications](specs.md) |
6443

65-
Standard FP32 kernels: `rtol=1e-3`, `atol=1e-4`. Tensor Core path: `rtol=5e-2`, `atol=1e-2`.
66-
67-
## Repository layout
44+
## Source map
6845

6946
```text
70-
src/
71-
├── kernels/ # Five SGEMM kernel variants
72-
├── utils/ # CUDA RAII, verification, benchmark helpers
73-
└── main.cu # Benchmark entry point
74-
tests/
75-
└── test_sgemm.cu # Google Test suite
76-
docs/ # Learning-oriented documentation
77-
openspec/ # Stable specs, changes, workflow guidance
47+
src/kernels/ CUDA SGEMM implementations
48+
src/utils/ CUDA RAII, verification, benchmark helpers
49+
src/main.cu benchmark CLI
50+
tests/ Google Test coverage against cuBLAS
51+
docs/ learning documentation mirrored on Pages
52+
openspec/ stable specs and change workflow
7853
```
7954

80-
## Project status
81-
82-
This repository is in **archive-ready** state. All kernel implementations are complete, tests pass, and documentation is aligned. Non-trivial changes follow the OpenSpec workflow:
83-
84-
1. `/opsx:explore` — clarify scope and trade-offs
85-
2. `/opsx:propose "description"` — create change artifacts
86-
3. `/opsx:apply` — implement tasks
87-
4. `/review` — quality gate
88-
5. `/opsx:archive` — merge and close
89-
90-
Stable specs: `openspec/specs/`. Active changes: `openspec/changes/<change>/`.
91-
9255
## License
9356

94-
MIT. See [LICENSE](LICENSE).
57+
MIT. See [LICENSE.md](LICENSE.md).

0 commit comments

Comments
 (0)