Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ <h2>Matrix multiply cost grows with the <span class="grad">cube</span> of size.<
<p style="margin-top:12px">Trivial today — the N³ term means this is not where the real cost lives.</p>
</div>
<div class="card scale-card reveal" style="transition-delay:.06s">
<div class="kpi">3.5 TFLOP</div>
<div class="sub">N = 12,000 — CCO's reference regime</div>
<div class="kpi">1.1 TFLOP</div>
<div class="sub">N = 8,192 — CCO's reference regime</div>
<p style="margin-top:12px">Full-rank data, deliberately the hard case — no structure to exploit for free.</p>
</div>
<div class="card scale-card reveal" style="transition-delay:.12s">
Expand Down Expand Up @@ -461,7 +461,7 @@ <h2>From matmul, live today, to sub-quadratic attention.</h2>
<div class="tl-body">
<h3>Matmul arena</h3>
<p>Approximate and exact-but-cheaper strategies for C = A × B, scored on full-rank, low-rank, and decaying-spectrum regimes. Open for contributions today.</p>
<div class="tl-tags"><span class="tag">subspace</span><span class="tag">N=12000</span><span class="tag">open now</span></div>
<div class="tl-tags"><span class="tag">subspace</span><span class="tag">N=8192</span><span class="tag">open now</span></div>
</div>
</div>
<div class="tl-row reveal">
Expand Down Expand Up @@ -524,7 +524,7 @@ <h3>Run the scorer</h3>
<p style="margin-bottom:18px">Clone the repo, install PyTorch, and reproduce the matmul reference scorecard on your own GPU — the same numbers a reviewer checks.</p>
<ul class="feature-list">
<li><span class="check"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M20 6L9 17l-5-5"/></svg></span><span>CUDA or Apple MPS, PyTorch-only</span></li>
<li><span class="check"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M20 6L9 17l-5-5"/></svg></span><span><code style="font-family:var(--mono)">python -m eval --n 12000 --pairs 3</code></span></li>
<li><span class="check"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M20 6L9 17l-5-5"/></svg></span><span><code style="font-family:var(--mono)">python -m eval --n 8192 --pairs 3</code></span></li>
</ul>
<a class="btn btn-ghost" style="margin-top:6px" href="https://github.com/zeokin/Cuda-Compute-OSS">See the quickstart</a>
</div>
Expand Down
83 changes: 83 additions & 0 deletions tests/test_landing_page_reference_regime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""Pin the landing page's reference-regime claims to the code (issue: stale N).

`index/index.html` advertises CCO's reference regime and a copy-pasteable
quickstart command. Those must track the real default the engines ship with --
`strategy`/`matmul` `--n` (8192), which README.md and BENCHMARKS.md also state as
"Reference setup: 8192 x 8192". The page had been left at the pre-8192 default of
N=12,000 (and its KPI showed 2*12000**3 = 3.5 TFLOP), so a visitor's first
command and headline number disagreed with every other surface in the repo.

These tests re-derive the page's claims from the CLI default itself, so the
landing page cannot silently drift away from the shipped default again.
Pure parsing + arithmetic; no GPU needed.

Run: python tests/test_landing_page_reference_regime.py
"""
import os
import re
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from strategy.cli import build_parser as strategy_parser
from matmul.cli import build_parser as matmul_parser

_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
_PAGE = os.path.join(_ROOT, "index", "index.html")


def _page() -> str:
with open(_PAGE, encoding="utf-8") as fh:
return fh.read()


def _default_n() -> int:
n = strategy_parser().parse_args([]).n
assert n == matmul_parser().parse_args([]).n, "engines disagree on default --n"
return n


def test_quickstart_command_uses_the_shipped_default_n():
"""The copy-pasteable `python -m eval --n ...` on the page must be the default."""
shown = re.findall(r"python -m eval --n (\d+)", _page())
assert shown, "no `python -m eval --n <N>` quickstart found on the landing page"
for value in shown:
assert int(value) == _default_n()


def test_reference_regime_card_matches_the_default_n():
"""The 'CCO's reference regime' KPI card must name the same N."""
m = re.search(r"N = ([\d,]+)\s*&mdash;|N = ([\d,]+)\s*—\s*CCO's reference regime", _page())
assert m, "no 'CCO's reference regime' card found"
shown = int((m.group(1) or m.group(2)).replace(",", ""))
assert shown == _default_n()


def test_reference_regime_flop_kpi_is_2n3_at_the_default_n():
"""The KPI beside the reference regime is 2*N**3; check it in decimal units
(the same convention the 1,000 -> 2 GFLOP and 128,000 -> 4.2 PFLOP cards use)."""
n = _default_n()
expected_tflop = round(2.0 * n**3 / 1e12, 1)
assert expected_tflop == 1.1, f"sanity: 2*{n}**3 should be 1.1 TFLOP, got {expected_tflop}"
assert f"{expected_tflop} TFLOP" in _page()
# the pre-8192 figure (2*12000**3) must be gone
assert "3.5 TFLOP" not in _page()


def test_no_stale_12000_reference_remains():
page = _page()
assert "12000" not in page and "12,000" not in page


if __name__ == "__main__":
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
failed = 0
for fn in fns:
try:
fn()
print(f"PASS {fn.__name__}")
except AssertionError as e:
failed += 1
print(f"FAIL {fn.__name__}: {e}")
print(f"\n{len(fns) - failed}/{len(fns)} passed")
sys.exit(1 if failed else 0)
Loading