Skip to content

Commit

Permalink
[SYCLomatic] Add template constraints for kernel_launcher::launch fun…
Browse files Browse the repository at this point in the history
…ction (#2581)


Signed-off-by: intwanghao <[email protected]>
  • Loading branch information
intwanghao authored Dec 24, 2024
1 parent bf9df04 commit 73a93b4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions clang/runtime/dpct-rt/include/dpct/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ class kernel_launcher {
/// \param [in] que SYCL queue used to execute kernel.
/// \param [in] args Kernel arguments.
template <typename FuncT, typename... ArgsT>
static void launch(FuncT *func, dim3 group_range, dim3 local_range,
unsigned int local_mem_size, queue_ptr que,
ArgsT... args) {
static std::enable_if_t<std::is_invocable_v<FuncT *, ArgsT...>, void>
launch(FuncT *func, dim3 group_range, dim3 local_range,
unsigned int local_mem_size, queue_ptr que, ArgsT... args) {
set_execution_config(group_range, local_range, local_mem_size, que);
func(args...);
}
Expand Down Expand Up @@ -551,8 +551,9 @@ class kernel_launcher {
/// function.
/// \param [in] que SYCL queue used to execute kernel.
template <typename FuncT>
static void launch(FuncT *func, dim3 group_range, dim3 local_range,
void **args, unsigned int local_mem_size, queue_ptr que) {
static std::enable_if_t<std::is_function_v<FuncT>, void>
launch(FuncT *func, dim3 group_range, dim3 local_range, void **args,
unsigned int local_mem_size, queue_ptr que) {
constexpr size_t p_num = args_selector<0, 0, FuncT>::params_num;
set_execution_config(group_range, local_range, local_mem_size, que);
args_selector<p_num, p_num, FuncT> selector(args, nullptr);
Expand Down

0 comments on commit 73a93b4

Please sign in to comment.