<div dir="ltr">Thanks. Though this fixes the 100% repro hang, I think your first patch is still needed as well to handle getting 0xffffffff in the low 32 bits.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, 5 Dec 2018 at 10:04, Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, this is correct, indeed.<br>
<br>
The issue wasn't present because we used EOP events before removing the <br>
availability bit.<br>
<br>
Btw, just noticed that we should reset pending_reset_query directly in <br>
si_emit_cache_flush() to reduce the number of stalls. I will send a patch.<br>
<br>
Also note that fill CP DMA operations are currently always sync'ed, <br>
while CP DMA copies are not. I plan to change this at some point.<br>
<br>
Reviewed-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>><br>
<br>
On 12/5/18 10:52 AM, Alex Smith wrote:<br>
> As done for vkCmdBeginQuery() already. Prevents timestamps from being<br>
> overwritten by previous vkCmdResetQueryPool() calls if the shader path<br>
> was used to do the reset.<br>
> <br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=108925" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=108925</a><br>
> Fixes: a41e2e9cf5 ("radv: allow to use a compute shader for resetting the query pool")<br>
> Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>><br>
> ---<br>
>   src/amd/vulkan/radv_query.c | 30 +++++++++++++++++++-----------<br>
>   1 file changed, 19 insertions(+), 11 deletions(-)<br>
> <br>
> diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c<br>
> index 550abe307a..e226bcef6a 100644<br>
> --- a/src/amd/vulkan/radv_query.c<br>
> +++ b/src/amd/vulkan/radv_query.c<br>
> @@ -1436,6 +1436,22 @@ static unsigned event_type_for_stream(unsigned stream)<br>
>       }<br>
>   }<br>
>   <br>
> +static void emit_query_flush(struct radv_cmd_buffer *cmd_buffer,<br>
> +                          struct radv_query_pool *pool)<br>
> +{<br>
> +     if (cmd_buffer->pending_reset_query) {<br>
> +             if (pool->size >= RADV_BUFFER_OPS_CS_THRESHOLD) {<br>
> +                     /* Only need to flush caches if the query pool size is<br>
> +                      * large enough to be resetted using the compute shader<br>
> +                      * path. Small pools don't need any cache flushes<br>
> +                      * because we use a CP dma clear.<br>
> +                      */<br>
> +                     si_emit_cache_flush(cmd_buffer);<br>
> +                     cmd_buffer->pending_reset_query = false;<br>
> +             }<br>
> +     }<br>
> +}<br>
> +<br>
>   static void emit_begin_query(struct radv_cmd_buffer *cmd_buffer,<br>
>                            uint64_t va,<br>
>                            VkQueryType query_type,<br>
> @@ -1582,17 +1598,7 @@ void radv_CmdBeginQueryIndexedEXT(<br>
>   <br>
>       radv_cs_add_buffer(cmd_buffer->device->ws, cs, pool->bo);<br>
>   <br>
> -     if (cmd_buffer->pending_reset_query) {<br>
> -             if (pool->size >= RADV_BUFFER_OPS_CS_THRESHOLD) {<br>
> -                     /* Only need to flush caches if the query pool size is<br>
> -                      * large enough to be resetted using the compute shader<br>
> -                      * path. Small pools don't need any cache flushes<br>
> -                      * because we use a CP dma clear.<br>
> -                      */<br>
> -                     si_emit_cache_flush(cmd_buffer);<br>
> -                     cmd_buffer->pending_reset_query = false;<br>
> -             }<br>
> -     }<br>
> +     emit_query_flush(cmd_buffer, pool);<br>
>   <br>
>       va += pool->stride * query;<br>
>   <br>
> @@ -1669,6 +1675,8 @@ void radv_CmdWriteTimestamp(<br>
>   <br>
>       radv_cs_add_buffer(cmd_buffer->device->ws, cs, pool->bo);<br>
>   <br>
> +     emit_query_flush(cmd_buffer, pool);<br>
> +<br>
>       int num_queries = 1;<br>
>       if (cmd_buffer->state.subpass && cmd_buffer->state.subpass->view_mask)<br>
>               num_queries = util_bitcount(cmd_buffer->state.subpass->view_mask);<br>
> <br>
</blockquote></div>