|
| 1 | +/******************************************************************************* |
| 2 | +* Copyright 2025 SiPearl |
| 3 | +* Copyright 2020-2021 Intel Corporation |
| 4 | +* |
| 5 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +* you may not use this file except in compliance with the License. |
| 7 | +* You may obtain a copy of the License at |
| 8 | +* |
| 9 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +* |
| 11 | +* Unless required by applicable law or agreed to in writing, |
| 12 | +* software distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +* See the License for the specific language governing permissions |
| 15 | +* and limitations under the License. |
| 16 | +* |
| 17 | +* |
| 18 | +* SPDX-License-Identifier: Apache-2.0 |
| 19 | +*******************************************************************************/ |
| 20 | + |
| 21 | +#ifndef _RNG_CPU_COMMON_HPP_ |
| 22 | +#define _RNG_CPU_COMMON_HPP_ |
| 23 | + |
| 24 | +#if __has_include(<sycl/sycl.hpp>) |
| 25 | +#include <sycl/sycl.hpp> |
| 26 | +#else |
| 27 | +#include <CL/sycl.hpp> |
| 28 | +#endif |
| 29 | + |
| 30 | +#define GET_MULTI_PTR template get_multi_ptr<sycl::access::decorated::yes>().get_raw() |
| 31 | +#define __fp16 _Float16 |
| 32 | +#define INTEGER64 1 |
| 33 | + |
| 34 | +#include "armpl.h" |
| 35 | + |
| 36 | +namespace oneapi { |
| 37 | +namespace math { |
| 38 | +namespace rng { |
| 39 | +namespace armpl { |
| 40 | + |
| 41 | +inline int check_armpl_version(armpl_int_t major_req, armpl_int_t minor_req, armpl_int_t build_req, |
| 42 | + const char* message) { |
| 43 | + armpl_int_t major, minor, build; |
| 44 | + char* tag; |
| 45 | + armplversion(&major, &minor, &build, (const char**)&tag); |
| 46 | + if (major > major_req) { |
| 47 | + return 0; |
| 48 | + } |
| 49 | + else if (major == major_req && minor > minor_req) { |
| 50 | + return 0; |
| 51 | + } |
| 52 | + else if (major == major_req && minor == minor_req && build >= build_req) { |
| 53 | + return 0; |
| 54 | + } |
| 55 | + throw oneapi::math::unimplemented("rng", "version support", message); |
| 56 | +} |
| 57 | + |
| 58 | +template <typename K, typename H, typename F> |
| 59 | +static inline auto host_task_internal(H& cgh, F f, int) -> decltype(cgh.host_task(f)) { |
| 60 | + return cgh.host_task(f); |
| 61 | +} |
| 62 | + |
| 63 | +template <typename K, typename H, typename F> |
| 64 | +static inline void host_task_internal(H& cgh, F f, long) { |
| 65 | +#ifndef __SYCL_DEVICE_ONLY__ |
| 66 | + cgh.template single_task<K>(f); |
| 67 | +#endif |
| 68 | +} |
| 69 | + |
| 70 | +template <typename K, typename H, typename F> |
| 71 | +static inline void host_task(H& cgh, F f) { |
| 72 | + (void)host_task_internal<K>(cgh, f, 0); |
| 73 | +} |
| 74 | + |
| 75 | +template <typename Engine, typename Distr> |
| 76 | +class kernel_name {}; |
| 77 | + |
| 78 | +template <typename Engine, typename Distr> |
| 79 | +class kernel_name_usm {}; |
| 80 | + |
| 81 | +} // namespace armpl |
| 82 | +} // namespace rng |
| 83 | +} // namespace math |
| 84 | +} // namespace oneapi |
| 85 | + |
| 86 | +#endif //_RNG_CPU_COMMON_HPP_ |
0 commit comments