21
21
#include " common.hpp"
22
22
23
23
constexpr sycl::specialization_id<int > int_id;
24
- constexpr sycl::specialization_id<double > double_id (3.14 );
24
+ constexpr sycl::specialization_id<float > float_id (3 .14f );
25
25
constexpr sycl::specialization_id<custom_type> custom_type_id;
26
26
27
27
class TestDefaultValuesKernel ;
@@ -76,7 +76,7 @@ bool test_default_values(sycl::queue q) {
76
76
}
77
77
78
78
sycl::buffer<int > int_buffer (1 );
79
- sycl::buffer<double > double_buffer (1 );
79
+ sycl::buffer<float > float_buffer (1 );
80
80
sycl::buffer<custom_type> custom_type_buffer (1 );
81
81
82
82
auto input_bundle =
@@ -86,12 +86,12 @@ bool test_default_values(sycl::queue q) {
86
86
q.submit ([&](sycl::handler &cgh) {
87
87
cgh.use_kernel_bundle (exec_bundle);
88
88
auto int_acc = int_buffer.get_access <sycl::access::mode::write>(cgh);
89
- auto double_acc = double_buffer .get_access <sycl::access::mode::write>(cgh);
89
+ auto float_acc = float_buffer .get_access <sycl::access::mode::write>(cgh);
90
90
auto custom_type_acc =
91
91
custom_type_buffer.get_access <sycl::access::mode::write>(cgh);
92
92
cgh.single_task <TestDefaultValuesKernel>([=](sycl::kernel_handler kh) {
93
93
int_acc[0 ] = kh.get_specialization_constant <int_id>();
94
- double_acc [0 ] = kh.get_specialization_constant <double_id >();
94
+ float_acc [0 ] = kh.get_specialization_constant <float_id >();
95
95
custom_type_acc[0 ] = kh.get_specialization_constant <custom_type_id>();
96
96
});
97
97
});
@@ -102,8 +102,8 @@ bool test_default_values(sycl::queue q) {
102
102
" integer specialization constant (defined without default value)" ))
103
103
return false ;
104
104
105
- auto double_acc = double_buffer .get_access <sycl::access::mode::read>();
106
- if (!check_value (3.14 , double_acc [0 ], " double specialization constant" ))
105
+ auto float_acc = float_buffer .get_access <sycl::access::mode::read>();
106
+ if (!check_value (3 .14f , float_acc [0 ], " float specialization constant" ))
107
107
return false ;
108
108
109
109
auto custom_type_acc =
@@ -145,9 +145,9 @@ bool test_set_and_get_on_host(sycl::queue q) {
145
145
" integer specializaiton constant before setting any value" ))
146
146
++errors;
147
147
148
- if (!check_value (3.14 ,
149
- input_bundle.get_specialization_constant <double_id >(),
150
- " double specializaiton constant before setting any value" ))
148
+ if (!check_value (3 .14f ,
149
+ input_bundle.get_specialization_constant <float_id >(),
150
+ " float specializaiton constant before setting any value" ))
151
151
++errors;
152
152
153
153
custom_type custom_type_ref;
@@ -159,11 +159,11 @@ bool test_set_and_get_on_host(sycl::queue q) {
159
159
160
160
// Update values
161
161
int new_int_value = 42 ;
162
- double new_double_value = 3.0 ;
163
- custom_type new_custom_type_value (' b' , 1.0 , 12 );
162
+ float new_float_value = 3 .0f ;
163
+ custom_type new_custom_type_value (' b' , 1 .0f , 12 );
164
164
165
165
input_bundle.set_specialization_constant <int_id>(new_int_value);
166
- input_bundle.set_specialization_constant <double_id>(new_double_value );
166
+ input_bundle.set_specialization_constant <float_id>(new_float_value );
167
167
input_bundle.set_specialization_constant <custom_type_id>(
168
168
new_custom_type_value);
169
169
@@ -173,9 +173,9 @@ bool test_set_and_get_on_host(sycl::queue q) {
173
173
" integer specializaiton constant after setting a new value" ))
174
174
++errors;
175
175
176
- if (!check_value (new_double_value ,
177
- input_bundle.get_specialization_constant <double_id >(),
178
- " double specializaiton constant after setting a value" ))
176
+ if (!check_value (new_float_value ,
177
+ input_bundle.get_specialization_constant <float_id >(),
178
+ " float specializaiton constant after setting a value" ))
179
179
++errors;
180
180
181
181
if (!check_value (
@@ -193,9 +193,9 @@ bool test_set_and_get_on_host(sycl::queue q) {
193
193
" integer specializaiton constant after build" ))
194
194
++errors;
195
195
196
- if (!check_value (new_double_value ,
197
- exec_bundle.get_specialization_constant <double_id >(),
198
- " double specializaiton constant after build" ))
196
+ if (!check_value (new_float_value ,
197
+ exec_bundle.get_specialization_constant <float_id >(),
198
+ " float specializaiton constant after build" ))
199
199
++errors;
200
200
201
201
if (!check_value (new_custom_type_value,
@@ -210,31 +210,31 @@ bool test_set_and_get_on_host(sycl::queue q) {
210
210
211
211
bool test_set_and_get_on_device (sycl::queue q) {
212
212
sycl::buffer<int > int_buffer (1 );
213
- sycl::buffer<double > double_buffer (1 );
213
+ sycl::buffer<float > float_buffer (1 );
214
214
sycl::buffer<custom_type> custom_type_buffer (1 );
215
215
216
216
int new_int_value = 42 ;
217
- double new_double_value = 3.0 ;
218
- custom_type new_custom_type_value (' b' , 1.0 , 12 );
217
+ float new_float_value = 3 .0f ;
218
+ custom_type new_custom_type_value (' b' , 1 .0f , 12 );
219
219
220
220
auto input_bundle =
221
221
sycl::get_kernel_bundle<sycl::bundle_state::input>(q.get_context ());
222
222
input_bundle.set_specialization_constant <int_id>(new_int_value);
223
- input_bundle.set_specialization_constant <double_id>(new_double_value );
223
+ input_bundle.set_specialization_constant <float_id>(new_float_value );
224
224
input_bundle.set_specialization_constant <custom_type_id>(
225
225
new_custom_type_value);
226
226
auto exec_bundle = sycl::build (input_bundle);
227
227
228
228
q.submit ([&](sycl::handler &cgh) {
229
229
cgh.use_kernel_bundle (exec_bundle);
230
230
auto int_acc = int_buffer.get_access <sycl::access::mode::write>(cgh);
231
- auto double_acc = double_buffer .get_access <sycl::access::mode::write>(cgh);
231
+ auto float_acc = float_buffer .get_access <sycl::access::mode::write>(cgh);
232
232
auto custom_type_acc =
233
233
custom_type_buffer.get_access <sycl::access::mode::write>(cgh);
234
234
235
235
cgh.single_task <TestSetAndGetOnDevice>([=](sycl::kernel_handler kh) {
236
236
int_acc[0 ] = kh.get_specialization_constant <int_id>();
237
- double_acc [0 ] = kh.get_specialization_constant <double_id >();
237
+ float_acc [0 ] = kh.get_specialization_constant <float_id >();
238
238
custom_type_acc[0 ] = kh.get_specialization_constant <custom_type_id>();
239
239
});
240
240
});
@@ -244,9 +244,9 @@ bool test_set_and_get_on_device(sycl::queue q) {
244
244
" integer specialization constant" ))
245
245
return false ;
246
246
247
- auto double_acc = double_buffer .get_access <sycl::access::mode::read>();
248
- if (!check_value (new_double_value, double_acc [0 ],
249
- " double specialization constant" ))
247
+ auto float_acc = float_buffer .get_access <sycl::access::mode::read>();
248
+ if (!check_value (new_float_value, float_acc [0 ],
249
+ " float specialization constant" ))
250
250
return false ;
251
251
252
252
auto custom_type_acc =
0 commit comments