CCO is a CUDA-first open source repo for transformed attention optimization.
The repo is organized around a transform-first attention workflow:
kernels/holds the CUDA transform and attention kernels.runtime/holds host orchestration, pipeline logic, and CPU references.bench/measures raw performance.eval/runs the real GPU-based evaluation system.eval/also includes a lightweight CPU precheck for local non-GPU machines.- GitHub workflows gate PRs with CPU precheck first and then feed accepted PRs into an ordered GPU eval queue.
The current structure is intentionally inspired by two ideas:
leimao/CUDA-GEMM-Optimizationfor explicit version-by-version progressgittensor-ai-lab/sparkinferfor engineering discipline around bench and eval
Cuda-Compute-OSS/
├── docs/
├── kernels/
│ ├── include/cco/
│ └── src/
├── runtime/
│ ├── include/cco/
│ └── src/
├── tests/
├── bench/
├── eval/
├── examples/
└── scripts/
The repo currently keeps only the first transform version in kernels/src/transform/.
0.0.0implemented in00_baseline.cu
Future versions can be added later, but the repo now stays intentionally focused on a single transform baseline and one direct transformed-attention pipeline.
CCO follows this order:
- transform
Q,K, andVfrom(n, d)into(n', d') - run attention in the reduced space
- reconstruct the output back to
(n, d) - compare the transformed result against exact attention on GPU
(n, d) and (n', d') are intentionally flexible. The baseline requires only that (n', d') cleanly divide (n, d).
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir builddocs/overview.mddocs/transform-ladder.mddocs/evaluation.mddocs/contributing.mddocs/gpu-runner-setup.mdbench/README.mdeval/README.mdkernels/README.mdruntime/README.md
CCO currently tracks one baseline transform version, one transformed-attention path, and a kernel/runtime split designed for versioned optimization work.
The authoritative evaluation path is GPU-based: exact attention vs transformed attention, bounded accuracy, relative error, latency, and memory are all measured on GPU in eval/run_eval_gpu.py.
By default, the GPU eval runs 10 random Q/K/V trials per shape and dtype, scores them one by one, and sums those trial scores into the final result.
For local non-GPU development, eval/run_eval.py is only a lightweight precheck.
For a single automatic entrypoint, run bash scripts/eval.sh. It chooses CPU precheck on CPU-only machines and real GPU eval on CUDA machines.
For pull requests, the repo now uses a two-stage bot flow:
- CPU-only precheck on every PR update
- ordered GPU queue processing later on a rented or self-hosted GPU machine
To prepare a rented GPU machine for the queue worker, use:
bash scripts/setup_gpu_runner.shDefault attention shapes are n=4096, d=256, n'=1024, and d'=64, but any valid transform target can be configured.
If n' and d' are omitted, CCO now asks the active transform version for its default transformed-shape policy.