Skip to content

Commit f92ccfe

Browse files
committed
Fix compilation error with msvc
1 parent c6cf04f commit f92ccfe

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

sycl/include/CL/sycl/detail/cg_types.hpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,23 +149,39 @@ static constexpr bool check_kernel_lambda_takes_args() {
149149
return check_fn_signature<std::remove_reference_t<F>, void(Args...)>::value;
150150
}
151151

152-
// Type traits to find out if kernal lambda has kernel_handler argument
152+
// isKernelLambdaCallableWithKernelHandlerImpl checks if LambdaArgType is void
153+
// (e.g., in single_task), and based on that, calls
154+
// check_kernel_lambda_takes_args with proper set of arguments. Also this type
155+
// trait workarounds compilation error which happens only with msvc.
153156

154-
template <typename KernelType, typename LambdaArgType = void,
157+
template <typename KernelType, typename LambdaArgType,
155158
typename std::enable_if_t<std::is_same<LambdaArgType, void>::value>
156159
* = nullptr>
157-
constexpr bool isKernelLambdaCallableWithKernelHandler() {
160+
constexpr bool isKernelLambdaCallableWithKernelHandlerImpl() {
158161
return check_kernel_lambda_takes_args<KernelType, kernel_handler>();
159162
}
160163

161164
template <typename KernelType, typename LambdaArgType,
162165
typename std::enable_if_t<!std::is_same<LambdaArgType, void>::value>
163166
* = nullptr>
164-
constexpr bool isKernelLambdaCallableWithKernelHandler() {
167+
constexpr bool isKernelLambdaCallableWithKernelHandlerImpl() {
165168
return check_kernel_lambda_takes_args<KernelType, LambdaArgType,
166169
kernel_handler>();
167170
}
168171

172+
// Type traits to find out if kernal lambda has kernel_handler argument
173+
174+
template <typename KernelType>
175+
constexpr bool isKernelLambdaCallableWithKernelHandler() {
176+
return check_kernel_lambda_takes_args<KernelType, kernel_handler>();
177+
}
178+
179+
template <typename KernelType, typename LambdaArgType>
180+
constexpr bool isKernelLambdaCallableWithKernelHandler() {
181+
return isKernelLambdaCallableWithKernelHandlerImpl<KernelType,
182+
LambdaArgType>();
183+
}
184+
169185
// Helpers for running kernel lambda on the host device
170186

171187
template <typename KernelType,

0 commit comments

Comments
 (0)