mirror of
https://github.com/hanzoai/ml.git
synced 2026-11-20 23:08:29 +00:00
gdn.hip named threadIdx without including hip_runtime.h, so hipcc refused it at the first forward that reached the scan. A kernel is compiled from source at first use; the new test compiles every shipped source for the box's GPU. hanzo-rocm-kernels 0.11.40, hanzo-ml 0.11.101; 0.11.39 and 0.11.100 are yanked. Co-authored-by: Hanzo Dev <[email protected]>
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
//! Every ROCm kernel source the crate ships compiles for this GPU. The kernels are compiled from
|
|
//! source at first use, so a source that hipcc rejects fails at the first forward that needs it,
|
|
//! not at build time; this is the build-time check.
|
|
#![cfg(feature = "rocm")]
|
|
|
|
use hanzo_rocm_kernels::kernel::KernelSource;
|
|
|
|
fn compiles<K: KernelSource>() {
|
|
let dir = std::env::temp_dir();
|
|
let src = dir.join(format!("hanzo_{}_compile_check.hip", K::NAME));
|
|
let out = dir.join(format!("hanzo_{}_compile_check.hsaco", K::NAME));
|
|
std::fs::write(&src, K::CODE).unwrap();
|
|
let arch = std::env::var("HANZO_ROCM_ARCH").unwrap_or_else(|_| "gfx1151".into());
|
|
let status = std::process::Command::new("hipcc")
|
|
.args(["--genco", "-O1", &format!("--offload-arch={arch}"), "-o"])
|
|
.arg(&out)
|
|
.arg(&src)
|
|
.status()
|
|
.expect("hipcc on PATH");
|
|
assert!(status.success(), "{} does not compile", K::NAME);
|
|
}
|
|
|
|
#[test]
|
|
fn every_kernel_source_compiles() {
|
|
use hanzo_rocm_kernels::kernel::*;
|
|
compiles::<BinaryKernel>();
|
|
compiles::<UnaryKernel>();
|
|
compiles::<AffineKernel>();
|
|
compiles::<FillKernel>();
|
|
compiles::<ReduceKernel>();
|
|
compiles::<ConvKernel>();
|
|
compiles::<IndexingKernel>();
|
|
compiles::<CastKernel>();
|
|
compiles::<TernaryKernel>();
|
|
compiles::<SortKernel>();
|
|
compiles::<QuantKernel>();
|
|
compiles::<RopeKernel>();
|
|
compiles::<FlashKernel>();
|
|
compiles::<DslRmsNormKernel>();
|
|
compiles::<DslAddRmsNormKernel>();
|
|
compiles::<GdnKernel>();
|
|
}
|