Open
Conversation
…ched by indirect function calls (CUDA) or direct callables (Optix) but converted into switch-like statements
…table rather than a series of individual branches.
…a binary search to branch to the appropriate vcall.
Speierers
reviewed
Dec 8, 2022
| bool jump_table = jit_flag(JitFlag::VCallBranchJumpTable); | ||
| bool binary_search = jit_flag(JitFlag::VCallBranchBinarySearch); | ||
|
|
||
| if (jump_table == binary_search) { |
Member
There was a problem hiding this comment.
I am intrigued by this condition. I suppose this could also be written as !jump_table && !binary_search? In the case where both are true we should throw an error no?
Comment on lines
+838
to
+842
| if (jump_table) | ||
| jitc_log(Warn, "jitc_var_vcall_assemble_cuda(): both " | ||
| "JitFlag::VCallBranchJumpTable and " | ||
| "JitFlag::VCallBranchBinarySearch are enabled, " | ||
| "defaulting back to linear search!"); |
Member
There was a problem hiding this comment.
I see this now. Maybe we should throw an exception instead?
8930bc9 to
91201ef
Compare
6caa418 to
1cb66e8
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.
This PR adds different strategies to handle virtual function calls.
Currently, in order to do a virtual function call in CUDA, we use indirect function calls to call either an OptiX direct callable or a CUDA function. Given that we know exactly the set of possible targets for any virtual function call, it is not necessary to have the indirection and we can explicitly call the appropriate target function.
This PR adds a new
JitFlag, calledVCallBranchwhich will replace the indirect function call by a series of branches to call the appropriate target function. There are three different branching strategies implemented:VCallBranch.VCallBranchBinarySearchJIT flag.VCallBranchJumpTableJIT flag