DPC++ Runtime
Runtime libraries for oneAPI DPC++
jit_compiler.hpp
Go to the documentation of this file.
1 //==--- jit_compiler.hpp - SYCL runtime JIT compiler for kernel fusion -----==//
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 
9 #pragma once
10 
14 
15 #include <unordered_map>
16 
17 namespace jit_compiler {
18 enum class BinaryFormat : uint32_t;
19 class JITContext;
20 struct SYCLKernelInfo;
21 struct SYCLKernelAttribute;
22 template <typename T> class DynArray;
23 using ArgUsageMask = DynArray<uint8_t>;
24 } // namespace jit_compiler
25 
28 
29 namespace sycl {
30 inline namespace _V1 {
31 namespace detail {
32 
33 class jit_compiler {
34 
35 public:
36  std::unique_ptr<detail::CG>
37  fuseKernels(QueueImplPtr Queue, std::vector<ExecCGCommand *> &InputKernels,
38  const property_list &);
39 
41  static jit_compiler instance{};
42  return instance;
43  }
44 
45 private:
46  jit_compiler() = default;
47  ~jit_compiler() = default;
48  jit_compiler(const jit_compiler &) = delete;
49  jit_compiler(jit_compiler &&) = delete;
50  jit_compiler &operator=(const jit_compiler &) = delete;
51  jit_compiler &operator=(const jit_compiler &&) = delete;
52 
54  createPIDeviceBinary(const ::jit_compiler::SYCLKernelInfo &FusedKernelInfo,
55  ::jit_compiler::BinaryFormat Format);
56 
57  std::vector<uint8_t>
58  encodeArgUsageMask(const ::jit_compiler::ArgUsageMask &Mask) const;
59 
60  std::vector<uint8_t> encodeReqdWorkGroupSize(
61  const ::jit_compiler::SYCLKernelAttribute &Attr) const;
62 
63  // Manages the lifetime of the PI structs for device binaries.
64  std::vector<DeviceBinariesCollection> JITDeviceBinaries;
65 };
66 
67 } // namespace detail
68 } // namespace _V1
69 } // namespace sycl
std::unique_ptr< detail::CG > fuseKernels(QueueImplPtr Queue, std::vector< ExecCGCommand * > &InputKernels, const property_list &)
static jit_compiler & get_instance()
Objects of the property_list class are containers for the SYCL properties.
DynArray< uint8_t > ArgUsageMask
std::shared_ptr< sycl::detail::queue_impl > QueueImplPtr
Definition: event_impl.hpp:34
annotated_arg & operator=(annotated_arg &)=default
Definition: access.hpp:18
Definition: pi.h:898
This struct is a record of all the device code that may be offloaded.
Definition: pi.h:1122