nvk: Invalidate SKED caches at the top of command buffers
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Fri, 6 Oct 2023 23:46:07 +0000 (18:46 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sat, 7 Oct 2023 04:23:50 +0000 (04:23 +0000)
This is the cache that caches QMDs.  We need to invalidate it or else we
can end up with cache collisions and end up running the wrong shader.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25595>

src/nouveau/vulkan/nvk_cmd_dispatch.c

index 035a9c9e431973d78f8cb27b7fe43320c073de88..26cc86eb1c6aba14dfe8ffbd9f1c50d6729e9f52 100644 (file)
@@ -20,6 +20,7 @@
 #include "clc5c0.h"
 #include "nvk_cl9097.h"
 #include "nvk_cla0c0.h"
+#include "nvk_clb1c0.h"
 #include "nvk_clc3c0.h"
 #include "nvk_clc597.h"
 #include "nvk_clc6c0.h"
@@ -50,7 +51,10 @@ nvk_cmd_buffer_begin_compute(struct nvk_cmd_buffer *cmd,
                              const VkCommandBufferBeginInfo *pBeginInfo)
 {
    if (cmd->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
-      struct nv_push *p = nvk_cmd_buffer_push(cmd, 4);
+      struct nv_push *p = nvk_cmd_buffer_push(cmd, 6);
+      if (nvk_cmd_buffer_compute_cls(cmd) >= MAXWELL_COMPUTE_B) {
+         P_IMMD(p, NVB1C0, INVALIDATE_SKED_CACHES, 0);
+      }
       P_IMMD(p, NVA0C0, INVALIDATE_SAMPLER_CACHE_NO_WFI, {
          .lines = LINES_ALL,
       });