-
Notifications
You must be signed in to change notification settings - Fork 18
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
scatter_inc
with all-false literal active
mask
#113
Comments
scatter_inc
with all-false active
maskscatter_inc
with all-false literal active
mask
Scatter-inc does an optimization that collapses writes to same index, while using thread-local commination to locally establish the right indices that will be returned to the caller. You should not expect to get usable data for entries for which the mask is set to false. |
Hi @wjakob, In the documentation it is written:
Is it meant to say that for lanes where |
Right, that's a typo. It's meant to say "in the masked case" |
By the way: you can easily combine this with a gather to get the behavior your want. But of course this has a perf cost. |
Okay, that makes sense! It's just the particular case of an all-false literal
Then we run into exceptions like |
Yes, we should return an array of the correct size. |
I fixed the typo in the And opened a PR to return an array of the correct width even in the all-false literal mask case: #114 |
Calling
scatter_inc
with a literal all-False mask returns an array of size 0, which is unexpected.I would have expected
scatter_inc(..., False)
to boil down to agather
instead.We are running into this case in real code, and the zero-sized array causes a crash when used later in the code.
This was found by @faycalaa.
Likely root cause
It is most likely due to this early exit:
drjit-core/src/op.cpp
Lines 2084 to 2085 in 61570f7
I think that something like this would make more sense (untested):
Reproducer
Results in:
The text was updated successfully, but these errors were encountered: