|
43 | 43 | #include <sycl/id.hpp> |
44 | 44 | #include <sycl/item.hpp> |
45 | 45 | #include <sycl/kernel.hpp> |
46 | | -#include <sycl/kernel_bundle.hpp> |
47 | 46 | #include <sycl/kernel_bundle_enums.hpp> |
48 | 47 | #include <sycl/kernel_handler.hpp> |
49 | 48 | #include <sycl/nd_item.hpp> |
@@ -1730,36 +1729,18 @@ class __SYCL_EXPORT handler { |
1730 | 1729 | handler &operator=(const handler &) = delete; |
1731 | 1730 | handler &operator=(handler &&) = delete; |
1732 | 1731 |
|
| 1732 | + // This is somewhat radical, but to make handler.hpp independtent from |
| 1733 | + // kernel_bundle.hpp, we define those methods within kernel_bundle.hpp |
| 1734 | + // header. Independence is needed in context of potential upcoming split of |
| 1735 | + // sycl.hpp so that users could do fine-grained include's, saving on |
| 1736 | + // compilation time by avoiding using headers for features they don't use. |
1733 | 1737 | template <auto &SpecName> |
1734 | 1738 | void set_specialization_constant( |
1735 | | - typename std::remove_reference_t<decltype(SpecName)>::value_type Value) { |
1736 | | - |
1737 | | - setStateSpecConstSet(); |
1738 | | - |
1739 | | - std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImplPtr = |
1740 | | - getOrInsertHandlerKernelBundle(/*Insert=*/true); |
1741 | | - |
1742 | | - detail::createSyclObjFromImpl<kernel_bundle<bundle_state::input>>( |
1743 | | - KernelBundleImplPtr) |
1744 | | - .set_specialization_constant<SpecName>(Value); |
1745 | | - } |
| 1739 | + typename std::remove_reference_t<decltype(SpecName)>::value_type Value); |
1746 | 1740 |
|
1747 | 1741 | template <auto &SpecName> |
1748 | 1742 | typename std::remove_reference_t<decltype(SpecName)>::value_type |
1749 | | - get_specialization_constant() const { |
1750 | | - |
1751 | | - if (isStateExplicitKernelBundle()) |
1752 | | - throw sycl::exception(make_error_code(errc::invalid), |
1753 | | - "Specialization constants cannot be read after " |
1754 | | - "explicitly setting the used kernel bundle"); |
1755 | | - |
1756 | | - std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImplPtr = |
1757 | | - getOrInsertHandlerKernelBundle(/*Insert=*/true); |
1758 | | - |
1759 | | - return detail::createSyclObjFromImpl<kernel_bundle<bundle_state::input>>( |
1760 | | - KernelBundleImplPtr) |
1761 | | - .get_specialization_constant<SpecName>(); |
1762 | | - } |
| 1743 | + get_specialization_constant() const; |
1763 | 1744 |
|
1764 | 1745 | void |
1765 | 1746 | use_kernel_bundle(const kernel_bundle<bundle_state::executable> &ExecBundle); |
|
0 commit comments