[Metal] deferred codegen does not lower thread id intrinsics#624
Draft
tgymnich wants to merge 4 commits intoJuliaGPU:masterfrom
Draft
[Metal] deferred codegen does not lower thread id intrinsics#624tgymnich wants to merge 4 commits intoJuliaGPU:masterfrom
tgymnich wants to merge 4 commits intoJuliaGPU:masterfrom
Conversation
Member
|
I don't like the pass being invoked twice. Only calling it in |
Member
Author
|
As an in-between solution we could call Or alternatively: Conditionally perform |
Member
1d233d7 to
e18b7c2
Compare
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.
We currently handle our fake intrinsics for thread id etc. (
add_input_arguments!) onfinish_moduleif we are dealing with a kernel (job.config.kernel = true). This all happens before deferred codegen and linking those deferred modules.Now if our kernel contains deferred codegen jobs which are not kernels (
job.config.kernel = false) (using Enzyme for example) we end up withjulia.air.thread_position_in_grid.i32in our main kernel after linking. Which will not be removed sincefinish_modulealready ran before. The deferred code is not a kernel and thus never ranadd_input_arguments!during itsfinish_module.This PR solves this issue by calling
add_input_arguments!infinish_irwhich is called after linking.cc @wsmoses
Other Solutions / Discussion
add_input_argumentsduring IR post-processing