mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-27 00:10:43 +00:00
docs: overhaul project documentation and maintenance checks
Signed-off-by: Ranveer Soni <git@ranveersoni.me>
This commit is contained in:
29 files changed
+365
-814
No files matched your search
@@ -11,7 +11,7 @@ case "${1:-}" in
|
||||
*) printf '%s\n' 'usage: scripts/assemble-fixture.sh [--check]' >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
for name in add bitwise-branch float-exact or shifts; do
|
||||
for name in add bitwise-branch float-exact or shifts ashr; do
|
||||
"$llvm_bin/llvm-mc" -triple=amdgcn-amd-amdhsa -mcpu=gfx1030 -mattr=+wavefrontsize32 \
|
||||
-filetype=obj "fixtures/rdna2/$name.s" -o "$scratch/$name.o"
|
||||
"$llvm_bin/llvm-objcopy" -O binary --only-section=.text "$scratch/$name.o" "$scratch/$name.bin"
|
||||
|
||||
+70
-2
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""Render the feature and instruction tables from the checked-in status registry."""
|
||||
"""Render the checked-in status tables and progress graphic."""
|
||||
|
||||
import argparse
|
||||
from html import escape
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import tomllib
|
||||
@@ -33,6 +34,71 @@ def replace_block(path, name, body, check):
|
||||
return True
|
||||
|
||||
|
||||
def render_progress(status):
|
||||
forms = status["instruction"]
|
||||
milestones = status["guest_milestones"]
|
||||
verified_gpu = {"fixture verified", "fixture verified on Apple M5"}
|
||||
local_gpu = "local Apple M5 readback passed; acceptance pending"
|
||||
if not forms or len({item["form"] for item in forms}) != len(forms):
|
||||
raise ValueError("expected a nonempty inventory of unique instruction forms")
|
||||
for item in forms:
|
||||
if any(type(item[key]) is not bool for key in ("recognized", "decoded")):
|
||||
raise ValueError(f"{item['form']}: expected boolean decoder status")
|
||||
if item["decoded"] and not item["recognized"]:
|
||||
raise ValueError(f"{item['form']}: decoded form must be recognized")
|
||||
if item["gpu"] in verified_gpu and (
|
||||
not item["decoded"] or not item["lowering"] or item["cpu"] != "fixture verified"
|
||||
):
|
||||
raise ValueError(f"{item['form']}: GPU verification requires a verified CPU path")
|
||||
if item["gpu"] == local_gpu and (
|
||||
not item["decoded"] or not item["lowering"] or item["cpu"] != "local known-answer test passed"
|
||||
):
|
||||
raise ValueError(f"{item['form']}: local GPU evidence requires the local CPU result")
|
||||
if item["gpu"] not in verified_gpu | {"acceptance pending", local_gpu}:
|
||||
raise ValueError(f"{item['form']}: unknown GPU evidence status")
|
||||
if set(milestones) != {"X1", "X2", "X3", "X4"} or any(
|
||||
value not in {"accepted", "pending"} for value in milestones.values()
|
||||
):
|
||||
raise ValueError("expected acceptance status for each of X1–X4")
|
||||
|
||||
rows = [
|
||||
("Decoded gfx1030 forms", sum(item["decoded"] for item in forms), len(forms)),
|
||||
("Accepted Metal forms · Apple M5", sum(item["gpu"] in verified_gpu for item in forms), len(forms)),
|
||||
("Accepted guest milestones · X1–X4", list(milestones.values()).count("accepted"), len(milestones)),
|
||||
]
|
||||
svg = [
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="530" height="185" viewBox="0 0 530 185" role="img" aria-labelledby="title description">',
|
||||
'<title id="title">Xenora · recorded progress</title>',
|
||||
'<desc id="description">' + escape(". ".join(f"{label}: {count} of {total}" for label, count, total in rows)) + '</desc>',
|
||||
'<rect x="1" y="1" width="528" height="183" rx="10" fill="#18212a" stroke="#516171"/>',
|
||||
'<g font-family="system-ui,sans-serif" fill="#eaf0f5">',
|
||||
'<text x="20" y="29" font-size="13" font-weight="700">RECORDED FIXTURE PROGRESS</text>',
|
||||
]
|
||||
for y, (label, count, total) in zip((58, 96, 134), rows, strict=True):
|
||||
svg.extend([
|
||||
f'<text x="20" y="{y}" font-size="13">{escape(label)}</text>',
|
||||
f'<text x="510" y="{y}" font-size="13" text-anchor="end">{count} / {total}</text>',
|
||||
f'<rect x="20" y="{y + 7}" width="490" height="4" rx="2" fill="#3c4a58"/>',
|
||||
f'<rect x="20" y="{y + 7}" width="{490 * count / total:.2f}" height="4" rx="2" fill="#88c6bd"/>',
|
||||
])
|
||||
svg.extend([
|
||||
'<text x="20" y="168" font-size="11" fill="#b4c2d0">Scope: tracked instruction forms and four synthetic guest milestones.</text>',
|
||||
'</g>',
|
||||
'</svg>',
|
||||
])
|
||||
return "\n".join(svg) + "\n"
|
||||
|
||||
|
||||
def check_asset(path, svg, check):
|
||||
if path.exists() and path.read_text() == svg:
|
||||
return True
|
||||
if check:
|
||||
print(f"{path}: progress graphic differs from docs/status.toml", file=sys.stderr)
|
||||
return False
|
||||
path.write_text(svg)
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--check", action="store_true")
|
||||
@@ -79,8 +145,10 @@ def main():
|
||||
for item in status["instruction"]
|
||||
],
|
||||
)
|
||||
svg = render_progress(status)
|
||||
checks = [
|
||||
replace_block(root / "README.md", "features", features, check),
|
||||
replace_block(docs / "progress.md", "features", features, check),
|
||||
check_asset(docs / "assets/xenora-progress.svg", svg, check),
|
||||
replace_block(docs / "shaders/instruction-coverage.md", "instructions", instructions, check),
|
||||
]
|
||||
return 0 if all(checks) else 1
|
||||
|
||||
@@ -14,10 +14,10 @@ xcodebuild -version
|
||||
xcrun --find metal
|
||||
xcrun metal --version
|
||||
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
llvm_bin=${LLVM_BIN:-$(brew --prefix llvm)/bin}
|
||||
else
|
||||
llvm_bin=${LLVM_BIN:-}
|
||||
llvm_bin=${LLVM_BIN:-}
|
||||
if [ -z "$llvm_bin" ] && command -v brew >/dev/null 2>&1 &&
|
||||
llvm_prefix=$(brew --prefix llvm 2>/dev/null); then
|
||||
llvm_bin="$llvm_prefix/bin"
|
||||
fi
|
||||
for tool in llvm-mc llvm-objcopy llvm-objdump; do
|
||||
if [ -n "$llvm_bin" ] && [ -x "$llvm_bin/$tool" ]; then
|
||||
|
||||
Reference in new issue
Block a user