Created
March 14, 2013 20:38
-
-
Save allanmac/5165008 to your computer and use it in GitHub Desktop.
Butterfly max.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define KERNEL_QUALIFIERS extern "C" __global__ | |
KERNEL_QUALIFIERS | |
void shflmax(const int* const vin, int* const vout) | |
{ | |
int v = vin[threadIdx.x]; | |
v = max(v,__shfl_xor(v,16)); | |
v = max(v,__shfl_xor(v, 8)); | |
v = max(v,__shfl_xor(v, 4)); | |
v = max(v,__shfl_xor(v, 2)); | |
v = max(v,__shfl_xor(v, 1)); | |
vout[threadIdx.x] = v; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiled with:
nvcc -m 32 -arch sm_30 -cubin shflmax.cu
Dumped with:
cuobjdump.exe -sass shflmax.cubin