Skip to content

Commit 22802fb

Browse files
committed
Adapt test for DPC++ 2025.1
Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
1 parent 7aa02ae commit 22802fb

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

dpctl/tests/test_sycl_program.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,22 @@ def test_create_program_from_sycl_source():
330330

331331
assert type(prog.addressof_ref()) is int
332332
assert prog.has_sycl_kernel("vector_add")
333-
assert prog.has_sycl_kernel("vector_add_template<int>")
334-
335333
regularKernel = prog.get_sycl_kernel("vector_add")
336-
templateKernel = prog.get_sycl_kernel("vector_add_template<int>")
334+
335+
# DPC++ version 2025.1 supports compilation of SYCL template kernels, but
336+
# does not yet support referencing them with the unmangled name.
337+
hasTemplateName = prog.has_sycl_kernel("vector_add_template<int>")
338+
hasMangledName = prog.has_sycl_kernel(
339+
"_Z33__sycl_kernel_vector_add_templateIiEvPT_S1_S1_"
340+
)
341+
assert hasTemplateName or hasMangledName
342+
343+
if hasTemplateName:
344+
templateKernel = prog.get_sycl_kernel("vector_add_template<int>")
345+
else:
346+
templateKernel = prog.get_sycl_kernel(
347+
"_Z33__sycl_kernel_vector_add_templateIiEvPT_S1_S1_"
348+
)
337349

338350
assert "vector_add" == regularKernel.get_function_name()
339351
assert type(regularKernel.addressof_ref()) is int

libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,26 @@ TEST_P(TestSYCLKernelBundleFromSource, CheckCreateFromSYCLSource)
371371
{
372372
ASSERT_TRUE(KBRef != nullptr);
373373
ASSERT_TRUE(DPCTLKernelBundle_HasSyclKernel(KBRef, "vector_add"));
374+
// DPC++ version 2025.1 supports compilation of SYCL template kernels,
375+
// but does not yet support referencing them with the unmangled name.
374376
ASSERT_TRUE(
375-
DPCTLKernelBundle_HasSyclKernel(KBRef, "vector_add_template<int>"));
377+
DPCTLKernelBundle_HasSyclKernel(KBRef, "vector_add_template<int>") ||
378+
DPCTLKernelBundle_HasSyclKernel(
379+
KBRef, "_Z33__sycl_kernel_vector_add_templateIiEvPT_S1_S1_"));
376380
}
377381

378382
TEST_P(TestSYCLKernelBundleFromSource, CheckGetKernelSYCLSource)
379383
{
380384
auto AddKernel = DPCTLKernelBundle_GetSyclKernel(KBRef, "vector_add");
381385
auto AxpyKernel =
382386
DPCTLKernelBundle_GetSyclKernel(KBRef, "vector_add_template<int>");
387+
if (AxpyKernel == nullptr) {
388+
// DPC++ version 2025.1 supports compilation of SYCL template kernels,
389+
// but does not yet support referencing them with the unmangled name.
390+
AxpyKernel = DPCTLKernelBundle_GetSyclKernel(
391+
KBRef, "_Z33__sycl_kernel_vector_add_templateIiEvPT_S1_S1_");
392+
}
393+
383394
ASSERT_TRUE(AddKernel != nullptr);
384395
ASSERT_TRUE(AxpyKernel != nullptr);
385396
DPCTLKernel_Delete(AddKernel);

0 commit comments

Comments
 (0)