[llvm] [offload][l0] Implement context groups (PR #217562)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 06:26:56 PDT 2026


Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>,
Jan =?utf-8?q?Trusiłło?= <jan.trusillo at intel.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/217562 at github.com>


================
@@ -55,37 +55,23 @@ struct OffloadTopology {
   /// \returns backend of this topology.
   ol_platform_backend_t getBackend() const { return MBackend; }
 
-  /// Returns all platforms associated with this topology.
+  /// Returns all platform context groups associated with this topology.
   ///
-  /// \returns minimal span-like view to platforms associated with this
-  /// topology.
-  range_view<const ol_platform_handle_t> getPlatforms() const;
+  /// \returns platform context groups associated with this topology.
+  const std::vector<OffloadPlatformGroup> &getPlatformGroups() const {
+    return MPlatformGroups;
+  }
 
-  /// Returns all devices associated with specific platform.
-  ///
-  /// \param PlatformId is index into MPlatforms.
-  ///
-  /// \returns minimal span-like view to devices associated with specified
-  /// platform.
-  range_view<ol_device_handle_t> getDevices(size_t PlatformId) const;
-
-  /// Register new platform and devices into this topology.
+  /// Registers platform context groups and devices into this topology.
   ///
   /// \param PlatformsAndDev collection of platforms & devices.
-  void registerNewPlatformsAndDevices(Platform2DevContainer &PlatformsAndDev);
+  void
+  registerNewPlatformsAndDevices(const Platform2DevContainer &PlatformsAndDev);
 
 private:
   ol_platform_backend_t MBackend = OL_PLATFORM_BACKEND_UNKNOWN;
 
-  // Platforms and devices belonging to this backend (flattened)
-  std::vector<ol_platform_handle_t> MPlatforms;
-
-  // Devices are sorted by platform (guarantee from liboffload)
-  std::vector<ol_device_handle_t> MDevices;
-
-  // Vector holding range of devices for each platform (index is platform index
-  // within Platforms), so MDeviceRange.size() == MPlatforms.size()
-  std::vector<range_view<ol_device_handle_t>> MDeviceRange;
+  std::vector<OffloadPlatformGroup> MPlatformGroups;
----------------
KseniyaTikhomirova wrote:

this sounds reasonable

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


More information about the llvm-commits mailing list