fix(neuron): gate TP MoE load tests to non-cuda builds (#92)
All checks were successful
CI / Format (push) Successful in 8s
CI / CUDA type-check (push) Successful in 1m41s
CI / Clippy (push) Successful in 2m16s
CI / Test (push) Successful in 5m58s
CI / Build cortex SRPM (push) Has been skipped
CI / Build neuron SRPM (push) Has been skipped
CI / Publish cortex to COPR (push) Has been skipped
CI / Publish neuron to COPR (push) Has been skipped
CI / Bump version in source (push) Has been skipped
CI / Format (pull_request) Successful in 15s
CI / CUDA type-check (pull_request) Successful in 1m37s
CI / Clippy (pull_request) Successful in 2m22s
CI / Test (pull_request) Successful in 9m35s
CI / Build cortex SRPM (pull_request) Has been skipped
CI / Publish cortex to COPR (pull_request) Has been skipped
CI / Build neuron SRPM (pull_request) Has been skipped
CI / Publish neuron to COPR (pull_request) Has been skipped
CI / Bump version in source (pull_request) Has been skipped

The CUDA type-check compiles test targets too, where
TpQwen3_5MoeBlock::load takes an NCCL Comm the tests cannot
construct (E0061). The CPU Test job runs the partial-sum parity
test; the CUDA job type-checks the cuda load/reduce variants.
Also drops an unused binding only the cuda test build flagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TczcGF7JSjJs8r15RSSGpx
This commit is contained in:
2026-07-02 00:42:45 +03:00
parent 201cc54a7b
commit a157c8fa27

View File

@@ -2027,11 +2027,17 @@ fn log_construction_complete(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[cfg(not(feature = "cuda"))]
use crate::harness::arch::qwen3_5::moe::Qwen3_5MoeBlock; use crate::harness::arch::qwen3_5::moe::Qwen3_5MoeBlock;
#[cfg(not(feature = "cuda"))]
use std::collections::HashMap; use std::collections::HashMap;
/// Write a tiny MoE-block checkpoint (router + experts + shared /// Write a tiny MoE-block checkpoint (router + experts + shared
/// expert) and return a ShardedVarBuilder over it plus the config. /// expert) and return a ShardedVarBuilder over it plus the config.
/// Non-cuda only: the cuda `TpQwen3_5MoeBlock::load` takes an NCCL
/// `Comm`, which tests cannot construct — the CPU Test job covers
/// this; the CUDA job type-checks the cuda variants.
#[cfg(not(feature = "cuda"))]
fn tiny_moe_fixture(dir: &std::path::Path) -> (TextConfig, std::path::PathBuf) { fn tiny_moe_fixture(dir: &std::path::Path) -> (TextConfig, std::path::PathBuf) {
let dev = Device::Cpu; let dev = Device::Cpu;
let randn = |shape: &[usize]| Tensor::randn(0f32, 0.3f32, shape, &dev).unwrap(); let randn = |shape: &[usize]| Tensor::randn(0f32, 0.3f32, shape, &dev).unwrap();
@@ -2090,6 +2096,7 @@ mod tests {
(cfg, path) (cfg, path)
} }
#[cfg(not(feature = "cuda"))]
fn vb_over(path: &std::path::Path) -> ShardedVarBuilder { fn vb_over(path: &std::path::Path) -> ShardedVarBuilder {
// SAFETY: mmap of a file the test just wrote; nothing mutates it. // SAFETY: mmap of a file the test just wrote; nothing mutates it.
unsafe { unsafe {
@@ -2108,6 +2115,7 @@ mod tests {
/// pins the expert slicing (column gate/up, row down), the /// pins the expert slicing (column gate/up, row down), the
/// replicated routing, and the shared-expert partial scaling, /// replicated routing, and the shared-expert partial scaling,
/// i.e. everything the real AllReduce would combine. /// i.e. everything the real AllReduce would combine.
#[cfg(not(feature = "cuda"))]
#[test] #[test]
fn tp_moe_ws2_partials_sum_to_single_gpu_output() { fn tp_moe_ws2_partials_sum_to_single_gpu_output() {
let dir = tempfile::tempdir().expect("tempdir"); let dir = tempfile::tempdir().expect("tempdir");
@@ -2154,7 +2162,7 @@ mod tests {
let (full_qkv, full_z) = split_fused_qkvz(&fused, num_k, num_v, head_k, head_v).unwrap(); let (full_qkv, full_z) = split_fused_qkvz(&fused, num_k, num_v, head_k, head_v).unwrap();
let (full_b, full_a) = split_fused_ba(&ba, num_k, num_v).unwrap(); let (full_b, full_a) = split_fused_ba(&ba, num_k, num_v).unwrap();
let (key_dim, value_dim) = (num_k * head_k, num_v * head_v); let key_dim = num_k * head_k;
let ws = 2usize; let ws = 2usize;
for rank in 0..ws { for rank in 0..ws {