So we can remove the ignore-warning pragma again.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp | ||
---|---|---|
44–45 | This has to be done before the initialization of static CUcontext Context below? It wasn't the case before this revision? |
Simplify.
mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp | ||
---|---|---|
44–45 | Before this revision, cuInit() was called during static initialization. The current context and behavior cuCtxCreate vs cuDevicePrimaryPrimaryRetain always confuse me, so I took the safe route. It's not very well documented, but here is how it works: There is a stack of contexts, the top one is current. A context needs to be active (ref-count > 0) to be usable. cuDevicePrimaryPrimaryRetain/Release: increment/decrement primary.ref-count Before calling cuCtxGetCurrent(), we need to call cuInit() and according to the explanation above we also /can/ retain the primary context because it does not affect the stack. I've changed the code now because it's indeed simpler and easier to read. Thanks a lot for noticing/asking. |
This has to be done before the initialization of static CUcontext Context below? It wasn't the case before this revision?
(it seems like the only reason to pull the cuInit out and move it above though.