| 
1 |  | -// RUN: %clang -std=c++11 %s -o %t1.out -lstdc++ -lOpenCL -lsycl  | 
 | 1 | +// RUN: %clangxx %s -o %t1.out -lOpenCL -lsycl  | 
2 | 2 | // RUN: env SYCL_DEVICE_TYPE=HOST %t1.out  | 
3 |  | -// RUN: %clang -std=c++11 -fsycl %s -o %t2.out -lstdc++ -lOpenCL -lsycl  | 
 | 3 | +// RUN: %clangxx -fsycl %s -o %t2.out -lOpenCL  | 
4 | 4 | // RUN: env SYCL_DEVICE_TYPE=HOST %t2.out  | 
5 | 5 | // RUN: %CPU_RUN_PLACEHOLDER %t2.out  | 
6 | 6 | // RUN: %GPU_RUN_PLACEHOLDER %t2.out  | 
@@ -54,6 +54,36 @@ void check_copy_device_to_host(cl::sycl::queue &Queue) {  | 
54 | 54 |   }  | 
55 | 55 | }  | 
56 | 56 | 
 
  | 
 | 57 | +void check_fill(cl::sycl::queue &Queue) {  | 
 | 58 | +  const int size = 6, offset = 2;  | 
 | 59 | +  cl::sycl::buffer<float, 1> buf_1(size);  | 
 | 60 | +  cl::sycl::buffer<float, 1> buf_2(size / 2);  | 
 | 61 | +  std::vector<float> expected_res_1(size);  | 
 | 62 | +  std::vector<float> expected_res_2(size / 2);  | 
 | 63 | + | 
 | 64 | +  // fill with offset  | 
 | 65 | +  {  | 
 | 66 | +    auto acc = buf_1.get_access<cl::sycl::access::mode::write>();  | 
 | 67 | +    for (int i = 0; i < size; ++i) {  | 
 | 68 | +      acc[i] = i + 1;  | 
 | 69 | +      expected_res_1[i] = offset <= i && i < size / 2 + offset ? 1337.0 : i + 1;  | 
 | 70 | +    }  | 
 | 71 | +  }  | 
 | 72 | + | 
 | 73 | +  auto e = Queue.submit([&](cl::sycl::handler &cgh) {  | 
 | 74 | +    auto a = buf_1.template get_access<cl::sycl::access::mode::write>(  | 
 | 75 | +        cgh, size / 2, offset);  | 
 | 76 | +    cgh.fill(a, (float)1337.0);  | 
 | 77 | +  });  | 
 | 78 | +  e.wait();  | 
 | 79 | + | 
 | 80 | +  {  | 
 | 81 | +    auto acc_1 = buf_1.get_access<cl::sycl::access::mode::read>();  | 
 | 82 | +    for (int i = 0; i < size; ++i)  | 
 | 83 | +      assert(expected_res_1[i] == acc_1[i]);  | 
 | 84 | +  }  | 
 | 85 | +}  | 
 | 86 | + | 
57 | 87 | void check_copy_host_to_device(cl::sycl::queue &Queue) {  | 
58 | 88 |   const int size = 6, offset = 2;  | 
59 | 89 |   cl::sycl::buffer<float, 1> buf_1(size);  | 
@@ -144,6 +174,7 @@ int main() {  | 
144 | 174 |     cl::sycl::queue Queue;  | 
145 | 175 |     check_copy_host_to_device(Queue);  | 
146 | 176 |     check_copy_device_to_host(Queue);  | 
 | 177 | +    check_fill(Queue);  | 
147 | 178 |   } catch (cl::sycl::exception &ex) {  | 
148 | 179 |     std::cerr << ex.what() << std::endl;  | 
149 | 180 |   }  | 
 | 
0 commit comments