diff --git a/.crumb b/.crumb index c7ac7247..77c298f2 100644 --- a/.crumb +++ b/.crumb @@ -65,7 +65,7 @@ "children": [ { "digest": "5113f380d92d17b79f3676f303677c86b6980132671208b070eb84ec6ceee3ba", - "last_commit": "997158b", + "last_commit": "07e447c", "name": "scripts", "purpose": "" }, @@ -77,14 +77,14 @@ } ], "children_root": "sha256:c5269f93385287c09996ff41f0247f72de9237a2317f47c94c51273d6a0acef1", - "compiled_at": "2026-10-07T04:16:27Z", + "compiled_at": "2026-10-07T04:30:07Z", "compiler": "crumb-compile/1", - "digest": "sha256:ddf24198373aa6d52af8f7f53f36005ea149030a65157298029afa4b37314f81", + "digest": "sha256:2659adb53bc1e96c50217db037cd03ff1b0b75dc39f672260b3d3fde91f0e78f", "evidence_files": 155, "evidence_root": "sha256:ff6dddfecfcc02cea55f46acaccc7eaecd27557209e98c3d5616ec02bdde31db", "files": 1128, - "generated_at_commit": "372eb4c76283a84ac179e8c1e1907d790174fa74", - "source_tree": "sha256:24d5ece2561d3aa4f4f237f6bd506ac8d0709a99b81be6ba194688493d9f7e4f" + "generated_at_commit": "d42909b6dd1e9ead5d055b8dad9e90c8e452a25b", + "source_tree": "sha256:35c0f520cea5e539c54e21c24a86e37d698d211e06591111ed693d021e403553" } }, "history": [], diff --git a/crates/aien-inference-abi/src/lib.rs b/crates/aien-inference-abi/src/lib.rs index 4a93919e..cc9dde26 100644 --- a/crates/aien-inference-abi/src/lib.rs +++ b/crates/aien-inference-abi/src/lib.rs @@ -896,7 +896,7 @@ mod tests { /// the chip. Before this test was split, it used head_dim 16 and asserted success /// unconditionally, so it only passed with AIEN_DEV_FALLBACK=1: a strict stub build /// correctly refuses at the first op (no engine linked), and a strict native build - /// would refuse at attention (omega attention needs head_dim 64, see omega_backend.rs). + /// would refuse at attention (omega attention needs head_dim 64 or 128, see omega_backend.rs). #[tokio::test] async fn test_blackwell_inference_backend() { let config = ModelConfig { diff --git a/crates/aien-inference-abi/src/omega_backend.rs b/crates/aien-inference-abi/src/omega_backend.rs index f21380cd..30e9e4f5 100644 --- a/crates/aien-inference-abi/src/omega_backend.rs +++ b/crates/aien-inference-abi/src/omega_backend.rs @@ -6,7 +6,8 @@ //! Paged attention over a bf16 pool uses omega's paged kernel; over any other pool dtype //! (the model builds Fp32 pools) the sequence's K/V are gathered on the host into //! contiguous f32 exactly as the reference reads them, then run on the f32 gqa kernel. -//! omega attention needs head_dim 64 (TinyLlama, Llama-3.2-1B). A chip error in +//! omega attention needs head_dim 64 (TinyLlama, Llama-3.2-1B) or 128 (since omega b564bf4; +//! Qwen3 is still refused, see `omega_model_refusal`). A chip error in //! one of those is a fallback of a claimed-native op: it is counted, goes through //! `OpAccounting::reference_path` (fatal in a production build, see `strict.rs`) //! and, in a dev build only, the reference result is computed so the run goes on. @@ -495,16 +496,18 @@ impl OmegaGb10Backend { } } -/// Why the GB10 engine refuses `config`, if it does: Qwen3 (`qk_norm`) has `head_dim` 128 and -/// the omega attention kernel is fixed at `head_dim` 64 (omega `omega_gpu_attention_api.h`), -/// and the per-head q/k norm runs only on the CPU reference path. Llama-architecture models -/// are not touched by this check. +/// Why the GB10 engine refuses `config`, if it does: Qwen3 (`qk_norm`) needs a per-head q/k +/// norm, which has no engine op. It is host math in `TransformerLayerWeights::apply_qk_norm`, +/// outside the `TensorBackend`, so a GB10 run would compute it on the CPU without op accounting. +/// The attention kernel itself accepts `head_dim` 128 since omega b564bf4 (omega +/// `omega_gpu_attention_api.h`); opening the GB10 Qwen3 path is its own qualification. +/// Llama-architecture models are not touched by this check. pub fn omega_model_refusal(config: &ModelConfig) -> Option { config.qk_norm.then(|| { format!( "OmegaGb10Backend refuses model {:?}: Qwen3 (per-head q/k norm, head_dim {}) is \ - unsupported on the GB10 engine, whose attention kernel supports head_dim 64 only; \ - run it on the CPU reference backend", + unsupported on the GB10 engine: the per-head q/k norm runs only on the CPU, with no \ + GB10 engine op; run it on the CPU reference backend", config.model_id, config.head_dim ) }) diff --git a/crates/aien-inference-abi/tests/qwen3_forward_parity.rs b/crates/aien-inference-abi/tests/qwen3_forward_parity.rs index cee07af7..d802c841 100644 --- a/crates/aien-inference-abi/tests/qwen3_forward_parity.rs +++ b/crates/aien-inference-abi/tests/qwen3_forward_parity.rs @@ -345,7 +345,10 @@ fn gb10_backend_refuses_qwen3_and_not_llama() { .unwrap(); let msg = omega_model_refusal(&q).expect("Qwen3 must be refused on the GB10 engine"); assert!( - msg.contains("head_dim 128") && msg.contains("Qwen3"), + msg.contains("head_dim 128") + && msg.contains("Qwen3") + && msg.contains("q/k norm runs only on the CPU") + && !msg.contains("head_dim 64 only"), "{msg}" ); let llama = aien_inference_abi::ModelConfig::tinyllama_1_1b(); diff --git a/crates/aien-omega-gpu/src/lib.rs b/crates/aien-omega-gpu/src/lib.rs index 78c59f2a..77c20cf4 100644 --- a/crates/aien-omega-gpu/src/lib.rs +++ b/crates/aien-omega-gpu/src/lib.rs @@ -630,7 +630,7 @@ fn attn_dim(v: usize) -> Result { /// Decode attention over contiguous f32 KV (`TensorBackend::gqa_attention`). /// `q`, `out`: `[num_q_heads][head_dim]`; `k_cache`, `v_cache`: `[seq_len][num_kv_heads][head_dim]`. -/// omega requires `head_dim == 64` and `num_q_heads <= 64`; otherwise `Rc { rc: -1 | -2 }`. +/// omega requires `head_dim` 64 or 128 and `num_q_heads <= 64`; otherwise `Rc { rc: -1 | -2 }`. #[allow(clippy::too_many_arguments)] pub fn gqa_attention_f32( q: &[f32], diff --git a/crates/aien-runtime/tests/runtime_end_to_end_tests.rs b/crates/aien-runtime/tests/runtime_end_to_end_tests.rs index 6b3f4b24..79b1d1c7 100644 --- a/crates/aien-runtime/tests/runtime_end_to_end_tests.rs +++ b/crates/aien-runtime/tests/runtime_end_to_end_tests.rs @@ -85,7 +85,7 @@ fn test_micro_model_config() -> ModelConfig { } } -/// Micro model in a shape the native Omega engine accepts: attention needs head_dim 64 and a +/// Micro model in a shape the native Omega engine accepts: attention needs head_dim 64 (or 128) and a /// power-of-two q/kv head ratio, rmsnorm needs dim % 128 == 0 (omega /// omega_gpu_attention_api.c:603-604, omega_gpu_elementwise_api.c:527). The CPU micro shape /// above (head_dim 16, hidden 64) is refused by the engine, which in a production build is a diff --git a/omega.lock b/omega.lock index f0671b8d..82c40ed6 100644 --- a/omega.lock +++ b/omega.lock @@ -1 +1 @@ -c0369e6705a4b0cb800978846e78915126a1b7f7 +88874546d9220b3acb3f71a9820daa3318e15b8e