On 09/08/2017 04:08 PM, Józef Kucia wrote:
On Fri, Sep 8, 2017 at 2:43 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
when an application doesn't update the contents of a descriptor
set object, it contains random values and this might end up with
GPU VM faults if a shader tries to access that descriptor.
The Vulkan spec doesn't state what a driver should do when
a descriptor is unset, but zeroing the contents seems to be
a safe solution.
FWIW, this is invalid usage. The Vulkan spec states: "Descriptors in
each bound descriptor set, specified via vkCmdBindDescriptorSets, must
be
valid if they are statically used by the currently bound VkPipeline
object, specified via
vkCmdBindPipeline".
Thanks for this, but it appears that some drivers do the same thing (or
use any other default values). I think the real question here is: does
this affect performance? If so, we should avoid it.
The application probably needs a fix too, but this has the advantage to
prevent future similar hangs.
Opinions welcome!
This fixes a GPU hang with Unity because a pixel shader tries
to access a descriptor that is unset by the application.
Though, maybe that descriptor load should have been DCE'd.
Cc: Pierre-Loup A. Griffais <pgriff...@valvesoftware.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
src/amd/vulkan/radv_descriptor_set.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/amd/vulkan/radv_descriptor_set.c
b/src/amd/vulkan/radv_descriptor_set.c
index 260bfbc12b..6271f9d06e 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -327,6 +327,12 @@ radv_descriptor_set_create(struct radv_device *device,
list_add(&set->vram_list, prev);
} else
return vk_error(VK_ERROR_OUT_OF_POOL_MEMORY_KHR);
+
+ /* Initialize the descriptor set to zero in order to avoid GPU
+ * VM faults when an application doesn't update the contents of
+ * a descriptor set object.
+ */
+ memset(set->mapped_ptr, 0, layout->size);
}
for (unsigned i = 0; i < layout->binding_count; ++i) {
--
2.14.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev