Skip to main content

BankConflictDetector

Struct BankConflictDetector 

Source
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

Source

pub fn new() -> Self

Create a new bank conflict detector.

Source

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
Source

pub fn begin_cycle(&self)

Begin a new access cycle (e.g., a new warp instruction). Resets the per-bank counters.

Source

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

Source

pub fn total_accesses(&self) -> usize

Get the total number of accesses recorded.

Source

pub fn conflict_count(&self) -> usize

Get the number of bank conflicts detected.

Source

pub fn conflict_rate(&self) -> f64

Get the conflict rate (conflicts / total accesses). Returns 0.0 if no accesses have been recorded.

Source

pub fn reset(&self)

Reset all counters.

Source

pub fn summary(&self) -> String

Returns a human-readable summary of bank conflict statistics.

Trait Implementations§

Source§

impl Default for BankConflictDetector

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,