open-standards/.nx.sh
Claude cd82a805de jouleclaw-omni: drop the redundant model RwLock, fix 15 metal errors
Fifteen architecture pipelines held their weights as
`Arc<parking_lot::RwLock<Model>>`. No `.write()` is ever taken on a
model field anywhere in the crate, and `Model`'s mutating-looking
methods (`prefetch_prefix`, `evict_prefix`) take `&self` and only issue
madvise on already-mapped pages, so the lock guarded nothing. The other
28 pipelines already use `Arc<Model>`; florence2.rs documents the same
conclusion in a comment.

The lock was not merely redundant, it made four legal signatures
impossible: `fn w(&self, name: &str) -> Result<&LazyTensor>` borrows out
of the temporary `RwLockReadGuard` (E0515 in canary, fibo, mochi, sd3).
Converting removes 214 `.read()` calls and fixes those four.

Also fixed, each verified against the crate's own working precedent:

- CommonKernels had no `mul` field though `mul_f16` sits in the same
  ELEMENTWISE source as the wired `add_f16`. Added the pipeline.
- `kv_cache.update` takes 5 args (llm.rs:1098, deepseek.rs:279); jamba
  and mimo passed a 6th window hint. `PagedKVCache` is a flat per-layer
  buffer with no eviction, so it could never have honoured it.
- `MoeRouter::route` takes 2 args (llm.rs:996, deepseek.rs:357); jamba
  and mimo passed a third `None`.
- bare `f16` (unstable) -> `half::f16`, matching the other 71 uses in
  diffusion.rs.
- duplicate `T5Config` import in flan_t5.rs.
- `hal:🤘:buffer` made pub(crate) for two in-crate users.

While removing mimo's window hint I found its comments claim the window
is enforced in the attention kernel "via the window_hint parameter".
It is not: decode clamps the visible cache via `effective_cache_len`,
but prefill calls `prefill_attention`, which takes no window argument
and applies a full causal mask, so SWA layers see the whole prefix.
Corrected both comments to say so rather than delete the intent
silently. Windowed prefill masking remains unimplemented.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-10-20 04:07:38 -04:00

38 lines
1.8 KiB
Shell
Executable file

#!/bin/bash
cd "$(dirname "$0")"
python3 - <<'PY'
import json, collections, re
e716=collections.Counter(); e599=collections.Counter(); e425=collections.Counter()
misc=collections.Counter(); sites716=[]
for line in open('/tmp/m5.json'):
try: m=json.loads(line)
except Exception: continue
if m.get('reason')!='compiler-message': continue
msg=m.get('message') or {}
if msg.get('level')!='error': continue
code=(msg.get('code') or {}).get('code') or '?'
txt=msg.get('message') or ''
sp=msg.get('spans') or []
where=(sp[0]['file_name'].split('/')[-1]+':'+str(sp[0].get('line_start'))) if sp else '?'
if code=='E0716':
lbls=[s.get('label') or '' for s in sp if s.get('label')]
e716[tuple(sorted(set(l[:40] for l in lbls)))[:2]]+=1
if len(sites716)<6: sites716.append(where)
elif code=='E0599':
mm=re.search(r'no method named `([^`]+)` found for (?:struct|reference) `([^`]+)`', txt)
e599[(mm.group(1), mm.group(2)[:30]) if mm else (txt[:40],'')]+=1
elif code=='E0425':
mm=re.match(r"cannot find (?:value|function) `([^`]+)` in module `([^`]+)`", txt)
e425[(mm.group(1), mm.group(2)) if mm else (txt[:40],'')]+=1
elif code in ('E0658','E0061','E0515','E0603','E0609','E0252'):
misc[(code, txt[:56], where)]+=1
print(" === E0716 temporary dropped while borrowed: the labels ===")
for k,n in e716.most_common(5): print(f" {n:4} {k}")
print(" sample sites:", ", ".join(sites716))
print("\n === E0599 missing methods ===")
for (m_,t),n in e599.most_common(8): print(f" {n:4} .{m_}() on {t}")
print("\n === E0425 missing, by module ===")
for (n_,mod),c in e425.most_common(10): print(f" {c:4} {mod}::{n_}")
print("\n === the 15 misc, individually ===")
for (c,t,w),n in misc.most_common(15): print(f" {c} {w}: {t}")
PY