| 144 | } |
| 145 | |
| 146 | void |
| 147 | Tensor::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 | |
| 173 | void |
| 174 | Tensor::unmapRawData() |
no test coverage detected