Skip to content

Commit e3211cb

Browse files
committed
Fix clippy errors in cuda_std
1 parent 89d98a7 commit e3211cb

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

crates/cuda_std/src/misc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Misc functions that do not exactly fit into other categories.
22
33
use crate::gpu_only;
4+
#[cfg(target_os = "cuda")]
45
use core::arch::asm;
56

67
/// Suspends execution of the kernel, usually to pause at a specific point when debugging in a debugger.

crates/cuda_std/src/ptr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! CUDA-specific pointer handling logic.
22
33
use crate::gpu_only;
4+
#[cfg(target_os = "cuda")]
45
use core::arch::asm;
56

67
/// Special areas of GPU memory where a pointer could reside.

crates/cuda_std/src/shared.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ use crate::gpu_only;
1919
/// the burden of correctness is on the user. Some of the things you must ensure in your usage of
2020
/// shared memory are:
2121
/// - Shared memory is only shared across __thread blocks__, not the entire device, therefore it is
22-
/// unsound to try and rely on sharing data across more than one block.
22+
/// unsound to try and rely on sharing data across more than one block.
2323
/// - You must write to the shared buffer before reading from it as the data is uninitialized by default.
2424
/// - [`thread::sync_threads`](crate::thread::sync_threads) must be called before relying on the results of other
25-
/// threads, this ensures every thread has reached that point before going on. For example, reading another thread's
26-
/// data after writing to the buffer.
25+
/// threads, this ensures every thread has reached that point before going on. For example, reading another thread's
26+
/// data after writing to the buffer.
2727
/// - No access may be out of bounds, this usually means making sure the amount of threads and their dimensions are correct.
2828
///
2929
/// It is suggested to run your executable in `cuda-memcheck` to make sure usages of shared memory are right.

crates/cuda_std/src/warp.rs

+17-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! thread blocks and execute in SIMT fashion.
55
66
use crate::gpu_only;
7+
#[cfg(target_os = "cuda")]
78
use core::arch::asm;
89
use half::{bf16, f16};
910

