Repository navigation
Add CUDA.return_type - #1339
Merged
Merged
Add CUDA.return_type#1339
CUDA.return_type#1339Conversation
tkf
commented
Jan 26, 2022
Comment on lines
+146
to
+147
| interp = GPUCompiler.get_interpreter(job) | ||
| return Core.Compiler.return_type(interp, job.source.f, job.source.tt) |
Contributor
Author
There was a problem hiding this comment.
Maybe it's better to have GPUCompiler.return_type like other reflection tools do?
Member
There was a problem hiding this comment.
Accepting a job argument then? It wouldn't do much except for getting an interpreter and forwarding it to Core.Compiler.return_type, so it doesn't seem worth the hassle.
tkf
commented
Jan 26, 2022
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.
This PR adds
CUDA.return_typewhich is likeCore.Compiler.return_typebut for kernel code. I think something like this is required for pre-allocating buffers for user-defined functions using kernel-only API. For example, code usingCUDA.arrayrefon a device array cannot be inferred without something like this, IIUC.I'd like to use an API like this here https://github.com/JuliaFolds/FoldsCUDA.jl/blob/e4fd83e66222350647e659c2be676a7c8136adf3/src/kernels.jl#L107 to allocate the intermediate accumulation result