@@ -38,7 +38,7 @@ handler::handler(std::shared_ptr<detail::queue_impl> Queue,
38
38
: MImpl (std::make_shared<detail::handler_impl>(std::move (PrimaryQueue),
39
39
std::move (SecondaryQueue))),
40
40
MQueue (std::move (Queue)), MIsHost (IsHost) {
41
- // Create extended members and insert handler_impl
41
+ // Create extended members
42
42
auto ExtendedMembers =
43
43
std::make_shared<std::vector<detail::ExtendedMemberT>>();
44
44
MSharedPtrStorage.push_back (std::move (ExtendedMembers));
@@ -90,57 +90,53 @@ event handler::finalize() {
90
90
MIsFinalized = true ;
91
91
92
92
std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImpPtr = nullptr ;
93
- // Kernel_bundles could not be used before CGType version 1
94
- if (getCGTypeVersion (MCGType) >
95
- static_cast <unsigned int >(detail::CG::CG_VERSION::V0)) {
96
- // If there were uses of set_specialization_constant build the kernel_bundle
97
- KernelBundleImpPtr = getOrInsertHandlerKernelBundle (/* Insert=*/ false );
98
- if (KernelBundleImpPtr) {
99
- // Make sure implicit non-interop kernel bundles have the kernel
100
- if (!KernelBundleImpPtr->isInterop () &&
101
- !MImpl->isStateExplicitKernelBundle ()) {
102
- kernel_id KernelID =
103
- detail::ProgramManager::getInstance ().getSYCLKernelID (MKernelName);
104
- bool KernelInserted =
105
- KernelBundleImpPtr->add_kernel (KernelID, MQueue->get_device ());
106
- // If kernel was not inserted and the bundle is in input mode we try
107
- // building it and trying to find the kernel in executable mode
108
- if (!KernelInserted &&
109
- KernelBundleImpPtr->get_bundle_state () == bundle_state::input) {
110
- auto KernelBundle =
111
- detail::createSyclObjFromImpl<kernel_bundle<bundle_state::input>>(
112
- KernelBundleImpPtr);
113
- kernel_bundle<bundle_state::executable> ExecKernelBundle =
114
- build (KernelBundle);
115
- KernelBundleImpPtr = detail::getSyclObjImpl (ExecKernelBundle);
116
- setHandlerKernelBundle (KernelBundleImpPtr);
117
- KernelInserted =
118
- KernelBundleImpPtr->add_kernel (KernelID, MQueue->get_device ());
119
- }
120
- // If the kernel was not found in executable mode we throw an exception
121
- if (!KernelInserted)
122
- throw sycl::exception (make_error_code (errc::runtime),
123
- " Failed to add kernel to kernel bundle." );
124
- }
125
-
126
- switch (KernelBundleImpPtr->get_bundle_state ()) {
127
- case bundle_state::input: {
128
- // Underlying level expects kernel_bundle to be in executable state
129
- kernel_bundle<bundle_state::executable> ExecBundle = build (
93
+ // If there were uses of set_specialization_constant build the kernel_bundle
94
+ KernelBundleImpPtr = getOrInsertHandlerKernelBundle (/* Insert=*/ false );
95
+ if (KernelBundleImpPtr) {
96
+ // Make sure implicit non-interop kernel bundles have the kernel
97
+ if (!KernelBundleImpPtr->isInterop () &&
98
+ !MImpl->isStateExplicitKernelBundle ()) {
99
+ kernel_id KernelID =
100
+ detail::ProgramManager::getInstance ().getSYCLKernelID (MKernelName);
101
+ bool KernelInserted =
102
+ KernelBundleImpPtr->add_kernel (KernelID, MQueue->get_device ());
103
+ // If kernel was not inserted and the bundle is in input mode we try
104
+ // building it and trying to find the kernel in executable mode
105
+ if (!KernelInserted &&
106
+ KernelBundleImpPtr->get_bundle_state () == bundle_state::input) {
107
+ auto KernelBundle =
130
108
detail::createSyclObjFromImpl<kernel_bundle<bundle_state::input>>(
131
- KernelBundleImpPtr));
132
- KernelBundleImpPtr = detail::getSyclObjImpl (ExecBundle);
109
+ KernelBundleImpPtr);
110
+ kernel_bundle<bundle_state::executable> ExecKernelBundle =
111
+ build (KernelBundle);
112
+ KernelBundleImpPtr = detail::getSyclObjImpl (ExecKernelBundle);
133
113
setHandlerKernelBundle (KernelBundleImpPtr);
134
- break ;
135
- }
136
- case bundle_state::executable:
137
- // Nothing to do
138
- break ;
139
- case bundle_state::object:
140
- assert (0 && " Expected that the bundle is either in input or executable "
141
- " states." );
142
- break ;
114
+ KernelInserted =
115
+ KernelBundleImpPtr->add_kernel (KernelID, MQueue->get_device ());
143
116
}
117
+ // If the kernel was not found in executable mode we throw an exception
118
+ if (!KernelInserted)
119
+ throw sycl::exception (make_error_code (errc::runtime),
120
+ " Failed to add kernel to kernel bundle." );
121
+ }
122
+
123
+ switch (KernelBundleImpPtr->get_bundle_state ()) {
124
+ case bundle_state::input: {
125
+ // Underlying level expects kernel_bundle to be in executable state
126
+ kernel_bundle<bundle_state::executable> ExecBundle = build (
127
+ detail::createSyclObjFromImpl<kernel_bundle<bundle_state::input>>(
128
+ KernelBundleImpPtr));
129
+ KernelBundleImpPtr = detail::getSyclObjImpl (ExecBundle);
130
+ setHandlerKernelBundle (KernelBundleImpPtr);
131
+ break ;
132
+ }
133
+ case bundle_state::executable:
134
+ // Nothing to do
135
+ break ;
136
+ case bundle_state::object:
137
+ assert (0 && " Expected that the bundle is either in input or executable "
138
+ " states." );
139
+ break ;
144
140
}
145
141
}
146
142
0 commit comments