Skip to content

Fix scf.for loop-carried memref reconciliation#262

Closed
HecreReed wants to merge 2 commits intozhangstevenunity:mainfrom
HecreReed:codex/fix-scf-for-memref-reconcile
Closed

Fix scf.for loop-carried memref reconciliation#262
HecreReed wants to merge 2 commits intozhangstevenunity:mainfrom
HecreReed:codex/fix-scf-for-memref-reconcile

Conversation

@HecreReed
Copy link
Contributor

Summary

  • reconcile scf.for loop-carried iter_arg/result types after PTOViewToMemref rewrites tile values to memrefs
  • add a reduced .pto regression for loop-carried tile_buf values
  • verify the reported qwen3_decode_layer_incore_0.pto now compiles on top of origin/main

Root cause

PTOViewToMemref already had a post-rewrite fixup for scf.if, but not for scf.for. When loop-carried tile_buf values were rewritten to memrefs inside the loop body, the pass left the scf.for init operand, region iter_arg, yield operand, and op result out of sync.

Verification

  • cmake --build /tmp/ptoas-qwen-repro.oy3rK0/build-fix --target ptoas -j8
  • ptoas /tmp/ptoas-qwen-repro.oy3rK0/fix-branch/test/basic/scf_for_tile_iter_arg_reconcile.pto 2>&1 1>/dev/null | FileCheck /tmp/ptoas-qwen-repro.oy3rK0/fix-branch/test/basic/scf_for_tile_iter_arg_reconcile.pto
  • ptoas /Users/laoda/Downloads/qwen3_decode_layer_incore_0.pto -o /tmp/qwen-fix.cpp

@HecreReed HecreReed closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant