-
Notifications
You must be signed in to change notification settings - Fork 71
Device-wide chained scan with lookback #1086
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
Open
keptsecret
wants to merge
22
commits into
master
Choose a base branch
from
device_chained_scan
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
007f23e
chained scan initial commit w rough outline
keptsecret 9604ca6
implement proper read/write with separate data accessor for workgroup
keptsecret 4192826
use correct binop
keptsecret b132a2e
minor fix to creating wg accessor
keptsecret b46cad2
use a separate accessor type for reduction buf
keptsecret 59219c5
fix some compilation bugs, still not running correct
keptsecret a056aeb
fix some bugs in chained scan, still need to add lookback fallback
keptsecret 12b2d9b
lookback fallback to avoid spin
keptsecret 068776e
implement atomic min and max
keptsecret 747d35b
some bug fixes to atomic min/max
keptsecret 972a8fb
a number of bug fixes to indexing stuff
keptsecret 9085b5d
fix exclusive scan to reduction store
keptsecret 3a59e93
use a workgroup counter to determine execution order
keptsecret 25e2d01
fix for indexing in workgroup scan accessor (unsure if temp fix)
keptsecret ba9e151
fix lookback to spin a bit for some more consistency
keptsecret dd61813
can use single scratch address + fixes bug in example, memorybarrier …
keptsecret 02d6966
fixes to indexing in preload
keptsecret 833081c
Merge branch 'master' into device_chained_scan
keptsecret e5153a9
add chain scan hlsl to cmakelist
keptsecret fbf4b57
latest example
keptsecret c5b3031
concepts for accessors of device scan, removed obsolete comments
keptsecret 12a8f56
latest example
keptsecret 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
Submodule examples_tests
updated
6 files
65 changes: 65 additions & 0 deletions
65
include/nbl/builtin/hlsl/concepts/accessors/device_arithmetic.hlsl
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 |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #ifndef _NBL_BUILTIN_HLSL_CONCEPTS_ACCESSORS_DEVICE_ARITHMETIC_INCLUDED_ | ||
| #define _NBL_BUILTIN_HLSL_CONCEPTS_ACCESSORS_DEVICE_ARITHMETIC_INCLUDED_ | ||
|
|
||
| #include "nbl/builtin/hlsl/concepts/accessors/generic_shared_data.hlsl" | ||
|
|
||
| namespace nbl | ||
| { | ||
| namespace hlsl | ||
| { | ||
| namespace scan | ||
| { | ||
|
|
||
| template<typename T, typename V, typename I=uint32_t> | ||
| NBL_BOOL_CONCEPT ArithmeticSharedMemoryAccessor = concepts::accessors::GenericSharedMemoryAccessor<T,V,I>; | ||
|
|
||
| template<typename T, typename V, typename I=uint32_t> | ||
| NBL_BOOL_CONCEPT ArithmeticReadOnlyDataAccessor = concepts::accessors::GenericReadAccessor<T,V,I>; | ||
|
|
||
| template<typename T, typename V, typename I=uint32_t> | ||
| NBL_BOOL_CONCEPT ArithmeticDataAccessor = concepts::accessors::GenericDataAccessor<T,V,I>; | ||
|
|
||
| #define NBL_CONCEPT_NAME DeviceReductionsAccessor | ||
| #define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename) | ||
| #define NBL_CONCEPT_TPLT_PRM_NAMES (T)(V) | ||
| #define NBL_CONCEPT_PARAM_0 (accessor, T) | ||
| #define NBL_CONCEPT_PARAM_1 (val, V) | ||
| #define NBL_CONCEPT_PARAM_2 (index, uint64_t) | ||
| NBL_CONCEPT_BEGIN(3) | ||
| #define accessor NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0 | ||
| #define val NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1 | ||
| #define index NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2 | ||
| NBL_CONCEPT_END( | ||
| ((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(concepts::accessors::GenericDataAccessor, T, V, uint64_t)) | ||
| ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((accessor.atomicMax(index, val)), is_same_v, V)) | ||
| ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((accessor.atomicExchange(index, val)), is_same_v, V)) | ||
| ); | ||
| #undef val | ||
| #undef index | ||
| #undef accessor | ||
| #include <nbl/builtin/hlsl/concepts/__end.hlsl> | ||
|
|
||
| // TODO: as counter, maybe just increment 1 always? | ||
| #define NBL_CONCEPT_NAME WorkgroupCounterAccessor | ||
| #define NBL_CONCEPT_TPLT_PRM_KINDS (typename) | ||
| #define NBL_CONCEPT_TPLT_PRM_NAMES (T) | ||
| #define NBL_CONCEPT_PARAM_0 (accessor, T) | ||
| #define NBL_CONCEPT_PARAM_1 (val, uint32_t) | ||
| #define NBL_CONCEPT_PARAM_2 (index, uint64_t) | ||
| NBL_CONCEPT_BEGIN(3) | ||
| #define accessor NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0 | ||
| #define val NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1 | ||
| #define index NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2 | ||
| NBL_CONCEPT_END( | ||
| ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((accessor.atomicAdd(index, val)), is_same_v, uint32_t)) | ||
| ); | ||
| #undef val | ||
| #undef index | ||
| #undef accessor | ||
| #include <nbl/builtin/hlsl/concepts/__end.hlsl> | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| #endif |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to say exactly what dxc issue we're working around and be more detailed in the comments. in case they fix it and we can upgrade our code.
I think it's something to do with passing groupshared or other address qualifiers here.
I have a question though.
These don't need to be cpp compatible, it's gpu specific, why are we using NBL_REF_ARG and both REQ_TOP and REQ_BOT (hlsl enable_if and c++20 requires). I think BOT is enough?
Side note:
Just putting it out there that I don't like TOP/BOT naming 😆 I'd prefer something along the lines of:
NBL_HOST_CONCEPT+NBL_DEVICE_CONCEPTorNBL_DEVICE_SFINAE. which is more clear