[Mesa-stable] [Mesa-dev] [PATCH 8/8] radv: take accesses into account in subpass dependencies

Fredrik Höglund fredrik at kde.org
Tue Jun 26 21:56:34 UTC 2018


On Tuesday 26 June 2018, Fredrik Höglund wrote:
> Limit implicit external dependencies to accesses performed on the
> attachments in a render pass instance.

Note that I'm not sure if we are supposed to optimize implicit dependencies
in this way. I have a similar patch that takes load/store ops into account,
and that patch causes some CTS tests to fail.

> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Fredrik Höglund <fredrik at kde.org>
> ---
>  src/amd/vulkan/radv_pass.c    | 19 +++++++------------
>  src/amd/vulkan/radv_private.h |  1 +
>  2 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c
> index 5bdaa7fd554..2f783f8b3f4 100644
> --- a/src/amd/vulkan/radv_pass.c
> +++ b/src/amd/vulkan/radv_pass.c
> @@ -118,6 +118,7 @@ VkResult radv_CreateRenderPass(
>  					pass->attachments[a].view_mask |= subpass->view_mask;
>  					pass->attachments[a].first_subpass = MIN2(pass->attachments[a].first_subpass, i);
>  					pass->attachments[a].last_subpass = i;
> +					pass->attachments[a].access_mask |= VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
>  				}
>  			}
>  		}
> @@ -134,6 +135,8 @@ VkResult radv_CreateRenderPass(
>  					pass->attachments[a].view_mask |= subpass->view_mask;
>  					pass->attachments[a].first_subpass = MIN2(pass->attachments[a].first_subpass, i);
>  					pass->attachments[a].last_subpass = i;
> +					pass->attachments[a].access_mask |= VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
> +					                                    VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
>  					color_sample_count = pCreateInfo->pAttachments[a].samples;
>  				}
>  			}
> @@ -165,6 +168,8 @@ VkResult radv_CreateRenderPass(
>  				pass->attachments[a].view_mask |= subpass->view_mask;
>  				pass->attachments[a].first_subpass = MIN2(pass->attachments[a].first_subpass, i);
>  				pass->attachments[a].last_subpass = i;
> +				pass->attachments[a].access_mask |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
> +				                                    VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
>  				depth_sample_count = pCreateInfo->pAttachments[a].samples;
>  			}
>  		} else {
> @@ -256,22 +261,12 @@ VkResult radv_CreateRenderPass(
>  		/* Implicit dependency from external */
>  		if (first_subpass != UINT32_MAX && !pass->subpasses[first_subpass].explicit_dependency_from_external) {
>  			/* We always add the dependency to the first subpass to avoid repeating dependencies */
> -			pass->subpasses[0].start_barrier.dst_access_mask |=
> -				VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
> -				VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
> +			pass->subpasses[0].start_barrier.dst_access_mask |= pass->attachments[i].access_mask;
>  		}
>  
>  		/* Implicit dependency to external */
>  		if (last_subpass != UINT32_MAX && !pass->subpasses[last_subpass].explicit_dependency_to_external) {
> -			pass->end_barrier.src_access_mask |=
> -				VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
> -				VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
> -				VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
> +			pass->end_barrier.src_access_mask |= pass->attachments[i].access_mask;
>  		}
>  	}
>  
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index adf259981f1..faeb618292f 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -1727,6 +1727,7 @@ struct radv_render_pass_attachment {
>  	uint32_t                                     view_mask;
>  	uint32_t                                     first_subpass;
>  	uint32_t                                     last_subpass;
> +	VkAccessFlags                                access_mask;
>  };
>  
>  struct radv_render_pass {
> 



More information about the mesa-stable mailing list