Guard Local compiler-baseline rendering
Browse filesCo-authored-by: Codex <codex@openai.com>
app.py
CHANGED
|
@@ -489,7 +489,7 @@ except Exception:
|
|
| 489 |
REPLAYS_JSON = "{}"
|
| 490 |
|
| 491 |
APP_HTML = r"""
|
| 492 |
-
<div id="km">
|
| 493 |
<div id="km-top">
|
| 494 |
<div id="km-brand">
|
| 495 |
<span class="mark"><span class="dot"></span>Kernel Mint</span>
|
|
@@ -584,7 +584,7 @@ APP_HTML = r"""
|
|
| 584 |
<div class="km-page" data-page="expert" hidden>
|
| 585 |
<header id="km-hero">
|
| 586 |
<h1>Free-test the verifier.</h1>
|
| 587 |
-
<p>Describe the fused operation you want in plain language. The model writes a Triton kernel and the referee certifies it against PyTorch
|
| 588 |
</header>
|
| 589 |
<div class="km-expert-grid">
|
| 590 |
<section class="km-card">
|
|
@@ -1145,6 +1145,10 @@ APP_JS = r"""
|
|
| 1145 |
const hasC=Number.isFinite(sc)&&sc>0, hasM=Number.isFinite(sm)&&sm>0;
|
| 1146 |
const heroSpeed=hasM?sm:(hasC?sc:se);
|
| 1147 |
const heroLabel=hasM?'vs torch.compile max-autotune':(hasC?'vs torch.compile':'vs PyTorch eager');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1148 |
const runLabel=local?'local offline mint':(recorded?'recorded mint':'live mint');
|
| 1149 |
const noteText=recorded?'recorded backend run':(local?'local offline run':'live backend run');
|
| 1150 |
const note="<span class='km-pill-note "+(recorded?'recorded':(local?'local':'hit'))+"'>"+noteText+"</span>";
|
|
@@ -1153,6 +1157,7 @@ APP_JS = r"""
|
|
| 1153 |
"<div class='km-result-top'><div class='km-verdict-icon'>OK</div><div><span class='km-run-label'>"+runLabel+"</span><b>Verified by the referee</b><span>"+esc(d.op||'kernel')+"</span></div></div>"+
|
| 1154 |
"<div class='km-ref-summary'><b>"+a.passed+" of "+(a.total||'?')+"</b> attempts passed the referee</div>"+
|
| 1155 |
attemptChips(d)+
|
|
|
|
| 1156 |
// Every comparison as its own big number, strongest (most honest) baseline first, eager last
|
| 1157 |
// and labelled 'unfused' so the side-by-side is self-explanatory: the model's real edge is
|
| 1158 |
// the ~1.1x over the compiler; the big eager number is mostly the fusion win.
|
|
@@ -1221,8 +1226,8 @@ APP_JS = r"""
|
|
| 1221 |
clearSource(mode);
|
| 1222 |
const k=recipe.k||4, started=Date.now(), replayKey=mode==='build'?(matchingReplayKey()||REPLAY_ORDER[0]||''):(REPLAY_ORDER[0]||'');
|
| 1223 |
const local=!!recipe.local;
|
| 1224 |
-
const stages=local?['loading local GGUF...','llama.cpp drafting '+Math.min(k,2)+' kernels...','compiling Triton on this Space GPU...','checking correctness vs PyTorch...','timing vs torch.compile...']:
|
| 1225 |
-
['model waking...','drafting '+k+' kernels...','compiling Triton...','checking correctness vs PyTorch...','timing vs torch.compile...'];
|
| 1226 |
const stepHtml=stages.map((s,i)=>"<span class='"+(i===0?'on':'')+"'>"+esc(s)+"</span>").join('');
|
| 1227 |
v.innerHTML="<div class='km-card building'><b class='km-bstage' id='km-bstage'>"+esc(stages[0])+"</b>"+
|
| 1228 |
"<div class='km-build-steps' id='km-build-steps'>"+stepHtml+"</div>"+
|
|
@@ -1239,7 +1244,7 @@ APP_JS = r"""
|
|
| 1239 |
const elapsed=(Date.now()-started)/1000;
|
| 1240 |
let ix=0; for(let j=0;j<stageStart.length;j++){if(elapsed>=stageStart[j])ix=j;}
|
| 1241 |
ix=Math.min(ix,stages.length-1);
|
| 1242 |
-
const label=(ix===stages.length-1&&elapsed>45)?'still timing vs torch.compile...':stages[ix];
|
| 1243 |
const el=$('#km-bstage');
|
| 1244 |
if(el&&el.textContent!==label){el.textContent=label;animate(el,[{opacity:.35,transform:'translateY(3px)'},{opacity:1,transform:'none'}],{duration:220,easing:'cubic-bezier(0.16,1,0.3,1)'});}
|
| 1245 |
$$('#km-build-steps span').forEach((s,j)=>{s.classList.toggle('on',j===ix);s.classList.toggle('done',j<ix);});
|
|
|
|
| 489 |
REPLAYS_JSON = "{}"
|
| 490 |
|
| 491 |
APP_HTML = r"""
|
| 492 |
+
<div id="km" data-build="2026-06-14-local-baseline-guard">
|
| 493 |
<div id="km-top">
|
| 494 |
<div id="km-brand">
|
| 495 |
<span class="mark"><span class="dot"></span>Kernel Mint</span>
|
|
|
|
| 584 |
<div class="km-page" data-page="expert" hidden>
|
| 585 |
<header id="km-hero">
|
| 586 |
<h1>Free-test the verifier.</h1>
|
| 587 |
+
<p>Describe the fused operation you want in plain language. The model writes a Triton kernel and the referee certifies it against PyTorch, torch.compile, and max-autotune. The referee can only certify operations it has a reference for, so your request is resolved to the nearest one it can check.</p>
|
| 588 |
</header>
|
| 589 |
<div class="km-expert-grid">
|
| 590 |
<section class="km-card">
|
|
|
|
| 1145 |
const hasC=Number.isFinite(sc)&&sc>0, hasM=Number.isFinite(sm)&&sm>0;
|
| 1146 |
const heroSpeed=hasM?sm:(hasC?sc:se);
|
| 1147 |
const heroLabel=hasM?'vs torch.compile max-autotune':(hasC?'vs torch.compile':'vs PyTorch eager');
|
| 1148 |
+
const missingLocalCompiler=local&&!recorded&&!hasC&&!hasM;
|
| 1149 |
+
const compilerGuard=missingLocalCompiler
|
| 1150 |
+
? "<div class='km-baseline-guard'>Compiler baselines did not return for this Local run. Re-mint; a certified Local result should include torch.compile and max-autotune next to eager.</div>"
|
| 1151 |
+
: "";
|
| 1152 |
const runLabel=local?'local offline mint':(recorded?'recorded mint':'live mint');
|
| 1153 |
const noteText=recorded?'recorded backend run':(local?'local offline run':'live backend run');
|
| 1154 |
const note="<span class='km-pill-note "+(recorded?'recorded':(local?'local':'hit'))+"'>"+noteText+"</span>";
|
|
|
|
| 1157 |
"<div class='km-result-top'><div class='km-verdict-icon'>OK</div><div><span class='km-run-label'>"+runLabel+"</span><b>Verified by the referee</b><span>"+esc(d.op||'kernel')+"</span></div></div>"+
|
| 1158 |
"<div class='km-ref-summary'><b>"+a.passed+" of "+(a.total||'?')+"</b> attempts passed the referee</div>"+
|
| 1159 |
attemptChips(d)+
|
| 1160 |
+
compilerGuard+
|
| 1161 |
// Every comparison as its own big number, strongest (most honest) baseline first, eager last
|
| 1162 |
// and labelled 'unfused' so the side-by-side is self-explanatory: the model's real edge is
|
| 1163 |
// the ~1.1x over the compiler; the big eager number is mostly the fusion win.
|
|
|
|
| 1226 |
clearSource(mode);
|
| 1227 |
const k=recipe.k||4, started=Date.now(), replayKey=mode==='build'?(matchingReplayKey()||REPLAY_ORDER[0]||''):(REPLAY_ORDER[0]||'');
|
| 1228 |
const local=!!recipe.local;
|
| 1229 |
+
const stages=local?['loading local GGUF...','llama.cpp drafting '+Math.min(k,2)+' kernels...','compiling Triton on this Space GPU...','checking correctness vs PyTorch...','timing vs torch.compile max-autotune...']:
|
| 1230 |
+
['model waking...','drafting '+k+' kernels...','compiling Triton...','checking correctness vs PyTorch...','timing vs torch.compile max-autotune...'];
|
| 1231 |
const stepHtml=stages.map((s,i)=>"<span class='"+(i===0?'on':'')+"'>"+esc(s)+"</span>").join('');
|
| 1232 |
v.innerHTML="<div class='km-card building'><b class='km-bstage' id='km-bstage'>"+esc(stages[0])+"</b>"+
|
| 1233 |
"<div class='km-build-steps' id='km-build-steps'>"+stepHtml+"</div>"+
|
|
|
|
| 1244 |
const elapsed=(Date.now()-started)/1000;
|
| 1245 |
let ix=0; for(let j=0;j<stageStart.length;j++){if(elapsed>=stageStart[j])ix=j;}
|
| 1246 |
ix=Math.min(ix,stages.length-1);
|
| 1247 |
+
const label=(ix===stages.length-1&&elapsed>45)?'still timing vs torch.compile max-autotune...':stages[ix];
|
| 1248 |
const el=$('#km-bstage');
|
| 1249 |
if(el&&el.textContent!==label){el.textContent=label;animate(el,[{opacity:.35,transform:'translateY(3px)'},{opacity:1,transform:'none'}],{duration:220,easing:'cubic-bezier(0.16,1,0.3,1)'});}
|
| 1250 |
$$('#km-build-steps span').forEach((s,j)=>{s.classList.toggle('on',j===ix);s.classList.toggle('done',j<ix);});
|
style.css
CHANGED
|
@@ -276,6 +276,9 @@ input[type=range].km-range::-moz-range-thumb { width: 16px; height: 16px; border
|
|
| 276 |
.km-cmp-key { border-color: var(--accent-line) !important; background: var(--accent-soft) !important; }
|
| 277 |
.km-cmp-key big { color: var(--accent); }
|
| 278 |
.km-dim { color: var(--muted); font-size: 13px; line-height: 1.5; }
|
|
|
|
|
|
|
|
|
|
| 279 |
.km-rawerr { color: var(--faint); font-size: 12px; font-family: var(--mono); margin-top: 10px;
|
| 280 |
word-break: break-word; }
|
| 281 |
.km-pill-note { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 5px 11px;
|
|
|
|
| 276 |
.km-cmp-key { border-color: var(--accent-line) !important; background: var(--accent-soft) !important; }
|
| 277 |
.km-cmp-key big { color: var(--accent); }
|
| 278 |
.km-dim { color: var(--muted); font-size: 13px; line-height: 1.5; }
|
| 279 |
+
.km-baseline-guard { margin: 12px 0; border: 1px solid rgba(255, 196, 87, .35);
|
| 280 |
+
background: rgba(255, 196, 87, .08); border-radius: var(--r-sm); padding: 10px 12px;
|
| 281 |
+
color: #f8d38a; font-size: 12.5px; line-height: 1.45; }
|
| 282 |
.km-rawerr { color: var(--faint); font-size: 12px; font-family: var(--mono); margin-top: 10px;
|
| 283 |
word-break: break-word; }
|
| 284 |
.km-pill-note { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 5px 11px;
|