| 97 | } |
| 98 | |
| 99 | VulkanBackend::VulkanBackend(const VulkanRuntime* runtime) : Backend(MNN_FORWARD_VULKAN) { |
| 100 | mRuntime = runtime; |
| 101 | mDirect = (mRuntime->mGpuMode & MNNGpuMode::MNN_GPU_RECORD_BATCH) == 0; |
| 102 | mUseFP16 = (mRuntime->mPrecision != BackendConfig::Precision_High && mRuntime->mDevice->getFP16Support()); |
| 103 | std::shared_ptr<BufferAllocator::Allocator> allocReal = BufferAllocator::Allocator::createRecurse(runtime->mBufferPool.get()); |
| 104 | mDynamicBufferPool.resize(2); |
| 105 | mDynamicBufferPool[0].reset(new EagerBufferAllocator(allocReal, mRuntime->mDevice->proty().limits.nonCoherentAtomSize)); |
| 106 | mCurrentDynamicBufferPool = mDynamicBufferPool[0].get(); |
| 107 | |
| 108 | auto& dev = device(); |
| 109 | mFence = std::make_shared<VulkanFence>(dev); |
| 110 | #ifdef ENABLE_VULKAN_TIME_PROFILE |
| 111 | mTimeProfiler = std::make_shared<VulkanTimeProfiler>(dev); |
| 112 | #endif |
| 113 | std::string deviceName = dev.proty().deviceName; |
| 114 | if(deviceName.find("Apple") != std::string::npos){ |
| 115 | mUseAutoTune = false; |
| 116 | } |
| 117 | mCmdBufferForCopy.reset(runtime->mCmdPool->allocBuffer()); |
| 118 | } |
| 119 | |
| 120 | VulkanBackend::~VulkanBackend() { |
| 121 | /*keep release order*/ |
nothing calls this directly
no test coverage detected