interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

GitHub aien-dev/aien-sovereign-core-mv#880 (code only)

closed derived c7ea262d6e8ebe28 #880

Imported from GitHub aien-dev/aien-sovereign-core-mv#880 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 9818d6b47364a94a8e45ea81001b8f2f7413ab4b · Head abea25b944ceb1b0d6c4b947ba2f97cfc0983030

Apply it

git checkout -b patch-c7ea262d6e8ebe28 9818d6b47364a94a8e45ea81001b8f2f7413ab4b
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/c7ea262d6e8ebe28.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
880
abea25b944ceb1b0d6c4b947ba2f97cfc0983030
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":880,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/880","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:11Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/crates/aien-inference-abi/src/qwen38_omega/moe.rs b/crates/aien-inference-abi/src/qwen38_omega/moe.rs
index 932b197e..0ded44fe 100644
--- a/crates/aien-inference-abi/src/qwen38_omega/moe.rs
+++ b/crates/aien-inference-abi/src/qwen38_omega/moe.rs
@@ -458,6 +458,17 @@ impl Qwen38Omega {
             );
             (Some(screen), Some(coef))
         };
+        // DRA-69 (TEST/BENCH knob, default off): AIEN_Q36_LM_HEAD_FP8=1 makes the fp8b screen the graph's lm_head (FP8 logits for
+        // every token; the exact head then stands aside). Pair with AIEN_OMEGA_Q36_FP8_HEAD=1 for one head launch per stroke.
+        if std::env::var("AIEN_Q36_LM_HEAD_FP8").as_deref() == Ok("1") {
+            let screen = head_screen
+                .as_ref()
+                .ok_or("AIEN_Q36_LM_HEAD_FP8=1 needs the fp8b screen (leave AIEN_Q36_EXACT_HEAD unset)")?;
+            // SAFETY: the screen is owned by the returned value and dropped after the graph (field order).
+            unsafe { graph.set_lm_head_fp8(screen.as_raw()) }
+                .map_err(gpu("q36 graph set_lm_head_fp8"))?;
+            eprintln!("qwen36 omega: FP8 lm_head ON (AIEN_Q36_LM_HEAD_FP8=1, the fp8b screen; TEST/BENCH, not for serving)");
+        }
         drop(head);
         // Negative controls for the gates (TEST ONLY): AIEN_Q36_TEST_MUTANT=4 drops the shared expert
         // from COMBINE, 1 shifts the SWIGLU up half, 2 the attention GATHER, 3 drops the attention gate,
diff --git a/crates/aien-omega-q38/src/q36.rs b/crates/aien-omega-q38/src/q36.rs
index b7b281b0..0d0d741a 100644
--- a/crates/aien-omega-q38/src/q36.rs
+++ b/crates/aien-omega-q38/src/q36.rs
@@ -147,6 +147,7 @@ mod ffi {
         ) -> i32;
         pub fn omega_gpu_q36_graph_kind_name(kind: u8) -> *const std::ffi::c_char;
         pub fn omega_gpu_q36_graph_test_set_mutant(g: *mut OmegaGpuQ36Graph, mutant: i32);
+        pub fn omega_gpu_q36_graph_set_lm_head_fp8(g: *mut OmegaGpuQ36Graph, head: *const c_void) -> i32;
         pub fn omega_gpu_q36_graph_set_exact_head(
             g: *mut OmegaGpuQ36Graph,
             screen: *const c_void,
@@ -668,6 +669,30 @@ impl Q36Graph {
         }
     }
 
+    /// FP8 lm_head (`omega_gpu_q36_graph_set_lm_head_fp8`): `[vocab][2048]` with 128 x 128 block scales, e.g. the exact
+    /// head's fp8b screen. The hidden is then written x 2^64 and every token's logits come from this head (FP8 values,
+    /// not the bf16 head's). A batched stroke runs it per head unless the process has `AIEN_OMEGA_Q36_FP8_HEAD=1`
+    /// (CUDApp DRA-69: one launch for every head). Null goes back to bf16.
+    ///
+    /// # Safety
+    /// `head` is null or a live `OmegaGpuFp8Tensor` that outlives every later token of this graph.
+    pub unsafe fn set_lm_head_fp8(&mut self, head: *mut c_void) -> Result<(), OmegaGpuError> {
+        #[cfg(has_omega_q36)]
+        {
+            // SAFETY: ptr is live; head per the caller's contract.
+            let rc = unsafe { ffi::omega_gpu_q36_graph_set_lm_head_fp8(self.ptr, head) };
+            if rc != 0 {
+                return Err(session_err("q36 graph set_lm_head_fp8", rc));
+            }
+            Ok(())
+        }
+        #[cfg(not(has_omega_q36))]
+        {
+            let _ = head;
+            Err(OmegaGpuError::Unavailable)
+        }
+    }
+
     /// Use the exact two-pass head for the next tokens (greedy) or the plain head (sampled).
     pub fn set_exact_head_on(&mut self, on: bool) {
         #[cfg(has_omega_q36)]