[SRC] Enable unroll=1 for gfx950 (#1602)

* [SRC] Enable unroll=1 for gfx950

* Fix typo from rebase in generate.py

* Support for unroll=1 and gfx90a when building for all GPU targets

---------

Signed-off-by: nileshnegi <Nilesh.Negi@amd.com>
This commit is contained in:
Nilesh M Negi
2025-03-27 18:21:35 -05:00
committed by GitHub
parent 9dc23d9265
commit 307bc10781
8 changed files with 116 additions and 40 deletions
+22 -2
View File
@@ -238,9 +238,29 @@ __device__ __forceinline__ void reduceCopy(
}
}
/*
* For gfx90a,
* Before we had `Unroll/2*(16/sizeof(T))/2`, which does not work with unroll=1
* as unroll=1; `Unroll/2` = 0, which results in the above expression to 0, and is not supported
* This was reformulated to `(Unroll*4 + sizeof(T) - 1)/sizeof(T)`
*
* Before: `Unroll/2*(16/sizeof(T))/2`
* sizeof(T)
* unroll 1 2 4 8
* 4 16 8 4 2
* 2 8 4 2 1
* 1 0 0 0 0
*
* After: `(Unroll*4 + sizeof(T) - 1)/sizeof(T)`
* sizeof(T)
* unroll 1 2 4 8
* 4 16 8 4 2
* 2 8 4 2 1
* 1 4 2 1 1
*/
#if defined(__gfx90a__)
if (MinSrcs > 1) {
reduceCopyPacks<RedFn, T, Unroll/2*(16/sizeof(T))/2, sizeof(T),
reduceCopyPacks<RedFn, T, (Unroll*4 + sizeof(T) - 1)/sizeof(T), sizeof(T),
MultimemSrcs, MinSrcs, MaxSrcs, MultimemDsts, MinDsts, MaxDsts, PreOpSrcs>
(nThreads, thread, redArg, preOpArgs, postOp,
nSrcs, srcPtrFn, nDsts, dstPtrFn, nBytesBehind, nBytesAhead);
@@ -282,4 +302,4 @@ __device__ __forceinline__ void reduceCopy(
nDsts, [=]__device__(int i) { return dstPtrs[i]; }, nElts);
}
#endif // COMMON_KERNEL_H_
#endif // COMMON_KERNEL_H_