@@ -17,7 +17,7 @@ static constexpr size_t NUM = 1024;
1717static constexpr size_t WGSIZE = 16 ;
1818
1919SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((syclexp::nd_range_kernel<1 >))
20- void func_without_ns (float start, float *ptr) {
20+ void func (float start, float *ptr) {
2121 size_t id = syclext::this_work_item::get_nd_item<1 >().get_global_linear_id ();
2222 ptr[id] = start + static_cast <float >(id);
2323}
@@ -28,6 +28,12 @@ void function_in_ns(float start, float *ptr) {
2828 size_t id = syclext::this_work_item::get_nd_item<1 >().get_global_linear_id ();
2929 ptr[id] = start + static_cast <float >(id + 1 );
3030}
31+
32+ SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((syclexp::nd_range_kernel<1 >))
33+ void func (float start, float *ptr) {
34+ size_t id = syclext::this_work_item::get_nd_item<1 >().get_global_linear_id ();
35+ ptr[id] = start + static_cast <float >(id + 2 );
36+ }
3137} // namespace free_functions::tests
3238
3339namespace free_functions ::tests {
@@ -59,14 +65,13 @@ static void call_kernel_code(sycl::queue &q, sycl::kernel &kernel) {
5965
6066void test_function_without_ns (sycl::queue &q, sycl::context &ctxt) {
6167 // Get a kernel bundle that contains the free function kernel
62- // "func_without_ns ".
68+ // "func ".
6369 auto exe_bndl =
64- syclexp::get_kernel_bundle<func_without_ns ,
70+ syclexp::get_kernel_bundle<func ,
6571 sycl::bundle_state::executable>(ctxt);
66- // Get a kernel object for the "func_without_ns" function from that bundle.
67- sycl::kernel k_func_without_ns =
68- exe_bndl.ext_oneapi_get_kernel <func_without_ns>();
69- call_kernel_code (q, k_func_without_ns);
72+ // Get a kernel object for the "func" function from that bundle.
73+ sycl::kernel k_func = exe_bndl.ext_oneapi_get_kernel <func>();
74+ call_kernel_code (q, k_func);
7075}
7176
7277void test_function_in_ns (sycl::queue &q, sycl::context &ctxt) {
@@ -82,6 +87,19 @@ void test_function_in_ns(sycl::queue &q, sycl::context &ctxt) {
8287 call_kernel_code (q, k_function_in_ns);
8388}
8489
90+ void test_func_in_ns_with_same_name (sycl::queue &q, sycl::context &ctxt) {
91+ // Get a kernel bundle that contains the free function kernel
92+ // "func".
93+ auto exe_bndl =
94+ syclexp::get_kernel_bundle<free_functions::tests::func,
95+ sycl::bundle_state::executable>(ctxt);
96+
97+ // Get a kernel object for the "func" function from that bundle.
98+ sycl::kernel k_func_in_ns =
99+ exe_bndl.ext_oneapi_get_kernel <free_functions::tests::func>();
100+ call_kernel_code (q, k_func_in_ns);
101+ }
102+
85103void test_function_in_inline_ns (sycl::queue &q, sycl::context &ctxt) {
86104 // Get a kernel bundle that contains the free function kernel
87105 // "function_in_inline_ns".
@@ -118,5 +136,6 @@ int main() {
118136 test_function_in_ns (q, ctxt);
119137 test_function_in_inline_ns (q, ctxt);
120138 test_function_in_anonymous_ns (q, ctxt);
139+ test_func_in_ns_with_same_name (q, ctxt);
121140 return 0 ;
122141}
0 commit comments