Port Qwen row-map SwiGLU expert gathers

This commit is contained in:
Georg Bauer committed 2026-10-04 16:24:33 +02:00
1 parent 8965e77ea1
commit 7b894fbfee
42 files changed
+11489 -65

No files matched your search

+21
View File
@@ -25,6 +25,11 @@ fn falsey(value: Option<&str>) -> bool {
})
}
pub(super) fn sorted_gather_enabled(get: impl Fn(&'static str) -> Option<String>) -> bool {
!falsey(get("MTPLX_MOE_SORTED_GATHER_KERNEL").as_deref())
&& !truthy(get("MTPLX_FORCE_GPU_FAMILY_FALLBACK").as_deref())
}
fn strict_bool(name: &str, raw: Option<String>) -> Result<bool, String> {
match raw
.as_deref()
@@ -323,3 +328,19 @@ fn qwen_server_policy_matches_original_functions() {
}
assert_eq!(count, 268);
}
#[test]
fn sorted_moe_switch_and_family_rehearsal() {
assert!(sorted_gather_enabled(|_| None));
for off in ["0", " false ", "NO", "off"] {
assert!(!sorted_gather_enabled(|key| (key
== "MTPLX_MOE_SORTED_GATHER_KERNEL")
.then(|| off.to_owned())));
}
for force in ["1", " true ", "YES", "on"] {
assert!(!sorted_gather_enabled(|key| (key
== "MTPLX_FORCE_GPU_FAMILY_FALLBACK")
.then(|| force.to_owned())));
}
assert!(sorted_gather_enabled(|_| Some("unexpected".into())));
}