Программы на C++. Форум разработчиков
-
Anonymous
Почему до сих пор возникает конфликт банков при использовании swizzle для обработки данных?
Сообщение
Anonymous »
Код: Выделить всё
#include
#include
#include
#include
__global__ void swizzle_kernel(half *A,half* B){
__shared__ half s[32][64];
int lane_id = threadIdx.x % 32;
int warp_id = threadIdx.x / 32;
int row = warp_id /4 * 16 + lane_id / 2;
int col = ((warp_id % 4) * 2 +lane_id % 2) ^ (row & 7);
*((int4*)(&s[row][col * 8])) = *((int4*)(A + row * 64 + ((warp_id %4) * 2 +lane_id % 2 ) * 8));
__syncthreads();
int4 tmp[2];
tmp[0] = *(int4*)(&s[warp_id / 4 *16 + lane_id % 16][col * 8]);
half sum=0;
for(int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79264081/why-is-there-still-a-bank-conflict-when-using-swizzle-to-process-data[/url]
1733728396
Anonymous
[code]#include
#include
#include
#include
__global__ void swizzle_kernel(half *A,half* B){
__shared__ half s[32][64];
int lane_id = threadIdx.x % 32;
int warp_id = threadIdx.x / 32;
int row = warp_id /4 * 16 + lane_id / 2;
int col = ((warp_id % 4) * 2 +lane_id % 2) ^ (row & 7);
*((int4*)(&s[row][col * 8])) = *((int4*)(A + row * 64 + ((warp_id %4) * 2 +lane_id % 2 ) * 8));
__syncthreads();
int4 tmp[2];
tmp[0] = *(int4*)(&s[warp_id / 4 *16 + lane_id % 16][col * 8]);
half sum=0;
for(int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79264081/why-is-there-still-a-bank-conflict-when-using-swizzle-to-process-data[/url]