DPC++ Runtime
Runtime libraries for oneAPI DPC++
fusion_wrapper.cpp
Go to the documentation of this file.
1 //==------------ fusion_wrapper.cpp ----------------------------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
12 #include <detail/queue_impl.hpp>
13 
14 namespace sycl {
15 inline namespace _V1 {
16 namespace ext::codeplay::experimental {
17 
19  if (!Queue.ext_codeplay_supports_fusion()) {
20  throw sycl::exception(
21  sycl::errc::invalid,
22  "Cannot wrap a queue for fusion which doesn't support fusion");
23  }
24  MImpl = std::make_shared<detail::fusion_wrapper_impl>(
26 }
27 
29  return sycl::detail::createSyclObjFromImpl<sycl::queue>(MImpl->get_queue());
30 }
31 
33  return MImpl->is_in_fusion_mode();
34 }
35 
36 void fusion_wrapper::start_fusion() { MImpl->start_fusion(); }
37 
38 void fusion_wrapper::cancel_fusion() { MImpl->cancel_fusion(); }
39 
41  return MImpl->complete_fusion(PropList);
42 }
43 
44 } // namespace ext::codeplay::experimental
45 } // namespace _V1
46 } // namespace sycl
bool is_in_fusion_mode() const
Check whether the wrapped queue is in fusion mode or not.
event complete_fusion(const property_list &propList={})
Complete the fusion: JIT-compile a fused kernel from all kernels submitted to the wrapped queue since...
fusion_wrapper(queue &q)
Wrap a queue to get access to the kernel fusion API.
void start_fusion()
Set the wrapped queue into "fusion mode".
void cancel_fusion()
Cancel the fusion and submit all kernels submitted since the last start_fusion() for immediate execut...
queue get_queue() const
Access the queue wrapped by this fusion wrapper.
Objects of the property_list class are containers for the SYCL properties.
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
Definition: queue.hpp:111
bool ext_codeplay_supports_fusion() const
Returns true if the queue was created with the ext::codeplay::experimental::property::queue::enable_f...
Definition: queue.cpp:353
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: impl_utils.hpp:30
Definition: access.hpp:18