-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Transform][Fusion] Introduce an iterative tiling and fusion pass in forward and backward fashion #87
Conversation
1fa34f4
to
5cc9bca
Compare
af801cc
to
d130996
Compare
#122 is to update LLVM version. Please rebase after that PR is merged. |
9e6fbc6
to
8ef6702
Compare
ee371dc
to
5de318f
Compare
9a4d734
to
938c66f
Compare
17c88aa
to
42c24b0
Compare
42c24b0
to
8d37c20
Compare
@Yun-Fly thanks for your PR! I've been able to test your pass in the GPU pipeline (linalg->xegpu->gpu exe) by replacing What prevents us from changing
|
Glad to hear this progress!
Yes, its a quite great point! Firstly, I would like to share some context with you:
I would still try to add a parameter to pass |
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.
@Yun-Fly, could you please add test cases that showcase the described scenarios? This would really help in understanding pre/post conditions.
Hi, @dchigarev . I have added new parameter called |
Sure, I will arrange them later. |
e839fb2
to
d0c456f
Compare
Thank you! I think this will be enough for our first gpu-pipeline prototype |
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.
The first pack of the comments/questions. Tried to go inside-out on the tiling using interface.
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.
Second portion.
FailureOr<int64_t> cstTileSizes = | ||
ValueBoundsConstraintSet::computeConstantBound( | ||
presburger::BoundType::UB, tileSizes[resultExpr.index()], nullptr, | ||
true); |
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.
FailureOr<int64_t> cstTileSizes = | |
ValueBoundsConstraintSet::computeConstantBound( | |
presburger::BoundType::UB, tileSizes[resultExpr.index()], nullptr, | |
true); | |
FailureOr<int64_t> cstTileSizes = | |
ValueBoundsConstraintSet::computeConstantBound( | |
presburger::BoundType::UB, tileSizes[resultExpr.index()], /*stopCondition=*/nullptr, | |
/*closedUB=*/true); |
Btw, are there cases when we know the tile sizes statically?
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 assume all the tileSize
is static rather than dymamic. BTW, do we need to support dynamic shape at this moment?
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.
It's OK to start with the static case. We'll need the dynamic as well of course.
if (!cstIterDomain || failed(cstTileSizes) || | ||
cstIterDomain != cstTileSizes) |
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.
What does this check exactly?
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.
As the name of this filter(noTilingOnReductionFilter
) said, we need to ensure there exist no tiling on any reduction dimension. Otherwise, it will lead to wrong calculation result. I.e. tileSize
should equal to IterationDomain
. Certainly, if either of them is not dynamic, they are incomparable until RUNTIME , so just return failure
for such case.
if (!failed(cstSize) && cstInnerSize) { | ||
if (*cstSize % *cstInnerSize == 0) | ||
continue; |
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.
Is this to cover some weird uneven tiling/generic case? I mean, what's the reason a tail check is not sufficient?
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.
As the name of this filter(exactTilingOnPackUnPackFilter
) said, uneven tiling/generic case is not expected so far because it will involve more complex imperfect tiling case.
MLIRContext *ctx; | ||
}; | ||
|
||
using OpTileSizeMap = std::unordered_map<std::string, SmallVector<int64_t>>; |
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.
Wouldn't it be easier and safer to use the type ID for it?
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.
Yeah, I agree. But the problem is that the default tileSize
is passed by argument
, like gc-opt -iterative-tiling-and-fusion="default-tile-size=matmul:{32,32}"
. By MLIR parser, they will be converted to std::string
in fact.
443100f
to
4dd5214
Compare
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.
Thanks, looks better now. It this still needs even more testing. All the minor things we can clean up later on.
Track issue: Support fine-grain fusion #54