Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/kvbm-kernels/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ fn get_cuda_arch_flags() -> Vec<String> {
let explicit_archs = env::var("CUDA_ARCHS").ok();
let arch_list = explicit_archs.as_deref().unwrap_or("80,86,89,90,100,120");

let mut compiled_archs = Vec::new();

for arch in arch_list.split(',') {
let arch = arch.trim();
if arch.is_empty() {
Expand All @@ -336,9 +338,27 @@ fn get_cuda_arch_flags() -> Vec<String> {
);
continue;
}
compiled_archs.push(arch_num);
flags.push(format!("-gencode=arch=compute_{},code=sm_{}", arch, arch));
}

if !compiled_archs.is_empty() {
println!(
"cargo:warning=Building kernels for GPU architectures: sm_{}",
compiled_archs
.iter()
.map(|a| a.to_string())
.collect::<Vec<_>>()
.join(", sm_")
);
} else {
println!(
"cargo:warning=WARNING: No GPU architectures compiled! \
All requested architectures exceed the CUDA toolkit's maximum supported compute capability. \
This will cause 'no kernel image available' errors at runtime."
);
}

// Generate forward-compatible PTX for each major architecture family that is
// both present in the arch list and supported by the detected CUDA toolkit.
let ptx_archs_env = env::var("CUDA_PTX_ARCHS").ok();
Expand Down
Loading