Skip to content

Commit 6603d55

Browse files
committed
address more comments
1 parent 4d68ae9 commit 6603d55

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎lighthouse/dialects/transform/transform_ext/ops/compute_num_threads.py‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,19 @@ class ComputeNumThreadsOp(
1313
"""
1414
Compute the workgroup thread count from wg and sg tile params.
1515
16-
Returns `base * prod_i(wg_i // sg_i)` over the tile dimensions, treating an
17-
untiled (0) dim as 1 to avoid division by zero.
16+
Returns `subgroup_size * prod_i(wg_i // sg_i)` over the WG/SG tile
17+
dimensions, treating an untiled (0) dim as 1 to avoid division by zero.
18+
19+
This op is intended to be used to compute the number of threads for a
20+
workgroup based on the provided WG and SG tile sizes.
21+
22+
Example:
23+
24+
wg_tile, sg_tile, _ = tr_ext.infer_xegpu_attention_params(anchor_op)
25+
nb_threads = transform_ext.compute_num_threads(
26+
wg_tile, sg_tile, base=NB_WORKITEMS
27+
)
28+
xegpu.set_gpu_launch_threads(launch_op, threads=[nb_threads, 1, 1])
1829
1930
The wg and sg tiles are each passed as one or more param operands via the
2031
single `tiles` operand list; `num_wg_handles` marks how many leading
@@ -26,7 +37,8 @@ class ComputeNumThreadsOp(
2637
Args:
2738
tiles: wg tile param operand(s) followed by sg tile param operand(s).
2839
num_wg_handles: Number of leading `tiles` operands forming the wg tile.
29-
base: Multiplier applied to the subgroup count (e.g. the subgroup size).
40+
base: Multiplier applied to the subgroup count (e.g., the subgroup
41+
size).
3042
Return:
3143
Param holding the thread count as a single i64.
3244
"""

0 commit comments

Comments
 (0)