[llvm] [libsycl] Add constructors for context (PR #214538)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 07:00:22 PDT 2026


================
@@ -6,15 +6,70 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <sycl/__impl/context.hpp>
 #include <sycl/__impl/device.hpp>
+#include <sycl/__impl/exception.hpp>
 
 #include <detail/context_impl.hpp>
 #include <detail/platform_impl.hpp>
 
+#include <algorithm>
 #include <cassert>
+#include <vector>
 
 _LIBSYCL_BEGIN_NAMESPACE_SYCL
 
+context::context(const property_list &propList) : context(device{}, propList) {}
+
+context::context(async_handler asyncHandler, const property_list &propList)
+    : context(device{}, asyncHandler, propList) {}
+
+context::context(const device &dev, const property_list &propList)
+    : context(std::vector<device>{dev}, propList) {}
+
+context::context(const device &dev, async_handler asyncHandler,
+                 const property_list &propList)
+    : context(std::vector<device>{dev}, asyncHandler, propList) {}
+
+context::context(const platform &plt, const property_list &propList)
+    : context(plt.get_devices(), propList) {}
+
+context::context(const platform &plt, async_handler asyncHandler,
+                 const property_list &propList)
+    : context(plt.get_devices(), asyncHandler, propList) {}
+
+context::context(const std::vector<device> &deviceList,
+                 const property_list &propList)
+    : context(deviceList, detail::defaultAsyncHandler, propList) {}
+
+context::context(const std::vector<device> &deviceList,
+                 async_handler asyncHandler, const property_list &propList)
+    : impl() {
----------------
KseniyaTikhomirova wrote:

what for?

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


More information about the llvm-commits mailing list