diff options
| author | Yiwei Zhang <zzyiwei@chromium.org> | 2024-08-27 11:57:11 -0700 |
|---|---|---|
| committer | Eric Engestrom <eric@engestrom.ch> | 2024-08-28 15:31:32 +0200 |
| commit | c6187962a26917569081ce1d07fc19645bb16abe (patch) | |
| tree | 3ecbaeb54d63b25a8e4fb647f7d022d5c5c0689a | |
| parent | 83e71e0ebd7f000ca84f230cfb3d8a9e8cb40197 (diff) | |
venus: workaround cacheline overflush issue on Intel JSL
We observed that Venus on ANV on JSL platform has some cacheline flush
issue. The overflush shows up as:
1. There're 2 threads venus bliting the feedback buffers suballocated
from the same backing device memory, back to back.
2. On thread A, flushing the feedback buffer for cpu read is placed
behind flushing a shader storage buffer for cpu read.
3. On thread B, flushing a different feedback buffer with the same
backing device memory (different offset bound to) can kick the
feedback buffer flush in (2) earlier than it should be flushed.
4. As a result, CPU polling thread for thread B results would see venus
feedback buffer update earlier than shader storage buffer results
being updated, breaking Venus sync primitives optimization.
During investigation, a solid workaround for JSL platform is to force
Venus to align up to 128 bytes for feedback buffer suballocation while
the default is at 64 bytes.
Cc: mesa-stable
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30879>
(cherry picked from commit 7941d705c3a346a08ca30d1eb355642f9d43bd9b)
| -rw-r--r-- | .pick_status.json | 2 | ||||
| -rw-r--r-- | src/virtio/vulkan/vn_feedback.c | 8 | ||||
| -rw-r--r-- | src/virtio/vulkan/vn_physical_device.c | 2 | ||||
| -rw-r--r-- | src/virtio/vulkan/vn_physical_device.h | 5 |
4 files changed, 13 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json index 5928475f9a7..c9268f0f825 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -224,7 +224,7 @@ "description": "venus: workaround cacheline overflush issue on Intel JSL", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/virtio/vulkan/vn_feedback.c b/src/virtio/vulkan/vn_feedback.c index 9069533c3f9..d85340455d2 100644 --- a/src/virtio/vulkan/vn_feedback.c +++ b/src/virtio/vulkan/vn_feedback.c @@ -134,10 +134,12 @@ vn_feedback_buffer_destroy(struct vn_device *dev, } static inline uint32_t -vn_get_feedback_buffer_alignment(struct vn_feedback_buffer *fb_buf) +vn_get_feedback_buffer_alignment(struct vn_device *dev, + struct vn_feedback_buffer *fb_buf) { struct vn_buffer *buf = vn_buffer_from_handle(fb_buf->buf_handle); - return buf->requirements.memory.memoryRequirements.alignment; + return align(buf->requirements.memory.memoryRequirements.alignment, + dev->physical_device->wa_min_fb_align); } static VkResult @@ -153,7 +155,7 @@ vn_feedback_pool_grow_locked(struct vn_feedback_pool *pool) return result; pool->used = 0; - pool->alignment = vn_get_feedback_buffer_alignment(fb_buf); + pool->alignment = vn_get_feedback_buffer_alignment(pool->dev, fb_buf); list_add(&fb_buf->head, &pool->fb_bufs); diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index e72663201f4..3022a79e7c0 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -417,6 +417,8 @@ vn_physical_device_sanitize_properties(struct vn_physical_device *physical_dev) if (!forward_driver_version) props->driverVersion = vk_get_driver_version(); + physical_dev->wa_min_fb_align = strstr(props->deviceName, "JSL") ? 128 : 1; + char device_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; int device_name_len = snprintf(device_name, sizeof(device_name), "Virtio-GPU Venus (%s)", props->deviceName); diff --git a/src/virtio/vulkan/vn_physical_device.h b/src/virtio/vulkan/vn_physical_device.h index cc9dbb219d3..5e12acd5c52 100644 --- a/src/virtio/vulkan/vn_physical_device.h +++ b/src/virtio/vulkan/vn_physical_device.h @@ -73,6 +73,11 @@ struct vn_physical_device { struct vk_device_extension_table renderer_extensions; uint32_t *extension_spec_versions; + /* Venus feedback encounters cacheline overflush issue on Intel JSL, and + * has to workaround by further aligning up the feedback buffer alignment. + */ + uint32_t wa_min_fb_align; + enum VkDriverId renderer_driver_id; VkQueueFamilyProperties2 *queue_family_properties; |
