File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,21 @@ struct shared_allocator {
285285 */
286286using tma_allocator = shared_allocator<1024 >;
287287using tma_swizzle_allocator = tma_allocator; // swizzled TMA modes require up to 1024 byte alignments :/
288+
289+ /* Get CTA ID within a cluster */
290+ __device__ static inline int3 clusterIdx () {
291+ int3 cluster_idx;
292+ asm volatile (" mov.u32 %0, %clusterid.x;\n " : " =r" (cluster_idx.x ));
293+ asm volatile (" mov.u32 %0, %clusterid.y;\n " : " =r" (cluster_idx.y ));
294+ asm volatile (" mov.u32 %0, %clusterid.z;\n " : " =r" (cluster_idx.z ));
295+ return cluster_idx;
296+ }
297+ __device__ static inline int cluster_ctarank () {
298+ uint32_t ctarank;
299+ asm volatile (" mov.u32 %0, %cluster_ctarank;\n " : " =r" (ctarank));
300+ return ctarank;
301+ }
302+
288303#endif
289304
290305} // namespace kittens
You can’t perform that action at this time.
0 commit comments