|
| 1 | +/* Copyright (c) 2023 Intel Corporation |
| 2 | + * |
| 3 | + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | + * |
| 5 | + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. |
| 6 | + * |
| 7 | + * Redistribution and use in source and binary forms, with or without |
| 8 | + * modification, are permitted provided that the following conditions are met: |
| 9 | + * * Redistributions of source code must retain the above copyright |
| 10 | + * notice, this list of conditions and the following disclaimer. |
| 11 | + * * Redistributions in binary form must reproduce the above copyright |
| 12 | + * notice, this list of conditions and the following disclaimer in the |
| 13 | + * documentation and/or other materials provided with the distribution. |
| 14 | + * * Neither the name of the NVIDIA CORPORATION nor the |
| 15 | + * names of its contributors may be used to endorse or promote products |
| 16 | + * derived from this software without specific prior written permission. |
| 17 | + * |
| 18 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | + * ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY |
| 22 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 27 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | + */ |
| 29 | + |
| 30 | +#ifndef _ONEDPL_SYCL_SUBMITTER_BASE_IMPL_H |
| 31 | +#define _ONEDPL_SYCL_SUBMITTER_BASE_IMPL_H |
| 32 | + |
| 33 | +#if _ONEDPL_BACKEND_SYCL |
| 34 | + |
| 35 | +#include <type_traits> // std::is_same_v, std::decay_t |
| 36 | +#include <utility> // std::forward |
| 37 | + |
| 38 | +namespace oneapi |
| 39 | +{ |
| 40 | +namespace dpl |
| 41 | +{ |
| 42 | +namespace internal |
| 43 | +{ |
| 44 | + |
| 45 | +//////////////////////////////////////////////////////////////////////////////// |
| 46 | +// struct __sycl_submitter_base - base class for all sycl submitters |
| 47 | +template <typename _ExecutionPolicy> |
| 48 | +struct __sycl_submitter_base |
| 49 | +{ |
| 50 | + protected: |
| 51 | + |
| 52 | + // We should instantiate this submitter only for cleared _ExecutionPolicy type |
| 53 | + static_assert(std::is_same_v<_ExecutionPolicy, std::decay_t<_ExecutionPolicy>>); |
| 54 | + |
| 55 | + // Execution policy for using inside submitter implementation |
| 56 | + _ExecutionPolicy __exec; |
| 57 | + |
| 58 | + template <typename _ExecutionPolicyCtor> |
| 59 | + __sycl_submitter_base(_ExecutionPolicyCtor&& __exec) |
| 60 | + : __exec(std::forward<_ExecutionPolicyCtor>(__exec)) |
| 61 | + { |
| 62 | + } |
| 63 | +}; |
| 64 | + |
| 65 | +} // namespace internal |
| 66 | +} // namespace dpl |
| 67 | +} // namespace oneapi |
| 68 | + |
| 69 | +#endif // _ONEDPL_BACKEND_SYCL |
| 70 | + |
| 71 | +#endif // _ONEDPL_SYCL_SUBMITTER_BASE_IMPL_H |
0 commit comments