-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix #31758: out of bounds write in sparse broadcast #31763
Conversation
Since it took a bit to figure out, here's Fredrik's and my understanding of what this code means to do: it's trying to get a good maximum bound for the number of remaining stored entries in the array. We're in the zero-preserving case, so anywhere that all the arguments have zeros, the function evaluation will return zero. Now computing the exact union across all the arguments is an expensive task. This (over) estimates it by simply looking at the total number of nonzeros in all arguments; that's Put that all together and you can see that the entire estimate algorithm should all go inside the same argument of that |
Given that this often over-allocates, I wonder how much more efficient (or not) a simple |
Good catch! :)
Depends on which |
I'm surprised that the inbounds annotations have a large effect since there are almost always conditionals and non |
I recall perf measurements benefitting from certain inbounds annotations, but what with the many intervening months cannot recall precisely which measurements and annotations 🤷♀️. IIRC I started without the annotations, but found that I needed at least some subset of them to close the gap between the then-new generic implementations and the preexisting specialized implementations. Best! |
No description provided.