You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was trying to understand how vulkan works from your src code.
When I looked into file: deviceArray.hpp in branch: vuh2,
auto fromHost(It1 begin, It2 end)-> void {
if(Base::isHostVisible()){
std::copy(begin, end, host_data());
Base::_dev.unmapMemory(Base::_mem);
} else { // memory is not host visible, use staging buffer
auto stage_buf = HostArray<T, AllocDevice<properties::HostCoherent>>(Base::_dev, begin, end);
copyBuf(Base::_dev, stage_buf, *this, size_bytes());
}
}
What I think is that even if isHostVisible() return true, we should check whether the memory buffer underlied includes a flag: VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, or we should call vkFlushMappedMemoryRanges and vkInvalidateMappedMemoryRanges .
Unmapping non-coherent memory does not implicitly flush the host mapped memory, and host writes that have not been flushed may not ever be visible to the device. However, implementations must ensure that writes that have not been flushed do not become visible to any other memory.
Please correct me if I am wrong, thanks anyway!
The text was updated successfully, but these errors were encountered:
jcao-ai
changed the title
Is it safe to copy from Host without vkFlushMappedMemoryRanges
Is it a bug that callingfromHost without vkFlushMappedMemoryRangesMay 30, 2020
Hi, I was trying to understand how vulkan works from your src code.
When I looked into file:
deviceArray.hpp
in branch:vuh2
,What I think is that even if
isHostVisible()
returntrue
, we should check whether the memory buffer underlied includes a flag:VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
, or we should callvkFlushMappedMemoryRanges
andvkInvalidateMappedMemoryRanges
.This is a note from here
Please correct me if I am wrong, thanks anyway!
The text was updated successfully, but these errors were encountered: