-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathtype_names.h
133 lines (117 loc) · 3.52 KB
/
type_names.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*******************************************************************************
//
// SYCL 2020 Conformance Test Suite
//
// Copyright (c) 2017-2022 Codeplay Software LTD. All Rights Reserved.
// Copyright (c) 2022 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
*******************************************************************************/
#ifndef __SYCLCTS_UTIL_TYPE_NAMES_H
#define __SYCLCTS_UTIL_TYPE_NAMES_H
#include <sycl/sycl.hpp>
#include "stl.h"
template <typename T>
std::string type_name() {
using std::string;
#define MAKENAME(X) \
{ \
if (typeid(T) == typeid(X)) return std::string(#X); \
}
#define MAKESYCLNAME(X) \
{ \
if (typeid(T) == typeid(sycl::X)) return std::string(#X); \
}
#define MAKESTDNAME(X) \
{ \
if (typeid(T) == typeid(::X)) return std::string(#X); \
}
/* float types */
MAKENAME(float);
MAKENAME(double);
#if SYCL_CTS_ENABLE_HALF_TESTS
MAKESYCLNAME(half);
#endif
/* scalar types */
MAKESTDNAME(int8_t);
MAKESTDNAME(uint8_t);
MAKESTDNAME(int16_t);
MAKESTDNAME(uint16_t);
MAKESTDNAME(int32_t);
MAKESTDNAME(uint32_t);
MAKESTDNAME(int64_t);
MAKESTDNAME(uint64_t);
/* std types */
MAKESTDNAME(size_t);
/* vector types */
MAKESYCLNAME(char2);
MAKESYCLNAME(uchar2);
MAKESYCLNAME(char3);
MAKESYCLNAME(uchar3);
MAKESYCLNAME(char4);
MAKESYCLNAME(uchar4);
MAKESYCLNAME(char8);
MAKESYCLNAME(uchar8);
MAKESYCLNAME(char16);
MAKESYCLNAME(uchar16);
MAKESYCLNAME(short2);
MAKESYCLNAME(ushort2);
MAKESYCLNAME(short3);
MAKESYCLNAME(ushort3);
MAKESYCLNAME(short4);
MAKESYCLNAME(ushort4);
MAKESYCLNAME(short8);
MAKESYCLNAME(ushort8);
MAKESYCLNAME(short16);
MAKESYCLNAME(ushort16);
MAKESYCLNAME(int2);
MAKESYCLNAME(uint2);
MAKESYCLNAME(int3);
MAKESYCLNAME(uint3);
MAKESYCLNAME(int4);
MAKESYCLNAME(uint4);
MAKESYCLNAME(int8);
MAKESYCLNAME(uint8);
MAKESYCLNAME(int16);
MAKESYCLNAME(uint16);
MAKESYCLNAME(long2);
MAKESYCLNAME(ulong2);
MAKESYCLNAME(long3);
MAKESYCLNAME(ulong3);
MAKESYCLNAME(long4);
MAKESYCLNAME(ulong4);
MAKESYCLNAME(long8);
MAKESYCLNAME(ulong8);
MAKESYCLNAME(long16);
MAKESYCLNAME(ulong16);
/* float vector types */
MAKESYCLNAME(float2);
MAKESYCLNAME(float3);
MAKESYCLNAME(float4);
MAKESYCLNAME(float8);
MAKESYCLNAME(float16);
/* double vector types */
MAKESYCLNAME(double2);
MAKESYCLNAME(double3);
MAKESYCLNAME(double4);
MAKESYCLNAME(double8);
MAKESYCLNAME(double16);
/* fall back to the implementation defined name */
const char *fallback_name = typeid(T).name();
return std::string(fallback_name);
#undef MAKENAME
#undef MAKESTDNAME
#undef MAKESYCLNAME
}
#endif // __SYCLCTS_UTIL_TYPE_NAMES_H