Skip to content

Commit 4001ec8

Browse files
authored
[SYCLomatic] Report runtime error instead of build time error for helper functions not work well in CUDA-backend #910
Signed-off-by: Hao Wang <[email protected]>
1 parent 8926314 commit 4001ec8

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

clang/runtime/dpct-rt/include/util.hpp.inc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ T select_from_sub_group(unsigned int member_mask,
420420
#if defined(__SPIR__)
421421
return __spirv_GroupNonUniformShuffle(__spv::Scope::Subgroup, x, logical_remote_id);
422422
#else
423-
#error "Masked version of select_from_sub_group only supports SPIR-V backends"
423+
throw sycl::exception(sycl::errc::runtime, "Masked version of select_from_sub_group "
424+
"only supports SPIR-V backends.");
424425
#endif // __SPIR__
425426
#else
426427
(void)g;
@@ -466,7 +467,8 @@ T shift_sub_group_left(unsigned int member_mask,
466467
}
467468
return result;
468469
#else
469-
#error "Masked version of shift_sub_group_left only supports SPIR-V backends"
470+
throw sycl::exception(sycl::errc::runtime, "Masked version of shift_sub_group_left "
471+
"only supports SPIR-V backends.");
470472
#endif // __SPIR__
471473
#else
472474
(void)g;
@@ -512,7 +514,8 @@ T shift_sub_group_right(unsigned int member_mask,
512514
}
513515
return result;
514516
#else
515-
#error "Masked version of shift_sub_group_right only supports SPIR-V backends"
517+
throw sycl::exception(sycl::errc::runtime, "Masked version of shift_sub_group_right "
518+
"only supports SPIR-V backends.");
516519
#endif // __SPIR__
517520
#else
518521
(void)g;
@@ -556,7 +559,8 @@ T permute_sub_group_by_xor(unsigned int member_mask,
556559
#if defined(__SPIR__)
557560
return __spirv_GroupNonUniformShuffle(__spv::Scope::Subgroup, x, logical_remote_id);
558561
#else
559-
#error "Masked version of permute_sub_group_by_xor only supports SPIR-V backends."
562+
throw sycl::exception(sycl::errc::runtime, "Masked version of permute_sub_group_by_xor "
563+
"only supports SPIR-V backends.");
560564
#endif // __SPIR__
561565
#else
562566
(void)g;

clang/test/dpct/helper_files_ref/include/util.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ T select_from_sub_group(unsigned int member_mask,
311311
#if defined(__SPIR__)
312312
return __spirv_GroupNonUniformShuffle(__spv::Scope::Subgroup, x, logical_remote_id);
313313
#else
314-
#error "Masked version of select_from_sub_group only supports SPIR-V backends"
314+
throw sycl::exception(sycl::errc::runtime, "Masked version of select_from_sub_group "
315+
"only supports SPIR-V backends.");
315316
#endif // __SPIR__
316317
#else
317318
(void)g;
@@ -351,7 +352,8 @@ T shift_sub_group_left(unsigned int member_mask,
351352
}
352353
return result;
353354
#else
354-
#error "Masked version of shift_sub_group_left only supports SPIR-V backends"
355+
throw sycl::exception(sycl::errc::runtime, "Masked version of shift_sub_group_left "
356+
"only supports SPIR-V backends.");
355357
#endif // __SPIR__
356358
#else
357359
(void)g;
@@ -391,7 +393,8 @@ T shift_sub_group_right(unsigned int member_mask,
391393
}
392394
return result;
393395
#else
394-
#error "Masked version of shift_sub_group_right only supports SPIR-V backends"
396+
throw sycl::exception(sycl::errc::runtime, "Masked version of shift_sub_group_right "
397+
"only supports SPIR-V backends.");
395398
#endif // __SPIR__
396399
#else
397400
(void)g;
@@ -429,7 +432,8 @@ T permute_sub_group_by_xor(unsigned int member_mask,
429432
#if defined(__SPIR__)
430433
return __spirv_GroupNonUniformShuffle(__spv::Scope::Subgroup, x, logical_remote_id);
431434
#else
432-
#error "Masked version of permute_sub_group_by_xor only supports SPIR-V backends."
435+
throw sycl::exception(sycl::errc::runtime, "Masked version of permute_sub_group_by_xor "
436+
"only supports SPIR-V backends.");
433437
#endif // __SPIR__
434438
#else
435439
(void)g;

0 commit comments

Comments
 (0)