[llvm-branch-commits] [llvm] [libsycl] add single_task (PR #188797)
Sergey Semenov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 27 09:40:44 PDT 2026
================
@@ -0,0 +1,135 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains helper functions used to wrap kernel arguments to
+/// typeless collection.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBSYCL___IMPL_DETAIL_ARG_WRAPPER_HPP
+#define _LIBSYCL___IMPL_DETAIL_ARG_WRAPPER_HPP
+
+#include <sycl/__impl/detail/config.hpp>
+#include <sycl/__impl/exception.hpp>
+
+#include <cassert>
+#include <memory>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+namespace detail {
+
+/// Base class is needed for unification, we pass arguments through ABI
+/// boundary.
+class ArgWrapperBase {
+public:
+ ArgWrapperBase(const ArgWrapperBase &) = delete;
+ ArgWrapperBase &operator=(const ArgWrapperBase &) = delete;
+ virtual ~ArgWrapperBase() = default;
+
+ virtual void deepCopy() = 0;
+ virtual size_t getSize() const = 0;
+ virtual const void *getPtr() const = 0;
+
+protected:
+ ArgWrapperBase() = default;
+};
+
+/// Helps to manage arguments in a typeless way.
+template <typename Type> class ArgWrapper : public ArgWrapperBase {
+public:
+ ArgWrapper(Type &Arg) { Ptr = &Arg; }
+ ArgWrapper(const ArgWrapper &) = delete;
+ ArgWrapper &operator=(const ArgWrapper &) = delete;
+
+ /// \return size of argument in bytes.
+ size_t getSize() const override { return sizeof(Type); }
+
+ /// Returns raw pointer to the corresponding argument.
----------------
sergey-semenov wrote:
```suggestion
/// Returns a raw pointer to the corresponding argument.
```
https://github.com/llvm/llvm-project/pull/188797
More information about the llvm-branch-commits
mailing list