@@ -329,7 +330,7 @@ unsafe fn match_all_64(mask: u32, value: u64) -> (u32, bool) {
329330
/// Behavior is undefined if:
330331
/// - Any thread participating in the vote has exited or the executing thread is not in `mask`.
331332
/// - For `compute_62` and below, all threads in `mask` must call this function in convergence, and only threads belonging
332-
/// to the `mask` can be active when the intrinsic is called.
333+
/// to the `mask` can be active when the intrinsic is called.
333334
/// - A thread tries to execute this function while not being present in `mask`.
334335
#[gpu_only]
335336
pub unsafe fn warp_vote_all(mask: u32, predicate: bool) -> bool {
@@ -359,7 +360,7 @@ pub unsafe fn warp_vote_all(mask: u32, predicate: bool) -> bool {
359360
/// Behavior is undefined if:
360361
/// - Any thread participating in the vote has exited or the executing thread is not in `mask`.
361362
/// - For `compute_62` and below, all threads in `mask` must call this function in convergence, and only threads belonging
362-
/// to the `mask` can be active when the intrinsic is called.
363+
/// to the `mask` can be active when the intrinsic is called.
363364
/// - A thread tries to execute this function while not being present in `mask`.
364365
#[gpu_only]
365366
pub unsafe fn warp_vote_any(mask: u32, predicate: bool) -> bool {
@@ -389,7 +390,7 @@ pub unsafe fn warp_vote_any(mask: u32, predicate: bool) -> bool {
389390
/// Behavior is undefined if:
390391
/// - Any thread participating in the vote has exited or the executing thread is not in `mask`.
391392
/// - For `compute_62` and below, all threads in `mask` must call this function in convergence, and only threads belonging
392-
/// to the `mask` can be active when the intrinsic is called.
393+
/// to the `mask` can be active when the intrinsic is called.
393394
/// - A thread tries to execute this function while not being present in `mask`.
394395
#[gpu_only]
395396
pub unsafe fn warp_vote_ballot(mask: u32, predicate: bool) -> u32 {
@@ -415,10 +416,10 @@ pub unsafe fn warp_vote_ballot(mask: u32, predicate: bool) -> u32 {
415416
///
416417
/// - `mask` dictates what threads will participate in the shuffle, usually [`u32::MAX`] to indicate all threads.
417418
/// - `value` is the value that will be shuffled across the threads. i.e. the value that will be given to the thread
418-
/// that calculates this thread as its target lane.
419+
/// that calculates this thread as its target lane.
419420
/// - `delta` is the value that will be subtracted from the current thread's lane to calculate the target lane.
420421
/// - `width` dictates how to optionally split the warp into subsections, it must be a power of two and lower than `32`.
421-
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
422+
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
422423
///
423424
/// # Returns
424425
///
@@ -439,7 +440,7 @@ pub unsafe fn warp_vote_ballot(mask: u32, predicate: bool) -> u32 {
439440
/// Behavior is undefined if:
440441
/// - Any thread participating in the shuffle has exited or the executing thread is not in `mask`.
441442
/// - For `compute_62` and below, all threads in `mask` must call the same function in convergence, and only the threads
442-
/// in `mask` can be active when the shuffle is called.
443+
/// in `mask` can be active when the shuffle is called.
443444
///
444445
/// The returned value returned is unspecified if the calculated target lane is inactive.
445446
pub unsafe fn warp_shuffle_down<T: WarpShuffleValue>(
@@ -457,10 +458,10 @@ pub unsafe fn warp_shuffle_down<T: WarpShuffleValue>(
457458
///
458459
/// - `mask` dictates what threads will participate in the shuffle, usually [`u32::MAX`] to indicate all threads.
459460
/// - `value` is the value that will be shuffled across the threads. i.e. the value that will be given to the thread
460-
/// that calculates this thread as its target lane.
461+
/// that calculates this thread as its target lane.
461462
/// - `delta` is the value that will be added to the current thread's lane to calculate the target lane.
462463
/// - `width` dictates how to optionally split the warp into subsections, it must be a power of two and lower than `32`.
463-
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
464+
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
464465
///
465466
/// # Returns
466467
///
@@ -481,7 +482,7 @@ pub unsafe fn warp_shuffle_down<T: WarpShuffleValue>(
481482
/// Behavior is undefined if:
482483
/// - Any thread participating in the shuffle has exited or the executing thread is not in `mask`.
483484
/// - For `compute_62` and below, all threads in `mask` must call the same function in convergence, and only the threads
484-
/// in `mask` can be active when the shuffle is called.
485+
/// in `mask` can be active when the shuffle is called.
485486
///
486487
/// The returned value returned is unspecified if the calculated target lane is inactive.
487488
pub unsafe fn warp_shuffle_up<T: WarpShuffleValue>(
@@ -499,10 +500,10 @@ pub unsafe fn warp_shuffle_up<T: WarpShuffleValue>(
499500
///
500501
/// - `mask` dictates what threads will participate in the shuffle, usually [`u32::MAX`] to indicate all threads.
501502
/// - `value` is the value that will be shuffled across the threads. i.e. the value that will be given to the thread
502-
/// that calculates this thread as its target lane.
503+
/// that calculates this thread as its target lane.
503504
/// - `idx` is the target lane that will be used as the source of this thread's returned value.
504505
/// - `width` dictates how to optionally split the warp into subsections, it must be a power of two and lower than `32`.
505-
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
506+
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
506507
///
507508
/// # Returns
508509
///
@@ -523,7 +524,7 @@ pub unsafe fn warp_shuffle_up<T: WarpShuffleValue>(
523524
/// Behavior is undefined if:
524525
/// - Any thread participating in the shuffle has exited or the executing thread is not in `mask`.
525526
/// - For `compute_62` and below, all threads in `mask` must call the same function in convergence, and only the threads
526-
/// in `mask` can be active when the shuffle is called.
527+
/// in `mask` can be active when the shuffle is called.
527528
///
528529
/// The returned value returned is unspecified if the calculated target lane is inactive.
529530
pub unsafe fn warp_shuffle_idx<T: WarpShuffleValue>(
@@ -541,11 +542,11 @@ pub unsafe fn warp_shuffle_idx<T: WarpShuffleValue>(
541542
///
542543
/// - `mask` dictates what threads will participate in the shuffle, usually [`u32::MAX`] to indicate all threads.
543544
/// - `value` is the value that will be shuffled across the threads. i.e. the value that will be given to the thread
544-
/// that calculates this thread as its target lane.
545+
/// that calculates this thread as its target lane.
545546
/// - `lane_mask` is the value that will be XOR'd by the current thread's lane id to calculate the target lane. i.e. the
546-
/// target lane will be `lane_id ^ lane_mask`.
547+
/// target lane will be `lane_id ^ lane_mask`.
547548
/// - `width` dictates how to optionally split the warp into subsections, it must be a power of two and lower than `32`.
548-
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
549+
/// calculated source lane values will NOT wrap around the value of `width`. Usually just `32`.
549550
///
550551
/// # Returns
551552
///
@@ -566,7 +567,7 @@ pub unsafe fn warp_shuffle_idx<T: WarpShuffleValue>(
566567
/// Behavior is undefined if:
567568
/// - Any thread participating in the shuffle has exited or the executing thread is not in `mask`.
568569
/// - For `compute_62` and below, all threads in `mask` must call the same function in convergence, and only the threads
569-
/// in `mask` can be active when the shuffle is called.
570+
/// in `mask` can be active when the shuffle is called.
570571
///
571572
/// The returned value returned is unspecified if the calculated target lane is inactive.
572573
pub unsafe fn warp_shuffle_xor<T: WarpShuffleValue>(

0 commit comments

Comments
 (0)