Skip to content

Commit a945f31

Browse files
romanovvladvladimirlaz
authored andcommitted
[SYCL] Fix compilation of sycl application with default compiler.
This patch fixes compilation of sycl application with default compiler(without specifying -fsycl). To do this default KernelInfo implementation is added + check that skips integration header processing if specialization for KernelInfo(which is supposed to come from integraion header) is not available. Signed-off-by: Vlad Romanov <[email protected]>
1 parent f6ecdbf commit a945f31

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

sycl/include/CL/sycl/detail/kernel_desc.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ struct kernel_param_desc_t {
3636
int offset;
3737
};
3838

39-
template <class KernelNameType> struct KernelInfo;
39+
template <class KernelNameType> struct KernelInfo {
40+
static constexpr unsigned getNumParams() { return 0; }
41+
static const kernel_param_desc_t &getParamDesc(int Idx) {
42+
static kernel_param_desc_t Dummy;
43+
return Dummy;
44+
}
45+
static constexpr const char *getName() { return ""; }
46+
};
4047

4148
} // namespace detail
4249
} // namespace sycl

sycl/include/CL/sycl/handler2.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,13 @@ class handler {
513513
using KI = sycl::detail::KernelInfo<KernelName>;
514514
// Empty name indicates that the compilation happens without integration
515515
// header, so don't perform things that require it.
516-
MArgs.clear();
517-
extractArgsAndReqsFromLambda(MHostKernel->getPtr(), KI::getNumParams(),
518-
&KI::getParamDesc(0));
519-
MKernelName = KI::getName();
520-
MOSModuleHandle = csd::OSUtil::getOSModuleHandle(KI::getName());
516+
if (KI::getName() != "") {
517+
MArgs.clear();
518+
extractArgsAndReqsFromLambda(MHostKernel->getPtr(), KI::getNumParams(),
519+
&KI::getParamDesc(0));
520+
MKernelName = KI::getName();
521+
MOSModuleHandle = csd::OSUtil::getOSModuleHandle(KI::getName());
522+
}
521523
}
522524

523525
// single_task version with a kernel represented as a lambda.

0 commit comments

Comments
 (0)