MCPcopy Create free account
hub / github.com/KomputeProject/kompute / mapRawData

Method mapRawData

src/Tensor.cpp:146–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void
147Tensor::mapRawData()
148{
149
150 KP_LOG_DEBUG("Kompute Tensor mapping data from host buffer");
151
152 std::shared_ptr<vk::DeviceMemory> hostVisibleMemory = nullptr;
153
154 if (this->mTensorType == TensorTypes::eHost) {
155 hostVisibleMemory = this->mPrimaryMemory;
156 } else if (this->mTensorType == TensorTypes::eDevice) {
157 hostVisibleMemory = this->mStagingMemory;
158 } else {
159 KP_LOG_WARN(
160 "Kompute Tensor mapping data not supported on {} tensor", toString(this->tensorType()));
161 return;
162 }
163
164 vk::DeviceSize bufferSize = this->memorySize();
165
166 // Given we request coherent host memory we don't need to invalidate /
167 // flush
168 this->mRawData = this->mDevice->mapMemory(
169 *hostVisibleMemory, 0, bufferSize, vk::MemoryMapFlags());
170
171}
172
173void
174Tensor::unmapRawData()

Callers 1

rebuildMethod · 0.95

Calls 2

tensorTypeMethod · 0.95
memorySizeMethod · 0.95

Tested by

no test coverage detected