#[cfg(feature = "cuda")]
use realizar::cuda::CudaExecutor;
fn main() {
#[cfg(feature = "cuda")]
{
println!("Testing Q4K with phi-2 dimensions...");
if !CudaExecutor::is_available() {
println!("CUDA not available");
return;
}
let mut executor = CudaExecutor::new(0).expect("Failed to create executor");
println!("GPU: {}", executor.device_name().unwrap_or_default());
let m = 2560u32;
let k = 2560u32;
let num_blocks = (k as usize).div_ceil(256);
let weight_bytes = num_blocks * 144 * m as usize;
println!("Testing q4k_matvec with m={}, k={}", m, k);
println!(
"Weight buffer: {} bytes ({} blocks)",
weight_bytes,
num_blocks * m as usize
);
let weights = vec![0u8; weight_bytes];
let input = vec![1.0f32; k as usize];
let mut output = vec![0.0f32; m as usize];
match executor.q4k_matvec(&weights, &input, &mut output, m, k) {
Ok(()) => println!("SUCCESS! output[0] = {}", output[0]),
Err(e) => println!("FAILED: {}", e),
}
}
#[cfg(not(feature = "cuda"))]
{
println!("CUDA feature not enabled, skipping test");
}
}