@@ -1674,11 +1674,11 @@ def relay(
16741674 @cute .jit
16751675 def load (
16761676 self ,
1677- thr_mma_S : cute .core . ThrMma ,
1678- thr_mma_dP : cute .core . ThrMma ,
1679- thr_mma_dV : cute .core . ThrMma ,
1680- thr_mma_dK : cute .core . ThrMma ,
1681- thr_mma_dQ : cute .core . ThrMma ,
1677+ thr_mma_S : cute .ThrMma ,
1678+ thr_mma_dP : cute .ThrMma ,
1679+ thr_mma_dV : cute .ThrMma ,
1680+ thr_mma_dK : cute .ThrMma ,
1681+ thr_mma_dQ : cute .ThrMma ,
16821682 mQ : cute .Tensor ,
16831683 mK : cute .Tensor ,
16841684 mKt : Optional [cute .Tensor ],
@@ -2821,10 +2821,10 @@ def apply_score_mod_bwd(
28212821 @cute .jit
28222822 def compute_loop (
28232823 self ,
2824- thr_mma_S : cute .core . ThrMma ,
2825- thr_mma_dP : cute .core . ThrMma ,
2826- thr_mma_dV : cute .core . ThrMma ,
2827- thr_mma_dK : cute .core . ThrMma ,
2824+ thr_mma_S : cute .ThrMma ,
2825+ thr_mma_dP : cute .ThrMma ,
2826+ thr_mma_dV : cute .ThrMma ,
2827+ thr_mma_dK : cute .ThrMma ,
28282828 tStS : cute .Tensor ,
28292829 tdPtdP : cute .Tensor ,
28302830 tdVtdV : cute .Tensor ,
@@ -3047,14 +3047,14 @@ def compute_loop(
30473047 m_block_oob = m_block >= m_block_max
30483048 # Prefetch 1 stage of LSE
30493049 pipeline_LSE .consumer_wait (consumer_state_LSE )
3050- tSrLSE_s2r = cute .make_fragment (tScS_t2r [None , 0 , 0 , 0 ].shape , Float32 )
3050+ tSrLSE_s2r = cute .make_rmem_tensor (tScS_t2r [None , 0 , 0 , 0 ].shape , Float32 )
30513051 if const_expr (prefetch_LSE and not self .shuffle_LSE ):
30523052 cute .autovec_copy (tSsLSE [None , 0 , 0 , 0 , consumer_state_LSE .index ], tSrLSE_s2r )
30533053
30543054 pipeline_S_P .consumer_wait (consumer_state_S_P_dP )
30553055 # pipeline_S_P.sync_object_full.wait(0, consumer_phase_S_P_dP)
30563056 #### TMEM->RMEM (Load S from TMEM)
3057- tSrS_t2r = cute .make_fragment (tScS_t2r .shape , Float32 )
3057+ tSrS_t2r = cute .make_rmem_tensor (tScS_t2r .shape , Float32 )
30583058 cute .copy (thr_copy_t2r , tStS_t2r , tSrS_t2r )
30593059
30603060 if const_expr (self .tile_hdim == 192 ):
@@ -3105,7 +3105,7 @@ def compute_loop(
31053105 #### P = exp(S - LSE)
31063106 # ---------------------------------------------
31073107 lane_idx = cute .arch .lane_idx ()
3108- tSrP_r2t_f32 = cute .make_fragment (tScP_r2t .shape , Float32 ) # 64
3108+ tSrP_r2t_f32 = cute .make_rmem_tensor (tScP_r2t .shape , Float32 ) # 64
31093109 tSrP_r2t = cute .recast_tensor (tSrP_r2t_f32 , self .q_dtype )
31103110 for stage in cutlass .range_constexpr (num_stages ):
31113111 tSrS_cur = tSrS_t2r [None , stage , 0 , 0 ]
@@ -3167,7 +3167,7 @@ def compute_loop(
31673167
31683168 ##### dS.T = P.T * (dP.T - Psum)
31693169 for stage in cutlass .range_constexpr (num_stages ):
3170- tdPrdP_t2r = cute .make_fragment (tScS_t2r [None , 0 , None , None ].shape , Float32 )
3170+ tdPrdP_t2r = cute .make_rmem_tensor (tScS_t2r [None , 0 , None , None ].shape , Float32 )
31713171 cute .copy (thr_copy_t2r , tdPtdP_t2r [None , stage , None , None ], tdPrdP_t2r )
31723172 cute .arch .fence_view_async_tmem_load ()
31733173 self .compute_sync_barrier .arrive_and_wait ()
@@ -3459,7 +3459,7 @@ def dQacc_reduce(
34593459 self ,
34603460 mdQaccum : cute .Tensor ,
34613461 sdQaccum : cute .Tensor ,
3462- thr_mma_dQ : cute .core . ThrMma ,
3462+ thr_mma_dQ : cute .ThrMma ,
34633463 tdQtdQ : cute .Tensor ,
34643464 pipeline_dQ : PipelineAsync ,
34653465 dQaccum_empty_mbar_ptr : Optional [cute .Pointer ],
@@ -3590,7 +3590,7 @@ def dQacc_reduce(
35903590 m_block_oob_upper = m_block >= m_block_max
35913591 pipeline_dQ .consumer_wait (dQ_consumer_state )
35923592 # TMEM -> RMEM
3593- tdQrdQ_t2r = cute .make_fragment (tdQrdQ_t2r_shape , Float32 )
3593+ tdQrdQ_t2r = cute .make_rmem_tensor (tdQrdQ_t2r_shape , Float32 )
35943594 cute .copy (thr_copy_t2r , tdQtdQ_t2r , tdQrdQ_t2r )
35953595 cute .arch .fence_view_async_tmem_load ()
35963596 cute .arch .sync_warp ()
@@ -3721,8 +3721,8 @@ def epilogue_dKV(
37213721 head_idx : Int32 ,
37223722 n_block : Int32 ,
37233723 seqlen ,
3724- thr_mma_dV : cute .core . ThrMma ,
3725- thr_mma_dK : cute .core . ThrMma ,
3724+ thr_mma_dV : cute .ThrMma ,
3725+ thr_mma_dK : cute .ThrMma ,
37263726 tdVtdV : cute .Tensor ,
37273727 tdKtdK : cute .Tensor ,
37283728 mdV : cute .Tensor ,
@@ -3758,7 +3758,7 @@ def epilogue_dKV(
37583758
37593759 tdVcdV_t2r_p = thr_tmem_ld_dV .partition_D (tdVcdV_tensor )
37603760 tdVcdV_t2r = self .split_wg (tdVcdV_t2r_p , wg_idx , num_wg )
3761- tdVrdV_t2r = cute .make_fragment (tdVcdV_t2r .shape , Float32 )
3761+ tdVrdV_t2r = cute .make_rmem_tensor (tdVcdV_t2r .shape , Float32 )
37623762
37633763 cute .copy (thr_tmem_ld_dV , tdVtdV_t2r , tdVrdV_t2r )
37643764 cute .arch .fence_view_async_tmem_load ()
@@ -3775,7 +3775,7 @@ def epilogue_dKV(
37753775 tiler_mn = tiled_tmem_ld_dV .tiler_mn ,
37763776 )
37773777
3778- tdVrdV_r2s = cute .make_fragment (tdVrdV_t2r .shape , self .dv_dtype )
3778+ tdVrdV_r2s = cute .make_rmem_tensor (tdVrdV_t2r .shape , self .dv_dtype )
37793779 for i in cutlass .range_constexpr (cute .size (tdVrdV_t2r , mode = [1 ])):
37803780 dV_vec = tdVrdV_t2r [(None , i , 0 , 0 )].load ()
37813781 tdVrdV_r2s [(None , i , 0 , 0 )].store (dV_vec .to (self .dv_dtype ))
@@ -3810,7 +3810,7 @@ def epilogue_dKV(
38103810
38113811 tdKcdK_t2r_p = thr_tmem_ld_dK .partition_D (tdKcdK_tensor )
38123812 tdKcdK_t2r = self .split_wg (tdKcdK_t2r_p , wg_idx , num_wg )
3813- tdKrdK_t2r = cute .make_fragment (tdKcdK_t2r .shape , Float32 )
3813+ tdKrdK_t2r = cute .make_rmem_tensor (tdKcdK_t2r .shape , Float32 )
38143814
38153815 cute .copy (tiled_tmem_ld_dK , tdKtdK_t2r , tdKrdK_t2r )
38163816 cute .arch .fence_view_async_tmem_load ()
@@ -3828,7 +3828,7 @@ def epilogue_dKV(
38283828 tiler_mn = tiled_tmem_ld_dK .tiler_mn ,
38293829 )
38303830
3831- tdKrdK_r2s = cute .make_fragment (tdKrdK_t2r .shape , self .dk_dtype )
3831+ tdKrdK_r2s = cute .make_rmem_tensor (tdKrdK_t2r .shape , self .dk_dtype )
38323832
38333833 for i in cutlass .range_constexpr (cute .size (tdKrdK_t2r , mode = [1 ])):
38343834 dK_vec = tdKrdK_t2r [(None , i , 0 , 0 )].load () * softmax_scale
@@ -3857,7 +3857,7 @@ def epilogue_dK_or_dV_tma(
38573857 head_idx : Int32 ,
38583858 n_block : Int32 ,
38593859 seqlen ,
3860- thr_mma : cute .core . ThrMma ,
3860+ thr_mma : cute .ThrMma ,
38613861 tdKVtdKV : cute .Tensor ,
38623862 mdKV : cute .Tensor ,
38633863 sdKV : cute .Tensor ,
@@ -3976,7 +3976,7 @@ def epilogue_dK_or_dV_tma(
39763976 if const_expr (num_epi_stages > 1 ):
39773977 tdKVcdKV_t2r = tdKVcdKV_t2r [None , epi_stage ]
39783978
3979- tdKVrdKV_t2r = cute .make_fragment (tdKVcdKV_t2r .shape , Float32 )
3979+ tdKVrdKV_t2r = cute .make_rmem_tensor (tdKVcdKV_t2r .shape , Float32 )
39803980
39813981 assert cute .size (tdKVrdKV_t2r ) == cute .size (tdKVtdKV_t2r ) // cute .arch .WARP_SIZE , (
39823982 "RMEM<->TMEM fragment size mismatch"
@@ -3992,7 +3992,7 @@ def epilogue_dK_or_dV_tma(
39923992 tdKVrdKV_t2r [2 * i ], tdKVrdKV_t2r [2 * i + 1 ] = cute .arch .mul_packed_f32x2 (
39933993 (tdKVrdKV_t2r [2 * i ], tdKVrdKV_t2r [2 * i + 1 ]), (scale , scale )
39943994 )
3995- tdKVrdKV = cute .make_fragment (tdKVrdKV_t2r .shape , dtype ) # (32 columns)
3995+ tdKVrdKV = cute .make_rmem_tensor (tdKVrdKV_t2r .shape , dtype ) # (32 columns)
39963996 tdKVrdKV .store (tdKVrdKV_t2r .load ().to (dtype ))
39973997
39983998 # RMEM -> SMEM -- copy, fence and barrier
0 commit comments