@@ -60,7 +60,7 @@ std::string DPCTL_DeviceTypeToStr(info::device_type devTy)
60
60
/* !
61
61
* Transforms string to enum info::device_type.
62
62
*/
63
- info::device_type DPCTL_StrToDeviceType (std::string devTyStr)
63
+ info::device_type DPCTL_StrToDeviceType (const std::string & devTyStr)
64
64
{
65
65
info::device_type devTy;
66
66
if (devTyStr == " cpu" ) {
@@ -84,3 +84,79 @@ info::device_type DPCTL_StrToDeviceType(std::string devTyStr)
84
84
}
85
85
return devTy;
86
86
}
87
+
88
+ backend DPCTL_DPCTLBackendTypeToSyclBackend (DPCTLSyclBackendType BeTy)
89
+ {
90
+ switch (BeTy) {
91
+ case DPCTLSyclBackendType::DPCTL_CUDA:
92
+ return backend::cuda;
93
+ case DPCTLSyclBackendType::DPCTL_HOST:
94
+ return backend::host;
95
+ case DPCTLSyclBackendType::DPCTL_LEVEL_ZERO:
96
+ return backend::level_zero;
97
+ case DPCTLSyclBackendType::DPCTL_OPENCL:
98
+ return backend::opencl;
99
+ default :
100
+ throw runtime_error (" Unsupported backend type" , -1 );
101
+ }
102
+ }
103
+
104
+ DPCTLSyclBackendType DPCTL_SyclBackendToDPCTLBackendType (backend B)
105
+ {
106
+ switch (B) {
107
+ case backend::cuda:
108
+ return DPCTLSyclBackendType::DPCTL_CUDA;
109
+ case backend::host:
110
+ return DPCTLSyclBackendType::DPCTL_HOST;
111
+ case backend::level_zero:
112
+ return DPCTLSyclBackendType::DPCTL_LEVEL_ZERO;
113
+ case backend::opencl:
114
+ return DPCTLSyclBackendType::DPCTL_OPENCL;
115
+ default :
116
+ return DPCTLSyclBackendType::DPCTL_UNKNOWN_BACKEND;
117
+ }
118
+ }
119
+
120
+ info::device_type DPCTL_DPCTLDeviceTypeToSyclDeviceType (DPCTLSyclDeviceType DTy)
121
+ {
122
+ switch (DTy) {
123
+ case DPCTLSyclDeviceType::DPCTL_ACCELERATOR:
124
+ return info::device_type::accelerator;
125
+ case DPCTLSyclDeviceType::DPCTL_ALL:
126
+ return info::device_type::all;
127
+ case DPCTLSyclDeviceType::DPCTL_AUTOMATIC:
128
+ return info::device_type::automatic;
129
+ case DPCTLSyclDeviceType::DPCTL_CPU:
130
+ return info::device_type::cpu;
131
+ case DPCTLSyclDeviceType::DPCTL_CUSTOM:
132
+ return info::device_type::custom;
133
+ case DPCTLSyclDeviceType::DPCTL_GPU:
134
+ return info::device_type::gpu;
135
+ case DPCTLSyclDeviceType::DPCTL_HOST_DEVICE:
136
+ return info::device_type::host;
137
+ default :
138
+ throw runtime_error (" Unsupported device type" , -1 );
139
+ }
140
+ }
141
+
142
+ DPCTLSyclDeviceType DPCTL_SyclDeviceTypeToDPCTLDeviceType (info::device_type D)
143
+ {
144
+ switch (D) {
145
+ case info::device_type::accelerator:
146
+ return DPCTLSyclDeviceType::DPCTL_ACCELERATOR;
147
+ case info::device_type::all:
148
+ return DPCTLSyclDeviceType::DPCTL_ALL;
149
+ case info::device_type::automatic:
150
+ return DPCTLSyclDeviceType::DPCTL_AUTOMATIC;
151
+ case info::device_type::cpu:
152
+ return DPCTLSyclDeviceType::DPCTL_CPU;
153
+ case info::device_type::custom:
154
+ return DPCTLSyclDeviceType::DPCTL_CUSTOM;
155
+ case info::device_type::gpu:
156
+ return DPCTLSyclDeviceType::DPCTL_GPU;
157
+ case info::device_type::host:
158
+ return DPCTLSyclDeviceType::DPCTL_HOST_DEVICE;
159
+ default :
160
+ return DPCTLSyclDeviceType::DPCTL_UNKNOWN_DEVICE;
161
+ }
162
+ }
0 commit comments