Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FXML-5083] SCFToEmitC: use already lowered operands #375

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

cferry-AMD
Copy link
Collaborator

The lowering of scf.for ops uses the non-lowered operands, which breaks when these operands have undergone EmitC lowering.

@cferry-AMD
Copy link
Collaborator Author

NB: upstream is also incorrect, so I'll issue the same upstream.

Copy link
Collaborator

@mgehre-amd mgehre-amd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was quick!
Could you please add a test using index?

@cferry-AMD
Copy link
Collaborator Author

On the upstream maybe; on the current version of our fork, something like this:

func.func @for_yield_index(%arg0 : index, %arg1 : index, %arg2 : index) -> index {
  %zero = arith.constant 0 : index
  %r = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%acc = %zero) -> index {
    scf.yield %acc : index
  }
  return %r : index
}

results in a bug:

mlir/test/Conversion/SCFToEmitC/for.mlir:105:5: error: null operand found
    scf.yield %acc : index
    ^
mlir/test/Conversion/SCFToEmitC/for.mlir:105:5: note: see current operation: "emitc.assign"(%5, <<NULL VALUE>>) : (!emitc.size_t, <<NULL TYPE>>) -> ()

(the scf.yield is indeed erased, so it should not be verified, yet it is).

@mgehre-amd mgehre-amd merged commit 9d48ee6 into feature/fused-ops Oct 4, 2024
5 checks passed
@mgehre-amd mgehre-amd deleted the corentin.fix_for_lowering branch October 4, 2024 14:50
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.

2 participants