style: format Rust workspace

This commit is contained in:
2026-06-18 18:11:58 +08:00
parent 013465fc06
commit 531cd3fe08
57 changed files with 4045 additions and 1204 deletions

View File

@@ -14,7 +14,10 @@ fn test_device_info() {
info.compute_major, info.compute_minor
);
println!(" SM Count: {}", info.sm_count);
println!(" Shared Mem/Block: {} KB", info.shared_mem_per_block / 1024);
println!(
" Shared Mem/Block: {} KB",
info.shared_mem_per_block / 1024
);
println!(" Warp Size: {}", info.warp_size);
println!(" Max Threads/Block: {}", info.max_threads_per_block);
@@ -145,7 +148,11 @@ fn test_caching_allocator() {
// Second allocation of same size: should hit cache
let _buf2 = alloc.alloc(1024).unwrap();
assert_eq!(alloc.stats().cuda_malloc_count, 1, "should reuse cached buffer");
assert_eq!(
alloc.stats().cuda_malloc_count,
1,
"should reuse cached buffer"
);
assert_eq!(alloc.stats().cache_hit_count, 1);
}
@@ -198,11 +205,17 @@ fn test_async_copy() {
}
let mut gpu = GpuBuffer::alloc(4096).unwrap();
unsafe { gpu.copy_from_host_async(pinned.as_slice(), &stream).unwrap() };
unsafe {
gpu.copy_from_host_async(pinned.as_slice(), &stream)
.unwrap()
};
stream.synchronize().unwrap();
let mut out_pinned = PinnedBuffer::alloc(4096).unwrap();
unsafe { gpu.copy_to_host_async(out_pinned.as_mut_slice(), &stream).unwrap() };
unsafe {
gpu.copy_to_host_async(out_pinned.as_mut_slice(), &stream)
.unwrap()
};
stream.synchronize().unwrap();
assert_eq!(pinned.as_slice(), out_pinned.as_slice());