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

Robustify upstream LICM for zero-trip count loops and other loop kinds #18759

Open
qedawkins opened this issue Oct 11, 2024 · 1 comment
Open
Labels
enhancement ➕ New feature or request good first issue 🌱 Good for newcomers

Comments

@qedawkins
Copy link
Contributor

qedawkins commented Oct 11, 2024

Currently the upstream pass for loop invariant code motion performs hoisting on all loops independent of loop type or loop bounds. This has two issues:

  1. This allows hoisting out of scf.forall ops which are distributed loops. Whether this operation ends up as a loop depends on the processor ID mapping attached to the op which is resolved later in compilation, so hoisting is not possible until then. Additionally, hoisting out of distributed loops complicates determining memory spaces for bufferization because it becomes harder to determine where a write conflict is occurring.
  2. Hoisting any operation out of a zero-trip count loop causes the hoisted operation to potentially do work that wasn't needed. Hoisting needs to either have a guarantee that the loop has at least one trip or wrap the loop in a scf.if (loop_will_happen) { hoisted_code; loop }.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ➕ New feature or request good first issue 🌱 Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants