Repository navigation
Adding multiple layouts to HAL executable creation. - #4621
Merged
Merged
Conversation
benvanik
force-pushed
the
staging-hal-rewrite
branch
from
January 28, 2021 19:26
80885b7 to
50d9823
Compare
benvanik
force-pushed
the
benvanik-executable-layouts-wreck
branch
2 times, most recently
from
January 28, 2021 19:52
90a7648 to
327e836
Compare
benvanik
force-pushed
the
staging-hal-rewrite
branch
from
January 29, 2021 04:03
59b7a7c to
6de6fdf
Compare
benvanik
force-pushed
the
benvanik-executable-layouts-wreck
branch
3 times, most recently
from
January 29, 2021 07:02
78f2448 to
e176a3c
Compare
Collaborator
Author
|
All tests but lit ones are passing now - will do in the AM. Turns out DCE actually works now because of these fixes and some of the tests are assuming it doesn't :P |
ScottTodd
approved these changes
Jan 29, 2021
|
|
||
| static PassRegistration<MaterializeEntryPointsPass> pass( | ||
| "iree-codegen-materialize-entry-points", | ||
| "Materialize HAL entry points for each spv.EntryPoint", |
Member
There was a problem hiding this comment.
Want to add tests for this pass? (fine to skip if the pass will be deleted along with SplitDispatchFunctionPass soon)
Collaborator
Author
There was a problem hiding this comment.
yeah this entire path is woefully undertested - there were only two or three tests in all of IREE that failed with these multiple spir-v entry points (simple_embedding_test was one of them lol). Really hoping we can kill it off soon, and I think the work mahesh is doing is going to make that very possible!
Comment on lines
+110
to
+111
| // Hide the linker banner message printed each time. | ||
| "/nologo", |
Comment on lines
-268
to
-273
| // TODO(benvanik): support multiple interfaces. We'd probably want to | ||
| // store each executable+interface as a variable. | ||
| // | ||
| // This is *only* safe now because any backends that support multiple | ||
| // interfaces during compilation do *not* use layouts during executable | ||
| // cache preparation. |
Member
There was a problem hiding this comment.
So happy to see this resolved :D
Required working around the SplitDispatchFunctionPass on the SPIR-V side. Fixes #4536.
benvanik
force-pushed
the
benvanik-executable-layouts-wreck
branch
from
January 30, 2021 01:26
e176a3c to
068adbc
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fact that we were providing one layout per executable was always a bug and only worked because nothing actually used that argument. This fixes things so that we properly pass a layout per entry point of the executable so that linked executables (which may have any number of interfaces) work correctly.
As a side-effect, this PR also simplifies the HAL interface exposed to the compiler to hide the executable caches. That they were represented at all in the IR was a bit weird as they are a runtime-provider controlled concept and the lifetime of them is critically tied to the lifetime of the loaded compiled module. This removes the hack that was implicitly keeping the executables live in the VM.
It also required minor compiler changes because of the split dispatch regions stuff in the legacy spir-v path and I had to add a workaround to fix up the IR. The existing approach (where the SPIR-V backend didn't tell the HAL about the entry points it created) only worked because we were not validating executable layouts and the vulkan pipelines were just created with the same single layout provided. The upside of this hack is that we could probably start linking SPIR-V modules.
Fixes #4536.