Skip to content

Allow dispatch region formation to fuse producer and consumer when producer has multiple uses. - #8970

Merged
MaheshRavishankar merged 1 commit into
iree-org:mainfrom
MaheshRavishankar:fuse_multiuse_producer
May 23, 2022
Merged

MaheshRavishankar merged 1 commit into
iree-org:mainfrom
MaheshRavishankar:fuse_multiuse_producer

Conversation

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Current heuristic to create dispatch regions has checks to fuse
producer with consumer only when the producer has a single use. This
is pessimizing. The only real requirement is that the consumer
dominates all the producers users. Use dominance info to relax this
requirement.

All the models we track currently though dont seem to benefit with
this change (they dont degrade either). The MobileBertInt8 model has
number of dispatches reduce from 1520 -> 1496.

@antiagainst antiagainst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

@okkwon okkwon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added some minor comments. LGTM! Thanks.

/// For all uses of an operation, finds the use that dominates all other uses.
static Optional<OpOperand *> getFusableUse(Operation *op,
DominanceInfo &dominanceInfo) {
for (auto &use : op->getUses()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we can simply use getUsers()?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The method returns the use. So iterating over uses makes more sense.

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

Thanks for the reviews! It seems like this is hitting some issues downstream. Couple of ways to fix it that I am going to take a look at once I get back after break (in a week). So not going to land this for now.

@iree-github-actions-bot

iree-github-actions-bot commented May 23, 2022 •

Copy link
Copy Markdown
Contributor

…oducer has multiple uses.

Current heuristic to create dispatch regions has checks to fuse
producer with consumer only when the producer has a single use. This
is pessimizing. The only real requirement is that the consumer
dominates all the producers users. Use dominance info to relax this
requirement.

All the models we track currently though dont seem to benefit with
this change (they dont degrade either). The MobileBertInt8 model has
number of dispatches reduce from  1520 -> 1496.
@iree-github-actions-bot

Copy link
Copy Markdown
Contributor

Abbreviated x86_64 Benchmark Summary (experimental)

@ commit c8d16d72d63e520190873a4f987912ea111b1809 (vs. base 4030a5d33d05d537832fbb1f4dc9fd4a697693b7)

Improved Benchmarks 🎉

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
PoseNet [fp32] (TFLite) 4-thread,full-inference,default-flags with IREE-Dylib @ GCP-c2-standard-16 (CPU-x86\_64-CascadeLake) 12 (vs. 13, 7.69%↓) 12 0

For more information:

@MaheshRavishankar
MaheshRavishankar merged commit 51a1dc2 into iree-org:main May 23, 2022
@MaheshRavishankar
MaheshRavishankar deleted the fuse_multiuse_producer branch May 23, 2022 05:10
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.

4 participants