-
Notifications
You must be signed in to change notification settings - Fork 68
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
Set parallel
to false
if parent_job
is not nothing
#1348
Conversation
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.
The only thing we should think about is that now Julia has thread adoption and so the number of threads may change during the execution.
So I think we have to be conservative and for the CPU always assume parallel.
@giordano How does the IPU have a way of handling updates from multiple threads to the same location? I.e. is there ever a situation where you have a parallel read? Those need to become parallel accumulate ops |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1348 +/- ##
===========================================
+ Coverage 75.19% 93.54% +18.34%
===========================================
Files 35 7 -28
Lines 10669 248 -10421
===========================================
- Hits 8023 232 -7791
+ Misses 2646 16 -2630 ☔ View full report in Codecov by Sentry. |
Tile-level multi-threading is still a to-do for me: JuliaIPU/IPUToolkit.jl#30 🥲 |
I guess I'd need to write a multi-threaded codelet in C++ and see what's the resulting LLVM IR (this is what I've been doing so far to figure out the expected IR from Julia), but %12 = atomicrmw fadd float* %"'ipg.i", float %11 monotonic, align 1, !dbg !1259 in the Enzyme derivative were causing a runtime error
I don't know if I need to do something to "activate" a multi-threaded environment on the IPU side 🤔 |
Yeah it might mean that they use custom intrinsics or that you need to link in a library |
@wsmoses all the |
@vchuravy i think this breaks cuda/amd/etc. basically because if there is a parallel read it won't get atomic added together |
This should not impact CUDA? I.e. 5 lines later we set it to true for CUDA |
Ah missed that, yeah this is fine then. Maybe later we should upgrade the interface for backends to signify if they add parallelism |
While doing some conference-driven development (🙂) I found that Enzyme was generating
atomicrmw
instructions in the LLVM IR of my gradient, but my backend doesn't support them, and so my program was crashing at runtime...but only in Pluto. @vchuravy pointed out the problem may be this setting ofparallel
, related to the fact Pluto starts by defaultjulia
with multiple threads. I worked around the problem by fixing the number of threads to 1 in my Pluto notebook, but Valentin suggested also this change as a slightly more robust fix.