@@ -303,31 +303,29 @@ bool run_test(sycl::range<NDims> dims, sycl::range<NDims> local_size,
303
303
304
304
printString (" Populating staging buffer\n " );
305
305
// Populate staging memory
306
- using VecType = sycl::vec<DType, NChannels>;
307
- auto init =
308
- bindless_helpers::init_vector<DType, NChannels>(static_cast <DType>(0 ));
309
-
310
- std::vector<VecType> input_vector_0 (num_elems, init);
306
+ std::vector<DType> input_vector_0 (num_elems * NChannels,
307
+ static_cast <DType>(0 ));
311
308
std::srand (seed);
312
309
bindless_helpers::fill_rand (input_vector_0);
313
310
314
- VecType *inputStagingData = nullptr ;
311
+ DType *inputStagingData = nullptr ;
315
312
VK_CHECK_CALL (vkMapMemory (vk_device, inVkImgRes1.stagingMemory , 0 /* offset*/ ,
316
313
imageSizeBytes, 0 /* flags*/ ,
317
314
(void **)&inputStagingData));
318
- for (int i = 0 ; i < num_elems; ++i) {
315
+ for (int i = 0 ; i < ( num_elems * NChannels) ; ++i) {
319
316
inputStagingData[i] = input_vector_0[i];
320
317
}
321
318
vkUnmapMemory (vk_device, inVkImgRes1.stagingMemory );
322
319
323
- std::vector<VecType> input_vector_1 (num_elems, init);
320
+ std::vector<DType> input_vector_1 (num_elems * NChannels,
321
+ static_cast <DType>(0 ));
324
322
std::srand (seed);
325
323
bindless_helpers::fill_rand (input_vector_1);
326
324
327
325
VK_CHECK_CALL (vkMapMemory (vk_device, inVkImgRes2.stagingMemory , 0 /* offset*/ ,
328
326
imageSizeBytes, 0 /* flags*/ ,
329
327
(void **)&inputStagingData));
330
- for (int i = 0 ; i < num_elems; ++i) {
328
+ for (int i = 0 ; i < ( num_elems * NChannels) ; ++i) {
331
329
inputStagingData[i] = input_vector_1[i];
332
330
}
333
331
vkUnmapMemory (vk_device, inVkImgRes2.stagingMemory );
@@ -535,22 +533,21 @@ bool run_test(sycl::range<NDims> dims, sycl::range<NDims> local_size,
535
533
printString (" Validating\n " );
536
534
// Validate that SYCL made changes to the memory
537
535
bool validated = true ;
538
- VecType *outputStagingData = nullptr ;
536
+ DType *outputStagingData = nullptr ;
539
537
VK_CHECK_CALL (vkMapMemory (vk_device, outVkImgRes.stagingMemory , 0 /* offset*/ ,
540
538
imageSizeBytes, 0 /* flags*/ ,
541
539
(void **)&outputStagingData));
542
- for (int i = 0 ; i < num_elems; ++i) {
543
- VecType expected = input_vector_0[i] + input_vector_1[i];
544
- for (int j = 0 ; j < NChannels; ++j) {
545
- // Use helper function to determine if data is accepted
546
- // For integers, exact results are expected
547
- // For floats, accepted error variance is passed
548
- if (!util::is_equal (outputStagingData[i][j], expected[j])) {
549
- std::cerr << " Result mismatch! actual[" << i << " ][" << j
550
- << " ] == " << outputStagingData[i][j]
551
- << " : expected == " << expected[j] << " \n " ;
552
- validated = false ;
553
- }
540
+
541
+ for (int i = 0 ; i < (num_elems * NChannels); ++i) {
542
+ DType expected = input_vector_0[i] + input_vector_1[i];
543
+ // Use helper function to determine if data is accepted
544
+ // For integers, exact results are expected
545
+ // For floats, accepted error variance is passed
546
+ if (!util::is_equal (outputStagingData[i], expected)) {
547
+ std::cerr << " Result mismatch! actual[" << i
548
+ << " ] == " << outputStagingData[i]
549
+ << " : expected == " << expected << " \n " ;
550
+ validated = false ;
554
551
}
555
552
if (!validated)
556
553
break ;
0 commit comments