4 #include "kompute/Core.hpp"
6 #include "kompute/operations/OpAlgoDispatch.hpp"
7 #include "kompute/operations/OpBase.hpp"
14 class Sequence :
public std::enable_shared_from_this<Sequence>
27 Sequence(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
28 std::shared_ptr<vk::Device> device,
29 std::shared_ptr<vk::Queue> computeQueue,
31 uint32_t totalTimestamps = 0);
48 std::shared_ptr<Sequence>
record(std::shared_ptr<OpBase> op);
61 template<
typename T,
typename... TArgs>
63 std::vector<std::shared_ptr<Tensor>> tensors,
66 std::shared_ptr<T> op{
new T(tensors, std::forward<TArgs>(params)...) };
81 template<
typename T,
typename... TArgs>
82 std::shared_ptr<Sequence>
record(std::shared_ptr<Algorithm> algorithm,
85 std::shared_ptr<T> op{
new T(algorithm,
86 std::forward<TArgs>(params)...) };
96 std::shared_ptr<Sequence>
eval();
105 std::shared_ptr<Sequence>
eval(std::shared_ptr<OpBase> op);
116 template<
typename T,
typename... TArgs>
117 std::shared_ptr<Sequence>
eval(std::vector<std::shared_ptr<Tensor>> tensors,
120 std::shared_ptr<T> op{
new T(tensors, std::forward<TArgs>(params)...) };
121 return this->
eval(op);
133 template<
typename T,
typename... TArgs>
134 std::shared_ptr<Sequence>
eval(std::shared_ptr<Algorithm> algorithm,
137 std::shared_ptr<T> op{
new T(algorithm,
138 std::forward<TArgs>(params)...) };
139 return this->
eval(op);
159 std::shared_ptr<Sequence>
evalAsync(std::shared_ptr<OpBase> op);
169 template<
typename T,
typename... TArgs>
171 std::vector<std::shared_ptr<Tensor>> tensors,
174 std::shared_ptr<T> op{
new T(tensors, std::forward<TArgs>(params)...) };
187 template<
typename T,
typename... TArgs>
188 std::shared_ptr<Sequence>
evalAsync(std::shared_ptr<Algorithm> algorithm,
191 std::shared_ptr<T> op{
new T(algorithm,
192 std::forward<TArgs>(params)...) };
203 std::shared_ptr<Sequence>
evalAwait(uint64_t waitFor = UINT64_MAX);
267 std::shared_ptr<vk::PhysicalDevice> mPhysicalDevice =
nullptr;
268 std::shared_ptr<vk::Device> mDevice =
nullptr;
269 std::shared_ptr<vk::Queue> mComputeQueue =
nullptr;
270 uint32_t mQueueIndex = -1;
273 std::shared_ptr<vk::CommandPool> mCommandPool =
nullptr;
274 bool mFreeCommandPool =
false;
275 std::shared_ptr<vk::CommandBuffer> mCommandBuffer =
nullptr;
276 bool mFreeCommandBuffer =
false;
280 std::vector<std::shared_ptr<OpBase>> mOperations{};
281 std::shared_ptr<vk::QueryPool> timestampQueryPool =
nullptr;
284 bool mRecording =
false;
285 bool mIsRunning =
false;
288 void createCommandPool();
289 void createCommandBuffer();
290 void createTimestampQueryPool(uint32_t totalTimestamps);
Definition: Sequence.hpp:15
std::shared_ptr< Sequence > eval(std::shared_ptr< Algorithm > algorithm, TArgs &&... params)
Definition: Sequence.hpp:134
std::shared_ptr< Sequence > record(std::shared_ptr< Algorithm > algorithm, TArgs &&... params)
Definition: Sequence.hpp:82
std::shared_ptr< Sequence > evalAwait(uint64_t waitFor=UINT64_MAX)
std::shared_ptr< Sequence > record(std::vector< std::shared_ptr< Tensor >> tensors, TArgs &&... params)
Definition: Sequence.hpp:62
std::vector< std::uint64_t > getTimestamps()
std::shared_ptr< Sequence > evalAsync(std::shared_ptr< Algorithm > algorithm, TArgs &&... params)
Definition: Sequence.hpp:188
std::shared_ptr< Sequence > eval()
std::shared_ptr< Sequence > eval(std::vector< std::shared_ptr< Tensor >> tensors, TArgs &&... params)
Definition: Sequence.hpp:117
std::shared_ptr< Sequence > eval(std::shared_ptr< OpBase > op)
std::shared_ptr< Sequence > evalAsync(std::vector< std::shared_ptr< Tensor >> tensors, TArgs &&... params)
Definition: Sequence.hpp:170
std::shared_ptr< Sequence > record(std::shared_ptr< OpBase > op)
std::shared_ptr< Sequence > evalAsync(std::shared_ptr< OpBase > op)
std::shared_ptr< Sequence > evalAsync()
Sequence(std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device, std::shared_ptr< vk::Queue > computeQueue, uint32_t queueIndex, uint32_t totalTimestamps=0)