Skip to content

Commit 61abcce

Browse files
committed
simplify bias layout annotation
1 parent 91cd142 commit 61abcce

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

examples/xegpu_matmul/schedule.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -340,32 +340,14 @@ def convert_layout(value, input, target):
340340
xegpu.set_op_layout_attr(dpas_op, index=2, **output_layout)
341341

342342
if has_bias:
343-
# for post ops we need to add C layout manually
343+
# annotate the 1d load of the broadcast op with a slice layout
344344
add_op = match(gpu_func, ops={"arith.addf"})
345-
xegpu.set_op_layout_attr(add_op, result=True, index=0, **output_layout)
346-
347-
# annotate broadcast op operands
348345
bcast_op = transform.get_producer_of_operand(anytype, add_op, 0)
349-
xegpu.set_op_layout_attr(bcast_op, result=True, index=0, **output_layout)
350346
bcast_load = transform.get_producer_of_operand(anytype, bcast_op, 0)
351347
xegpu.set_op_layout_attr(
352348
bcast_load, result=True, index=0, **output_layout, slice_dims=[0]
353349
)
354-
output_layout_dim1 = {
355-
"sg_layout": [sg_layout[1]],
356-
"sg_data": [sg_tile[1]],
357-
"inst_data": [dpas_shape_c[1]],
358-
}
359-
offset = transform.get_producer_of_operand(anytype, bcast_load, 1)
360-
xegpu.set_op_layout_attr(offset, result=True, index=0, **output_layout_dim1)
361-
aux1 = transform.get_producer_of_operand(anytype, offset, 0)
362-
xegpu.set_op_layout_attr(aux1, result=True, index=0, **output_layout_dim1)
363-
aux2 = transform.get_producer_of_operand(anytype, offset, 1)
364-
xegpu.set_op_layout_attr(aux2, result=True, index=0, **output_layout_dim1)
365-
mask = transform.get_producer_of_operand(anytype, bcast_load, 2)
366-
xegpu.set_op_layout_attr(mask, result=True, index=0, **output_layout_dim1)
367350
raise NotImplementedError("Bias layout propagation is not supported.")
368-
369351
transform.apply_cse(gpu_func)
370352
canonicalize(gpu_func)
371353

0 commit comments

Comments
 (0)