Analyze shared-memory bank conflicts for a group of active lanes. For lane i, ai is its byte address, w is bank_width_bytes, B is num_banks, and bi is its bank ID:
bi=⌊wai⌋modB.Floor rounds down, and modulo gives the remainder. In this model, a lane's conflict degree is the number of distinct addresses requested from its bank. Identical addresses share one broadcast and count once. Return a dictionary containing bank_ids and conflict_degree as one-dimensional NumPy int64 arrays, each matching the input length and lane order.
Input: byte_addresses = [0,4,8,12,16,20,24,28], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[0,1,2,3,4,5,6,7],"conflict_degree":[1,1,1,1,1,1,1,1]}
Explanation: Each four-byte word maps to a different bank, so every lane has conflict degree one.
Input: byte_addresses = [0,128,256,384], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[0,0,0,0],"conflict_degree":[4,4,4,4]}
Input: byte_addresses = [64,64,64,64], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[16,16,16,16],"conflict_degree":[1,1,1,1]}
np.unique finds distinct values in an array.
A Boolean mask selects the lanes belonging to one bank.
Accepts: array
Accepts: number
Accepts: number
Analyze shared-memory bank conflicts for a group of active lanes. For lane i, ai is its byte address, w is bank_width_bytes, B is num_banks, and bi is its bank ID:
bi=⌊wai⌋modB.Floor rounds down, and modulo gives the remainder. In this model, a lane's conflict degree is the number of distinct addresses requested from its bank. Identical addresses share one broadcast and count once. Return a dictionary containing bank_ids and conflict_degree as one-dimensional NumPy int64 arrays, each matching the input length and lane order.
Input: byte_addresses = [0,4,8,12,16,20,24,28], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[0,1,2,3,4,5,6,7],"conflict_degree":[1,1,1,1,1,1,1,1]}
Explanation: Each four-byte word maps to a different bank, so every lane has conflict degree one.
Input: byte_addresses = [0,128,256,384], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[0,0,0,0],"conflict_degree":[4,4,4,4]}
Input: byte_addresses = [64,64,64,64], num_banks = 32, bank_width_bytes = 4
Output: {"bank_ids":[16,16,16,16],"conflict_degree":[1,1,1,1]}
np.unique finds distinct values in an array.
A Boolean mask selects the lanes belonging to one bank.
Accepts: array
Accepts: number
Accepts: number