Files
xserv/crates/xserv-kernels/build.rs
Gahow Wang 58062bd326 kernels: fix MXFP4 build — wire quant module + mxfp4.cu (7ebdd7c didn't build)
7ebdd7c added quant.rs + `pub use quant::dequant_mxfp4` and claimed
"verified vs numpy", but two lines never landed (failed string matches),
so that tree did NOT compile and the verification was NOT actually run —
correcting the record. This adds the missing `pub mod quant;` and the
build.rs `.file("../../csrc/quant/mxfp4.cu")` entry.

Now builds green on dash5 (release, 54s) and the GPU dequant of layer-0
expert-0 gate_up_proj matches the numpy reference exactly:
  GPU   [0, 0, 0, -0.0625, 0, -0, -0.015625, -0.03125]
  numpy [0, 0, 0, -0.0625, 0, -0, -0.0156,   -0.0312]

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 21:40:22 +08:00

35 lines
1.2 KiB
Rust

use std::env;
fn main() {
let cuda_path = env::var("CUDA_HOME")
.or_else(|_| env::var("CUDA_PATH"))
.unwrap_or_else(|_| "/usr/local/cuda".to_string());
println!("cargo:rustc-link-search=native={cuda_path}/lib64");
println!("cargo:rustc-link-lib=dylib=cudart");
println!("cargo:rustc-link-lib=dylib=cublas");
cc::Build::new()
.cuda(true)
.cudart("shared")
.flag("-gencode=arch=compute_120,code=sm_120")
.include("../../csrc")
.file("../../csrc/gemm/naive.cu")
.file("../../csrc/gemm/tiled.cu")
.file("../../csrc/gemm/gemv.cu")
.file("../../csrc/normalization/rmsnorm.cu")
.file("../../csrc/normalization/layernorm.cu")
.file("../../csrc/activation/activations.cu")
.file("../../csrc/reduce/softmax.cu")
.file("../../csrc/embedding/embedding.cu")
.file("../../csrc/embedding/rope.cu")
.file("../../csrc/attention/causal_mask.cu")
.file("../../csrc/embedding/transpose.cu")
.file("../../csrc/attention/flash_attention.cu")
.file("../../csrc/attention/paged_attention.cu")
.file("../../csrc/quant/mxfp4.cu")
.compile("xserv_kernels");
println!("cargo:rerun-if-changed=../../csrc/");
}