This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][CUDA] Use one event pool per device
ClosedPublic

Authored by jdoerfert on Feb 18 2022, 9:57 AM.

Details

Summary

An event pool, similar to the stream pool, needs to be kept per device.
For one, events are associated with cuda contexts which means we cannot
destroy the former after the latter. Also, CUDA documentation states
streams and events need to be associated with the same context, which
we did not ensure at all.

Diff Detail

Event Timeline

jdoerfert created this revision.Feb 18 2022, 9:57 AM
jdoerfert requested review of this revision.Feb 18 2022, 9:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2022, 9:57 AM
Herald added a subscriber: sstefan1. · View Herald Transcript
openmp/libomptarget/plugins/cuda/src/rtl.cpp
181–182

I don't think it's good to put CUcontext in allocator. That template is only a reference for other specialization.

jdoerfert added inline comments.Feb 18 2022, 10:10 AM
openmp/libomptarget/plugins/cuda/src/rtl.cpp
181–182

It was but it is not anymore. It is a base class now. Can you elaborate why you think it's not good to put a CUcontext in here? After all, all the associated allocators do allocate things that are bound to a/this context.

openmp/libomptarget/plugins/cuda/src/rtl.cpp
181–182

Well, it's not about correctness or necessity. It's just different styles. Like I said, it's just a reference/interface. All other allocators can implement in their own way, including some resources that don't require context. But of course you could argue we have not encountered any resource that doesn't require context. That's true and that's why I think it's just about styles. I'd like to keep things more flexible, even currently I don't see any use.
This is not a blocker. I'm fine if you think it's the good way.

Actually make this compile

This revision is now accepted and ready to land.Feb 25 2022, 7:25 AM
jdoerfert updated this revision to Diff 413246.Mar 5 2022, 1:47 PM

format + namespace

Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2022, 1:47 PM
This revision was landed with ongoing or failed builds.Mar 7 2022, 9:43 PM
This revision was automatically updated to reflect the committed changes.