File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1313#if BNB_HIP
1414#include < hip/hip_runtime.h>
1515
16+ // NOTE: This queries device 0 once and caches the result. On mixed RDNA+CDNA
17+ // systems (warp size 32 vs 64) this will return the wrong value for whichever
18+ // device doesn't match device 0.
1619static int bnb_host_warp_size () {
17- constexpr int MAX_DEVICES = 32 ;
18- static int cache[MAX_DEVICES] = {};
19- int dev;
20- (void )hipGetDevice (&dev);
21- if (dev < 0 || dev >= MAX_DEVICES)
22- return 64 ;
23- if (cache[dev] == 0 )
24- (void )hipDeviceGetAttribute (&cache[dev], hipDeviceAttributeWarpSize, dev);
25- return cache[dev];
20+ static int warp_size = 0 ;
21+ if (warp_size == 0 )
22+ (void )hipDeviceGetAttribute (&warp_size, hipDeviceAttributeWarpSize, 0 );
23+ return warp_size;
2624}
2725#else
2826static constexpr int bnb_host_warp_size () { return 32 ; }
You can’t perform that action at this time.
0 commit comments