pub struct BankConflictDetector { /* private fields */ }Expand description
Tracks shared memory access patterns to detect bank conflicts.
In CUDA, shared memory is divided into banks. Simultaneous accesses to the same bank by different threads cause serialisation (bank conflicts). This profiler counts such conflicts to help developers optimise access patterns.
Implementations§
Source§impl BankConflictDetector
impl BankConflictDetector
Sourcepub fn record_access(&self, byte_address: usize)
pub fn record_access(&self, byte_address: usize)
Record an access to a shared memory address.
Computes which bank the byte address maps to and counts conflicts
when multiple threads in the same warp access the same bank in one
cycle (represented by a batch of record_access calls between
begin_cycle / end_cycle).
§Arguments
byte_address- The byte offset into shared memory
Sourcepub fn begin_cycle(&self)
pub fn begin_cycle(&self)
Begin a new access cycle (e.g., a new warp instruction). Resets the per-bank counters.
Sourcepub fn address_to_bank(byte_address: usize) -> usize
pub fn address_to_bank(byte_address: usize) -> usize
Compute which bank a byte address maps to.
Bank index = (byte_address / BANK_WIDTH_BYTES) % NUM_BANKS
Sourcepub fn total_accesses(&self) -> usize
pub fn total_accesses(&self) -> usize
Get the total number of accesses recorded.
Sourcepub fn conflict_count(&self) -> usize
pub fn conflict_count(&self) -> usize
Get the number of bank conflicts detected.
Sourcepub fn conflict_rate(&self) -> f64
pub fn conflict_rate(&self) -> f64
Get the conflict rate (conflicts / total accesses). Returns 0.0 if no accesses have been recorded.