[llvm] [libsycl] Add liboffload context handler to default context (PR #213249)
Sergey Semenov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 05:42:59 PDT 2026
================
@@ -13,15 +13,46 @@ _LIBSYCL_BEGIN_NAMESPACE_SYCL
namespace detail {
+ContextImpl::ContextImpl(std::vector<DeviceImpl *> &&DeviceList,
+ const async_handler &AsyncHandler,
+ const property_list &PropList, Private)
+ : MAsyncHandler(AsyncHandler), MDevices(DeviceList) {
+ (void)PropList;
+
+ assert(!MDevices.empty() && "Device list must not be empty");
+ const PlatformImpl &RefPlatform = MDevices[0]->getPlatformImpl();
+
+ std::vector<ol_device_handle_t> DeviceIds;
+ DeviceIds.reserve(MDevices.size());
+ for (DeviceImpl *D : MDevices) {
+ assert(D && "Device list must not contain null entries");
+ if (D->getPlatformImpl().getOLHandleRef() != RefPlatform.getOLHandleRef())
+ throw exception(
+ make_error_code(errc::invalid),
+ "Can't add devices across platforms to a single context.");
----------------
sergey-semenov wrote:
```suggestion
"Can't add devices from multiple platforms to a single context.");
```
Nit
https://github.com/llvm/llvm-project/pull/213249
More information about the llvm-commits
mailing list