Kompute
OpMemoryBarrier.hpp
1 // SPDX-License-Identifier: Apache-2.0
2 #pragma once
3 
4 #include "kompute/Algorithm.hpp"
5 #include "kompute/Core.hpp"
6 #include "kompute/Tensor.hpp"
7 #include "kompute/operations/OpBase.hpp"
8 
9 namespace kp {
10 
18 class OpMemoryBarrier : public OpBase
19 {
20  public:
37  OpMemoryBarrier(const std::vector<std::shared_ptr<Tensor>>& tensors,
38  const vk::AccessFlagBits& srcAccessMask,
39  const vk::AccessFlagBits& dstAccessMask,
40  const vk::PipelineStageFlagBits& srcStageMask,
41  const vk::PipelineStageFlagBits& dstStageMask,
42  bool barrierOnPrimary = true);
43 
48  virtual ~OpMemoryBarrier() override;
49 
56  virtual void record(const vk::CommandBuffer& commandBuffer) override;
57 
63  virtual void preEval(const vk::CommandBuffer& commandBuffer) override;
64 
70  virtual void postEval(const vk::CommandBuffer& commandBuffer) override;
71 
72  private:
73  const vk::AccessFlagBits mSrcAccessMask;
74  const vk::AccessFlagBits mDstAccessMask;
75  const vk::PipelineStageFlagBits mSrcStageMask;
76  const vk::PipelineStageFlagBits mDstStageMask;
77  const bool mBarrierOnPrimary;
78  const std::vector<std::shared_ptr<Tensor>> mTensors;
79 };
80 
81 } // End namespace kp
Definition: OpBase.hpp:19
Definition: OpMemoryBarrier.hpp:19
virtual ~OpMemoryBarrier() override
OpMemoryBarrier(const std::vector< std::shared_ptr< Tensor >> &tensors, const vk::AccessFlagBits &srcAccessMask, const vk::AccessFlagBits &dstAccessMask, const vk::PipelineStageFlagBits &srcStageMask, const vk::PipelineStageFlagBits &dstStageMask, bool barrierOnPrimary=true)
virtual void record(const vk::CommandBuffer &commandBuffer) override
virtual void preEval(const vk::CommandBuffer &commandBuffer) override
virtual void postEval(const vk::CommandBuffer &commandBuffer) override