Skip to content

Commit d17aeea

Browse files
committed
Prefetch block scales before TMA waits
1 parent 305f764 commit d17aeea

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

transformer_nuggets/cute/blockscaled_tma.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,29 @@ def compute_warp_consume_stage(
339339
enable_profiling: cutlass.Constexpr,
340340
) -> tuple[pipeline.PipelineConsumer, list]:
341341
"""Wait for one stage and accumulate the rows owned by this compute warp."""
342+
scale_k = lane * self.scale_blocks_per_lane + k_tile * self.scale_blocks_per_tile
342343
with self.profile_scope(
343344
prof_buf,
344345
ProfileTag.TMA_WAIT,
345346
pid_n,
346347
2 + 3 * k_tile,
347348
enable_profiling,
348349
):
350+
input_scales = self.load_scale_values(
351+
mSFX,
352+
0,
353+
scale_k,
354+
input_scale_atom,
355+
scale_layout,
356+
)
357+
prepared_weight_scales = self.prepare_weight_scale_values(
358+
mSFW,
359+
n0 + owned_row_start,
360+
k_tile,
361+
lane,
362+
weight_scale_atom,
363+
scale_layout,
364+
)
349365
full = consumer.wait_and_advance()
350366

351367
with self.profile_scope(
@@ -355,7 +371,6 @@ def compute_warp_consume_stage(
355371
3 + 3 * k_tile,
356372
enable_profiling,
357373
):
358-
scale_k = lane * self.scale_blocks_per_lane + k_tile * self.scale_blocks_per_tile
359374
x_values = self.load_lane_values(
360375
sX,
361376
0,
@@ -364,21 +379,6 @@ def compute_warp_consume_stage(
364379
smem_atom,
365380
chunk_layout,
366381
)
367-
input_scales = self.load_scale_values(
368-
mSFX,
369-
0,
370-
scale_k,
371-
input_scale_atom,
372-
scale_layout,
373-
)
374-
prepared_weight_scales = self.prepare_weight_scale_values(
375-
mSFW,
376-
n0 + owned_row_start,
377-
k_tile,
378-
lane,
379-
weight_scale_atom,
380-
scale_layout,
381-
)
382382
for local_row in cutlass.range_constexpr(self.rows_per_warp):
383383
cta_row = owned_row_start + local_row
384384
global_row = n0 + cta_row

0 commit comments

Comments
 (0)