[llvm] [Offload] Implement the remaining initial Offload API (PR #122106)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 09:45:57 PST 2025


================
@@ -34,6 +34,69 @@ struct ol_platform_handle_t_ {
   std::vector<ol_device_handle_t_> Devices;
 };
 
+struct ol_queue_handle_t_ {
+  __tgt_async_info *AsyncInfo;
+  ol_device_handle_t Device;
+  std::atomic_uint32_t RefCount;
+};
+
+struct ol_event_handle_t_ {
+  void *EventInfo;
+  ol_queue_handle_t Queue;
+  ol_device_handle_t Device;
----------------
callumfare wrote:

I agree that adding a level of indirection here isn't ideal. We should aim to flatten it if possible, or at least keep things to a minimum. Ideally these would just be reference-counting wrappers over the underlying objects. It gets a little complicated if, for example, a user queries which device a queue belongs to - you want to return the `ol_device_handle_t` that they used rather than the underlying GenericDeviceTy, so it helps to keep the handles around.

In this case the `Device` was definitely not needed anyway so I've removed it.

https://github.com/llvm/llvm-project/pull/122106


More information about the llvm-commits mailing list