Skip to content

Remove trivial predicate for matmul#106

Merged
zasdfgbnm merged 16 commits intomainfrom
remove-trivial-predicate-finally
Apr 1, 2023
Merged

Remove trivial predicate for matmul#106
zasdfgbnm merged 16 commits intomainfrom
remove-trivial-predicate-finally

Conversation

@zasdfgbnm
Copy link
Collaborator

@zasdfgbnm zasdfgbnm commented Mar 31, 2023

This PR is stacked on #105, it fixes #95.

There are mainly two changes effective:

  • In lower_scalar_hoist.cpp, add assumptions about parallel indices
  • In predicate_compute.cpp, check if extent is the same as parallel dimension

Only one of the above changes is sufficient to fix the bug, but I did both to be double safe.

cc: @mmigdal-nv @drzejan2

@zasdfgbnm zasdfgbnm marked this pull request as ready for review March 31, 2023 01:37
@zasdfgbnm zasdfgbnm requested a review from naoyam March 31, 2023 01:37
GpuLower::current()->caMap()->getConcreteMappedID(
pred_id, IdMappingMode::EXACT));
auto new_pred = SimplifyingIrBuilder::ltExpr(index, pred_id->extent());
// pt_ not being exact does not mean the predicate is not trivial. For
Copy link
Collaborator

Choose a reason for hiding this comment

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

This makes sense, but wouldn't it be nicer if such IDs were not added to the predicate ID list from the beginning? Can this filtering be done at around line 211?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree with what you said. Let me give it a try.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed, it's working

Base automatically changed from more-expr-simplification to main March 31, 2023 21:13
@zasdfgbnm zasdfgbnm requested a review from naoyam March 31, 2023 21:26
Copy link
Collaborator

@naoyam naoyam left a comment

Choose a reason for hiding this comment

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

LGTM

@zasdfgbnm zasdfgbnm merged commit 2515b4d into main Apr 1, 2023
@zasdfgbnm zasdfgbnm deleted the remove-trivial-predicate-finally branch April 1, 2023 00:40
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.

Trivial predicate is causing a 30% slowdown for matmul with grid swizzle

2 participants