@@ -52,18 +52,16 @@ int main() {
52
52
assert (data == 1 );
53
53
54
54
// OpenCL interoperability kernel invocation
55
- // TODO add set_args(cl::sycl::sampler) use case once it's supported
56
55
if (!q.is_host ()) {
57
- cl_int err;
58
- if ( 0 ) {
56
+ {
57
+ cl_int err;
59
58
cl::sycl::context ctx = q.get_context ();
60
59
cl_context clCtx = ctx.get ();
61
60
cl_command_queue clQ = q.get ();
62
61
cl_mem clBuffer =
63
62
clCreateBuffer (clCtx, CL_MEM_WRITE_ONLY, sizeof (int ), NULL , NULL );
64
63
err = clEnqueueWriteBuffer (clQ, clBuffer, CL_TRUE, 0 , sizeof (int ),
65
64
&data, 0 , NULL , NULL );
66
- // Kernel interoperability constructor
67
65
assert (err == CL_SUCCESS);
68
66
cl::sycl::program prog (ctx);
69
67
prog.build_with_source (
@@ -101,6 +99,28 @@ int main() {
101
99
assert (a == b + c);
102
100
}
103
101
}
102
+ {
103
+ cl::sycl::queue Queue;
104
+ if (!Queue.is_host ()) {
105
+ cl::sycl::sampler first (
106
+ cl::sycl::coordinate_normalization_mode::normalized,
107
+ cl::sycl::addressing_mode::clamp, cl::sycl::filtering_mode::linear);
108
+ cl::sycl::sampler second (
109
+ cl::sycl::coordinate_normalization_mode::unnormalized,
110
+ cl::sycl::addressing_mode::clamp_to_edge,
111
+ cl::sycl::filtering_mode::nearest);
112
+ cl::sycl::program prog (Queue.get_context ());
113
+ prog.build_with_source (
114
+ " kernel void sampler_args(int a, sampler_t first, "
115
+ " int b, sampler_t second, int c) {}\n " );
116
+ cl::sycl::kernel krn = prog.get_kernel (" sampler_args" );
117
+
118
+ Queue.submit ([&](cl::sycl::handler &cgh) {
119
+ cgh.set_args (0 , first, 2 , second, 3 );
120
+ cgh.single_task (krn);
121
+ });
122
+ }
123
+ }
104
124
}
105
125
// Parallel for with range
106
126
{
0 commit comments