fix: first combined compile of the Original-literal source-port for x86_64-linux (lib + all test targets type-check)

Fixes: native-cpu-expert Display bound, runtime imports/visibility/lifetimes, missing MTP_ORIGINAL_WINDOW export, MmqFormat match arms, stale test constructors. cargo check --target x86_64-unknown-linux-gnu only (no link, no GPU).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-14 14:42:12 +02:00
co-authored by Claude Sonnet 5.5
parent 7f896a8bb8
commit 8651f784ef
11 changed files with 17 additions and 10 deletions
+1
View File
@@ -64,6 +64,7 @@ mod qwen_dispatch;
pub use qwen_dispatch::gr_batch_read::{GrMicroValues, GrMicrobatchRead};
mod qsa_selected_kv;
pub use mtp_dense_kv::MtpDenseKvRing;
pub use mtp_dense_kv::MTP_ORIGINAL_WINDOW;
pub use mtp_dense_kv::{
CompletedMtpAttention, CompletedMtpKvReplay, MtpInt8OwnerId, MtpInt8Snapshot, MtpOriginalInt8,
MtpOriginalMixed, MtpOriginalQuery,
@@ -251,6 +251,9 @@ fn raw_format(format: MmqFormat) -> RoutedFormat {
MmqFormat::Iq2SGateUp => RoutedFormat::IQ2_S,
MmqFormat::Iq4NlDown => RoutedFormat::IQ4_NL,
MmqFormat::Q2Down => RoutedFormat::Q2_0,
MmqFormat::Iq3SGateUp => RoutedFormat::IQ3_S,
MmqFormat::Iq4XsGateUp => RoutedFormat::IQ4_XS,
MmqFormat::Iq4NlGateUp => RoutedFormat::IQ4_NL,
}
}
fn native_owner(c: &Context<'_>, dual: &MmqWeights<'_>, raw: &[u8], data: &[u8]) {
+1
View File
@@ -196,6 +196,7 @@ mod gpu_tests;
// Separate literal Original INT8 drafter; the historical F16 owner stays unchanged.
#[path = "mtp_original_int8.rs"]
mod original_int8;
pub use original_int8::MTP_ORIGINAL_WINDOW;
pub use original_int8::{
CompletedMtpAttention, CompletedMtpKvReplay, MtpInt8OwnerId, MtpInt8Snapshot, MtpOriginalInt8,
MtpOriginalMixed, MtpOriginalQuery, OriginalMtpSkippedPrefix,
@@ -1,7 +1,7 @@
//! Model-lifetime immutable MTP allocations. Cached CUDA graphs own real Rc
//! allocations, so a per-call matrix borrow can never outlive its weight bank.
use super::*;
use super::output_native::OriginalMtpNativeHead;
use super::super::output_native::OriginalMtpNativeHead;
struct RetainedDense<'ctx>{role:MtpRole,kind:MtpKind,rows:usize,columns:usize,buffer:Rc<DeviceBuffer<'ctx>>}
pub(in crate::qwen_forward) struct RetainedOriginalMtpWeights<'ctx>{
binding:BindingIdentity,context:&'ctx Context<'ctx>,dense:Vec<RetainedDense<'ctx>>,
@@ -80,7 +80,7 @@ impl<'ctx> RetainedOriginalMtpWeights<'ctx>{
/// cache never fabricates a replacement head buffer or dispatch profile.
#[allow(clippy::too_many_arguments)]
pub(in crate::qwen_forward) fn full_forward_weights(
&self,binding:&ModelBinding,context:&Context<'ctx>,
&self,binding:&ModelBinding,context:&'ctx Context<'ctx>,
prefix:Rc<leleka_cuda_driver::OriginalMtpRetainedPrefix<'ctx>>,
head:&OriginalMtpNativeHead<'ctx>,id_vocab:usize,
subset:Option<(Rc<DeviceBuffer<'ctx>>,Rc<DeviceBuffer<'ctx>>)>,
@@ -19,7 +19,7 @@ use leleka_cuda_driver::{Context,OriginalPromptDevice,OriginalGdnPromptDevice,Or
OriginalMtpScalarPrefill,OriginalMtpRetainedScalarWeights,OriginalMtpScalarPolicy};
pub(in crate::qwen_forward) struct OriginalPromptExecutor<'ctx>{
context:&'ctx Context<'ctx>,binding:BindingIdentity,capacity:usize,fused:bool,
pub(in crate::qwen_forward) context:&'ctx Context<'ctx>,binding:BindingIdentity,capacity:usize,fused:bool,
prompt:Option<OriginalPromptDevice<'ctx>>,gdn:Option<OriginalGdnPromptDevice<'ctx>>,
qsa:Option<OriginalQsaResidentPromptDevice<'ctx>>,transport:Option<OriginalQsaResidentTransport<'ctx>>,
attention:Option<OriginalQsaResidentAttention<'ctx>>,
@@ -198,7 +198,7 @@ fn queued_gdn_chain_matches_scalar_oracles_refuses_and_cleans_up() {
.unwrap();
// The three device-only products refuse a wrong role and a roleless use.
assert_eq!(
chain.device_buffer(&alpha, Role::Z).err(),
chain.operand_buffer(&alpha, Role::Z).err(),
Some(Error::IdentityMismatch)
);
assert_eq!(
@@ -263,7 +263,7 @@ fn queued_gdn_chain_matches_scalar_oracles_refuses_and_cleans_up() {
.project_device(&weights.alpha, GdnMatrixKind::Bf16, &source, Role::Alpha)
.unwrap();
assert_eq!(
chain.device_buffer(&foreign, Role::Alpha).err(),
chain.operand_buffer(&foreign, Role::Alpha).err(),
Some(Error::IdentityMismatch)
);
other.finish().unwrap();
+2 -1
View File
@@ -7,8 +7,9 @@ use super::dense_weight_cache::DenseWeightCache;
use super::input::PleReady;
use super::session::QwenStepTxn;
use crate::model_binding::qwen4exp_input::{
BindingIdentity, GrRole, GrWeights, InputBindingError, ModelBinding,
BindingIdentity, GrWeights, InputBindingError, ModelBinding,
};
pub(crate) use crate::model_binding::qwen4exp_input::GrRole;
use leleka_cuda_driver::{Context, DeviceBuffer, Error as DriverError};
use std::{
cell::{Cell, RefCell, RefMut},
@@ -1383,7 +1383,7 @@ impl<'ctx> MoeWeightCache<'ctx> {
if self
.bank
.as_ref()
.is_none_or(|actual| !std::ptr::eq(actual, bank))
.is_none_or(|actual| !std::ptr::eq(&**actual, bank))
{
return Err(Error::IdentityMismatch);
}
@@ -1401,7 +1401,7 @@ impl<'ctx> MoeWeightCache<'ctx> {
.iter()
.find(|entry| entry.role == role)
.ok_or(Error::IdentityMismatch)?;
if !std::ptr::eq(&actual.buffer, buffer) {
if !std::ptr::eq(&*actual.buffer, buffer) {
return Err(Error::IdentityMismatch);
}
}
@@ -1,7 +1,7 @@
//! Literal Original sampler host histories and absolute coupled draw positions.
//! These are metadata helpers, never model/session/commit capabilities. The
//! caller must pass the actual consumed tail and genuine current verify window.
use cuda_driver::SamplerParams;
use leleka_cuda_driver::SamplerParams;
use super::contract::{Error, Result};
pub(crate) const PENALTY_WINDOW_CAP: usize = 4096;
@@ -348,6 +348,7 @@ fn synthetic_late_prior(position: u64) -> QsaPrior {
pooled: Directory::from_entries(vec![row; position as usize / 4]).unwrap(),
tail: [0.; 384],
dead: [0.25; 128],
native_kv: None,
}))
}
#[cfg(test)]
@@ -8,7 +8,7 @@ mod platform{
impl<'ctx> NativeGpu<'ctx>{pub fn new(context:&'ctx Context<'ctx>)->Result<Self,String>{Ok(Self{owner:context.native_parity()?})}}
impl<'ctx> ParityGpu for NativeGpu<'ctx>{
type Expert=NativeParityExpert<'ctx>;
fn prepare_expert(&mut self,f:&NativeFormat,blob:&[u8],input:&[f32])->Result<Self::Expert,String>{f.validate().map_err(|e|e.to_string())?;if f.n_embd!=2560||f.n_ff!=640{return Err("Original benchmark geometry".into());}self.owner.prepare_expert(f.gu.original_id(),f.down.original_id(),blob,input)}
fn prepare_expert(&mut self,f:&NativeFormat,blob:&[u8],input:&[f32])->Result<Self::Expert,String>{f.validate().map_err(|e|format!("{e:?}"))?;if f.n_embd!=2560||f.n_ff!=640{return Err("Original benchmark geometry".into());}self.owner.prepare_expert(f.gu.original_id(),f.down.original_id(),blob,input)}
fn enqueue_expert(&mut self,e:&mut Self::Expert)->Result<(),String>{self.owner.enqueue_expert(e)}
fn download_expert(&mut self,e:&mut Self::Expert)->Result<Vec<f32>,String>{self.owner.download_expert(e)}
fn old_kernels(&self)->bool{self.owner.old_kernels()}