phase 0+1: fix Rust 2024 edition compat + memory query

- unsafe extern "C" blocks (Rust 2024 requirement)
- unsafe blocks inside unsafe fn bodies
- Use cudaMemGetInfo for accurate GPU memory reporting
- Remove cc "cuda" feature (doesn't exist, built-in)
- All 12 tests pass on RTX 5090 (CC 12.0, 170 SMs, 32GB)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 19:40:49 +08:00
parent 9806b4db35
commit c8f7bc0c3c
5 changed files with 40 additions and 24 deletions

View File

@@ -7,7 +7,8 @@ fn test_device_info() {
let info = device::device_info(0).expect("failed to get device info");
println!("GPU 0: {}", info.name);
println!(" Memory: {} MB", info.total_memory / (1024 * 1024));
println!(" Total Memory: {} MB", info.total_memory / (1024 * 1024));
println!(" Free Memory: {} MB", info.free_memory / (1024 * 1024));
println!(
" Compute Capability: {}.{}",
info.compute_major, info.compute_minor
@@ -17,7 +18,7 @@ fn test_device_info() {
println!(" Warp Size: {}", info.warp_size);
println!(" Max Threads/Block: {}", info.max_threads_per_block);
assert!(info.total_memory > 0);
assert!(info.total_memory > 30 * 1024 * 1024 * 1024); // 5090 has 32GB
assert!(info.sm_count > 0);
}