-
Notifications
You must be signed in to change notification settings - Fork 97
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
Emit affine.for in pragma scop #23
Conversation
db979bf
to
aa795af
Compare
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
aa795af
to
2e6f02b
Compare
@@ -180,43 +180,143 @@ ValueWithOffsets MLIRScanner::VisitVarDecl(clang::VarDecl *decl) { | |||
return ValueWithOffsets(op, {zeroIndex}); | |||
} | |||
|
|||
bool MLIRScanner::getConstantLowerBound(clang::ForStmt *fors, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! just a quick comment: does this PR currently supports only constant upper/lower bounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
} | ||
|
||
// CHECK: affine.for %arg0 = 0 to 1024 { | ||
// CHECK-NEXT: %{{.*}} = index_cast %arg0 : index to i32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we need to cast index
to i32
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a cast because the induction variable in the affine.for
is of Index
type while for Clang is i32
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to run a cast cleanup but otherwise LGTM
} | ||
|
||
// CHECK: affine.for %arg0 = 0 to 1024 { | ||
// CHECK-NEXT: %{{.*}} = index_cast %arg0 : index to i32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to run a cast cleanup but otherwise LGTM
Hi @wsmoses and @kumasento,
Sounds good? Do you have any comments or thoughts? |
Hi @chelini I think these steps sounds very good to me. One concern, which might be quite trivial, is how this scop-generated affine MLIR code interacts with the rest of the std code. Maybe in some cases, you might need to add an additional reg2mem pass to deal with live SSA values. |
My next question is when this is going to be run (at frontend or post-processing). If done at the frontend you may need to be mindful of what loads are affine vs std (local variables may need std loads rather than affine, but affine may work -- need to think about). In the interim I'm going to try getting printing working and doing an end-to-end test of the polybench suite. |
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
Add infrastructure to emit an affine.for in a code fragment delimited by pragma scop and pragma endscop. Currently, we emit an affine.for for trivial loops: for (int i = constant; i < other_constant; i++ or ++i).
No description provided.