MCPcopy Create free account
hub / github.com/alibaba/MNN / VulkanBackend

Method VulkanBackend

source/backend/vulkan/buffer/backend/VulkanBackend.cpp:99–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99VulkanBackend::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
120VulkanBackend::~VulkanBackend() {
121 /*keep release order*/

Callers

nothing calls this directly

Calls 6

getFP16SupportMethod · 0.80
getMethod · 0.45
resizeMethod · 0.45
resetMethod · 0.45
findMethod · 0.45
allocBufferMethod · 0.45

Tested by

no test coverage detected