DPC++ Runtime
Runtime libraries for oneAPI DPC++
defs.hpp
Go to the documentation of this file.
1
/***************************************************************************
2
*
3
* Copyright (C) Codeplay Software Ltd.
4
*
5
* Part of the LLVM Project, under the Apache License v2.0 with LLVM
6
* Exceptions. See https://llvm.org/LICENSE.txt for license information.
7
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*
15
* SYCLcompat
16
*
17
* defs.hpp
18
*
19
* Description:
20
* helper aliases and definitions for SYCLcompat
21
*
22
**************************************************************************/
23
24
// The original source was under the license below:
25
//==---- dpct.hpp ---------------------------------*- C++ -*----------------==//
26
//
27
// Copyright (C) Intel Corporation
28
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
29
// See https://llvm.org/LICENSE.txt for license information.
30
//
31
//===----------------------------------------------------------------------===//
32
33
#pragma once
34
35
#include <iostream>
36
37
template
<
class
... Args>
class
syclcompat_kernel_name
;
38
template
<
int
Arg>
class
syclcompat_kernel_scalar
;
39
40
#if defined(_MSC_VER)
41
#define __syclcompat_align__(n) __declspec(align(n))
42
#define __syclcompat_inline__ __forceinline
43
#define __syclcompat_noinline__ __declspec(noinline)
44
#else
45
#define __syclcompat_align__(n) __attribute__((aligned(n)))
46
#define __syclcompat_inline__ __inline__ __attribute__((always_inline))
47
#define __syclcompat_noinline__ __attribute__((noinline))
48
#endif
49
50
#define SYCLCOMPAT_COMPATIBILITY_TEMP (600)
51
52
#ifdef _WIN32
53
#define SYCLCOMPAT_EXPORT __declspec(dllexport)
54
#else
55
#define SYCLCOMPAT_EXPORT
56
#endif
57
58
namespace
syclcompat
{
59
enum
error_code
{
SUCCESS
= 0,
BACKEND_ERROR
= 1,
DEFAULT_ERROR
= 999 };
60
}
61
62
#define SYCLCOMPAT_CHECK_ERROR(expr) \
63
[&]() { \
64
try { \
65
expr; \
66
return syclcompat::error_code::SUCCESS; \
67
} catch (sycl::exception const &e) { \
68
std::cerr << e.what() << std::endl; \
69
return syclcompat::error_code::BACKEND_ERROR; \
70
} catch (std::runtime_error const &e) { \
71
std::cerr << e.what() << std::endl; \
72
return syclcompat::error_code::DEFAULT_ERROR; \
73
} \
74
}()
syclcompat_kernel_name
Definition:
defs.hpp:37
syclcompat_kernel_scalar
Definition:
defs.hpp:38
syclcompat
Definition:
atomic.hpp:43
syclcompat::error_code
error_code
Definition:
defs.hpp:59
syclcompat::DEFAULT_ERROR
@ DEFAULT_ERROR
Definition:
defs.hpp:59
syclcompat::BACKEND_ERROR
@ BACKEND_ERROR
Definition:
defs.hpp:59
syclcompat::SUCCESS
@ SUCCESS
Definition:
defs.hpp:59
include
syclcompat
defs.hpp
Generated by
1.9.1