bbkdevops's picture
download
raw
2.51 kB
"""Write a runtime selection report using measured TinyMind kernel evidence."""
from __future__ import annotations
from datetime import datetime, timezone
import json
from pathlib import Path
from model.config import OmegaConfig
from model.runtime import int6_bridge_available, resolve_runtime_mode
def build_runtime_selector_report(
out_dir: str | Path,
cuda_available: bool = True,
sparse_artifact_available: bool = True,
int6_bridge_report: str | Path = "reports/int6_bridge_imma_eval/int6_bridge_imma_eval_report.json",
) -> dict:
cfg = OmegaConfig(precision_mode="auto", sparsity_mode="int6_2x4_pairwise_sparse")
bridge_ok = int6_bridge_available(int6_bridge_report)
selected = resolve_runtime_mode(
cfg,
cuda_available=cuda_available,
sparse_artifact_available=sparse_artifact_available,
int6_bridge_artifact_available=bridge_ok,
)
bridge = _load(int6_bridge_report)
report = {
"schema_version": "tinymind-runtime-selector-v1",
"created_at": datetime.now(timezone.utc).isoformat(),
"selected_runtime": selected.value,
"inputs": {
"cuda_available": cuda_available,
"sparse_artifact_available": sparse_artifact_available,
"int6_bridge_report": str(int6_bridge_report),
"int6_bridge_available": bridge_ok,
},
"selected_evidence": {
"avg_hardware_imma_tops": bridge.get("metrics", {}).get("avg_hardware_imma_tops"),
"avg_logical_int6_tops": bridge.get("metrics", {}).get("avg_logical_int6_tops"),
"avg_logical_int6_tops_per_watt": bridge.get("metrics", {}).get("avg_logical_int6_tops_per_watt"),
"imma_sp_sass_observed": bridge.get("claim_gate", {}).get("imma_sp_sass_observed"),
"int6_bottleneck_removed": bridge.get("claim_gate", {}).get("int6_bottleneck_removed"),
},
"claim_gate": {
"uses_measured_801_imma_tops_path": selected.value == "int6_bridge_imma_fast",
"world_fastest_claim_allowed": False,
},
}
out = Path(out_dir)
out.mkdir(parents=True, exist_ok=True)
path = out / "runtime_selector_report.json"
report["json_path"] = str(path)
path.write_text(json.dumps(report, ensure_ascii=False, indent=2, sort_keys=True), encoding="utf-8")
return report
def _load(path: str | Path) -> dict:
p = Path(path)
return json.loads(p.read_text(encoding="utf-8-sig")) if p.exists() else {}

Xet Storage Details

Size:
2.51 kB
·
Xet hash:
a46f2af624dc4ec3e75efd9b6e197dcc185ba86cf012970ea3cba166f3f8b552

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.