Skip to content

Use generated function to compute number of workgroups to be launched. - #3095

Merged
MaheshRavishankar merged 1 commit into
iree-org:mainfrom
MaheshRavishankar:fix_dispatch
Sep 15, 2020
Merged

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

Conversation

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

The current mechanism of deciding number of workgroups to use for the
launch uses an enumeration of fixed strategies. This is not sufficient
to cover all uses. This commit adds a new mechanism where the
codegeneration passes generate the function to use that when called
from the host side will return the number of workgroups to use. The
arguments to the function are the shapes of the inputs and outputs to
the dispatch region.
Currently this is enabled only for static shapes, since there are some
unresolved issues w.r.t to the dynamic shape case.

@benvanik benvanik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hmm this has an design issue - all of the new result num/operand num/etc attributes cannot exist. The interface bindings are not 1:1 with function operands/results. The signature on the entry point is informational only and cannot be used to reverse the mapping.

There shouldn't be any need to do that, but I'm having trouble finding where in the code the false requirement snuck in.

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

The operand_num/result_num are not on the interface (since each binding might be for multiple values). They are just on the load/store/placeholder ops. This way I can map back to the Operands/Results of the DispatchState. Happy to try a better way. Lets chat offline.

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

Please hold off on review for a bit. Going to be pushing some changes that needs some cleanup (comments, documentation, etc.)

@MaheshRavishankar
MaheshRavishankar force-pushed the fix_dispatch branch 3 times, most recently from 24efc93 to 2caad4a Compare September 10, 2020 00:58
@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

This is now ready for review.
@antiagainst @benvanik @hanhanW

@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.

Awesome!

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

Thanks for the review!

The current mechanism of deciding number of workgroups to use for the
launch uses an enumeration of fixed strategies. This is not sufficient
to cover all uses. This commit adds a new mechanism where the
codegeneration passes generate the function to use that when called
from the host side will return the number of workgroups to use. The
arguments to the function are the shapes of the inputs and outputs to
the dispatch region.
Currently this is enabled only for static shapes, since there are some
unresolved issues w.r.t to the dynamic shape case.
@MaheshRavishankar
MaheshRavishankar merged commit f5fe759 into iree-org:main Sep 15, 2020
@MaheshRavishankar
MaheshRavishankar deleted the fix_dispatch branch September 15, 2020 07:55
MaheshRavishankar added a commit to MaheshRavishankar/iree that referenced this pull request Sep 15, 2020
iree-org#3095)

The current mechanism of deciding number of workgroups to use for the
launch uses an enumeration of fixed strategies. This is not sufficient
to cover all uses. This commit adds a new mechanism where the
codegeneration passes generate the function to use that when called
from the host side will return the number of workgroups to use. The
arguments to the function are the shapes of the inputs and outputs to
the dispatch region.
Currently this is enabled only for static shapes, since there are some
unresolved issues w.r.t to the dynamic shape case.
@ScottTodd ScottTodd mentioned this pull request Sep 16, 2020
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2020
* 903f809 Script to update to llvm syncpoint (#3155)
* a398c96 Translate VM Function to C Code (#2842)
* f941efb Multistage docker containers with RBE swiftshader support (#3065)
* b7d5710 [spirv] Extract common SPIR-V target functionalities out (NFC) (#3140)
* f5fe759 Use generated function to compute number of workgroups to be launched. (#3095)
* b89191c Merge google -> main (#3143)

COPYBARA_INTEGRATE_REVIEW=#3160 from ScottTodd:main-to-google 903f809
PiperOrigin-RevId: 331891580
ScottTodd added a commit that referenced this pull request Sep 16, 2020
* 903f809 Script to update to llvm syncpoint (#3155)
* a398c96 Translate VM Function to C Code (#2842)
* f941efb Multistage docker containers with RBE swiftshader support (#3065)
* b7d5710 [spirv] Extract common SPIR-V target functionalities out (NFC) (#3140)
* f5fe759 Use generated function to compute number of workgroups to be launched. (#3095)
* b89191c Merge google -> main (#3143)

COPYBARA_INTEGRATE_REVIEW=#3160 from ScottTodd:main-to-google 903f809
PiperOrigin-RevId: 331891580
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.

3 participants