You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Separate host instantiation from HostKernel (#18534)
The HostKernel class is currently used for two different things:
1) To extend the lifetime of the kernel function object/lambda; and
2) To force the kernel to be instantiated on the host.
Requiring a single solution to solve both problems prevents
optimization. Providing separate solutions will enable us to use the
fastest solution for each problem.
---
A few notes that might help with review:
- I would like us to eventually reach a point where we can remove the
`HostKernel` class entirely and avoid extending the lifetime of the
kernel function object. We can't do that if it's being relied upon for
debugging.
- I had to change the `runKernelWithoutArg` signature to remove SFINAE
because MSVC complained about creating a pointer to an overloaded
function. I would have expected that the compiler could figure out the
function pointer _after_ SFINAE, but it failed.
- Removing the old mechanism of instantiating on the host is an ABI
break because it removes a function from the vtable.
- With the new approach, we can avoid instantiating (and compiling!) the
kernel on the host under `NDEBUG`. I've verified that `-DNDEBUG
-fpreview-breaking-changes` removes the kernel symbols from the binary.
`-DNDEBUG` alone isn't currently sufficient, because the old
instantiation mechanism is still triggered. I wasn't sure how much of
the old implementation to leave in tact.
---------
Signed-off-by: John Pennycook <[email protected]>
0 commit comments