-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Modules can't be parfor races. #5126
Conversation
…_call_vars() in the parfor pass copies such variables to later parfors if they are used there.
I've added a patch here stuartarchibald@4b73d72 that makes it so that numba/numba/npyufunc/parfor.py Lines 235 to 239 in cacb5c4
I am of the view that lowering should succeed and it's an error if it does not. In the case presented I don't know what the best thing for parfors to do is, it seems like catching a |
There is already patch for that #5114 Regarding your patch - this issue was causing |
Ah yes, thanks, forgot about that.
There's a lot of exception class rewriting and chaining going on, typically exceptions are rewritten to TypingError if they occurred during typing or LoweringError if they occurred during lowering. I think that this makes it relatively safe to say "if your code raises a LoweringError during typing, then propagate". |
In this case opposite should be also true, e.g. consume only |
As discussed out of band, I think that this can be merged once the conflicts are resolved? |
Merged via #5247 |
Resolves #5098
In #5098, there are two parfors. The first one defines some variable of type module and that variable is used by the second parfor. Since module vars can't be passed to gufuncs, ParallelAccelerator copies such module vars into parfor loop bodies as needed. However, in this case, since the variable was defined in the first parfor and to liveness analysis was escaping that parfor, it looked like a race condition variable to parfor analysis. Since we do this module var copying later in the pipeline, I just made it such that parfors don't identify module var as races. The reason this caused a problem is that if a variable is a race variable, we create an array for it so that some value can be returned but we can't create arrays of modules and pass them to a gufunc so some of the machinery in the create gufunc code generated an exception which then propagated.
@stuartarchibald Please handle defining what the behavior should be when lowering generates an exception. We probably don't want it to just stop executing if there is a fallback path that could work but we don't want it happening silently either. I'm not sure how to test this particular issue in the test suite either so I'll also leave that up to you. Commits to my PR branch are solicited.