@@ -303,31 +303,29 @@ bool run_test(sycl::range<NDims> dims, sycl::range<NDims> local_size,
303303
304304 printString (" Populating staging buffer\n " );
305305 // 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 ));
311308 std::srand (seed);
312309 bindless_helpers::fill_rand (input_vector_0);
313310
314- VecType *inputStagingData = nullptr ;
311+ DType *inputStagingData = nullptr ;
315312 VK_CHECK_CALL (vkMapMemory (vk_device, inVkImgRes1.stagingMemory , 0 /* offset*/ ,
316313 imageSizeBytes, 0 /* flags*/ ,
317314 (void **)&inputStagingData));
318- for (int i = 0 ; i < num_elems; ++i) {
315+ for (int i = 0 ; i < ( num_elems * NChannels) ; ++i) {
319316 inputStagingData[i] = input_vector_0[i];
320317 }
321318 vkUnmapMemory (vk_device, inVkImgRes1.stagingMemory );
322319
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 ));
324322 std::srand (seed);
325323 bindless_helpers::fill_rand (input_vector_1);
326324
327325 VK_CHECK_CALL (vkMapMemory (vk_device, inVkImgRes2.stagingMemory , 0 /* offset*/ ,
328326 imageSizeBytes, 0 /* flags*/ ,
329327 (void **)&inputStagingData));
330- for (int i = 0 ; i < num_elems; ++i) {
328+ for (int i = 0 ; i < ( num_elems * NChannels) ; ++i) {
331329 inputStagingData[i] = input_vector_1[i];
332330 }
333331 vkUnmapMemory (vk_device, inVkImgRes2.stagingMemory );
@@ -535,22 +533,21 @@ bool run_test(sycl::range<NDims> dims, sycl::range<NDims> local_size,
535533 printString (" Validating\n " );
536534 // Validate that SYCL made changes to the memory
537535 bool validated = true ;
538- VecType *outputStagingData = nullptr ;
536+ DType *outputStagingData = nullptr ;
539537 VK_CHECK_CALL (vkMapMemory (vk_device, outVkImgRes.stagingMemory , 0 /* offset*/ ,
540538 imageSizeBytes, 0 /* flags*/ ,
541539 (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 ;
554551 }
555552 if (!validated)
556553 break ;
0 commit comments