-
Notifications
You must be signed in to change notification settings - Fork 87
KI Sub-groups #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
KI Sub-groups #668
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b17078b
Initial subgroups support
christiangnrd 03a93db
`shfl_down` intrinsics
christiangnrd d788e82
All backends are synchronizing
christiangnrd 9188d8e
Local backend support
christiangnrd d308bb8
[Temp] Use new intrinsics feature branches in CI
christiangnrd aa5b2d9
Fixes to pocl backend in line with OpenCL fixes
christiangnrd d7762ae
Temp?
christiangnrd 81a0a99
Fix
christiangnrd 5d5c1c5
Correct branch
christiangnrd 06a1013
Add `supports_subgroups`
christiangnrd 0168d17
Fix
christiangnrd a48643a
Format
christiangnrd b669f95
Add supports_subgroups to docs
christiangnrd ff172f8
Readd comment
christiangnrd 8b18d39
Remove `supports_subgroups`
christiangnrd cdad772
Fix again
christiangnrd 246dd41
Revert test branch changes
christiangnrd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| ## gpucompiler interface | ||
|
|
||
| struct OpenCLCompilerParams <: AbstractCompilerParams end | ||
| Base.@kwdef struct OpenCLCompilerParams <: AbstractCompilerParams | ||
| # request a fixed sub-group width via `intel_reqd_sub_group_size` | ||
| sub_group_size::Union{Nothing, Int} = nothing | ||
| end | ||
|
|
||
| const OpenCLCompilerConfig = CompilerConfig{SPIRVCompilerTarget, OpenCLCompilerParams} | ||
| const OpenCLCompilerJob = CompilerJob{SPIRVCompilerTarget, OpenCLCompilerParams} | ||
|
|
||
|
|
@@ -31,6 +35,11 @@ function GPUCompiler.finish_module!( | |
| job, mod, entry | ||
| ) | ||
|
|
||
| sg_size = job.config.params.sub_group_size | ||
| if sg_size !== nothing | ||
| metadata(entry)["intel_reqd_sub_group_size"] = MDNode([ConstantInt(Int32(sg_size))]) | ||
| end | ||
|
|
||
| # if this kernel uses our RNG, we should prime the shared state. | ||
| # XXX: these transformations should really happen at the Julia IR level... | ||
| if haskey(functions(mod), "julia.opencl.random_keys") && job.config.kernel | ||
|
|
@@ -130,14 +139,17 @@ function compiler_config(dev::cl.Device; kwargs...) | |
| end | ||
| return config | ||
| end | ||
| @noinline function _compiler_config(dev; kernel = true, name = nothing, always_inline = false, kwargs...) | ||
| @noinline function _compiler_config(dev; kernel = true, name = nothing, always_inline = false, sub_group_size::Union{Nothing, Int} = 32, kwargs...) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try different defaults here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't. I just went with what is most common on the GPU side |
||
| supports_fp16 = "cl_khr_fp16" in dev.extensions | ||
| supports_fp64 = "cl_khr_fp64" in dev.extensions | ||
|
|
||
| if sub_group_size !== nothing && sub_group_size ∉ dev.sub_group_sizes | ||
| error("$sub_group_size is not a valid sub-group size for this device.") | ||
| end | ||
|
|
||
| # create GPUCompiler objects | ||
| target = SPIRVCompilerTarget(; supports_fp16, supports_fp64, validate = true, kwargs...) | ||
| params = OpenCLCompilerParams() | ||
| params = OpenCLCompilerParams(; sub_group_size) | ||
| return CompilerConfig(target, params; kernel, name, always_inline) | ||
| end | ||
|
|
||
|
|
||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.