clean up untag_and_append [pr] (#15812)

replace_uop does not change, and ret.op is always AFTER
This commit is contained in:
chenyu
2026-04-19 11:23:59 -04:00
committed by GitHub
parent f28ea84de2
commit cace07c87a

View File

@@ -144,12 +144,11 @@ pm_early_transform_tensor_graph = PatternMatcher([
def untag_and_append(ctx:AllocCtx, x:UOp):
if x.tag is None: return None
ret = x.replace(tag=None)
replace_uop = ret
while replace_uop.op is Ops.AFTER: replace_uop = replace_uop.src[0]
for t in x.tag:
original_uop: UOp = ctx.uop_list[t]
replace_uop = ret
while replace_uop.op is Ops.AFTER: replace_uop = replace_uop.src[0]
ctx.buffer_map[original_uop] = replace_uop.shrink_to(original_uop.shape)
if ret.op is not Ops.AFTER: ctx.assigns.append(ret) # AFTER gets appended by append_after
return ret
def append_after(ctx:AllocCtx, x:UOp):