Mesa (staging/22.0): anv: Align state pools to 2MiB on XeHP

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 21:11:14 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 94f5c307cb082fb30958e45ec994aca61d998256
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=94f5c307cb082fb30958e45ec994aca61d998256

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Tue Feb 15 10:45:37 2022 -0800

anv: Align state pools to 2MiB on XeHP

Suggested-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Fixes: c17e2216dd5 ("anv: Align buffer VMA to 2MiB for XeHP")
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15054>
(cherry picked from commit 0fffaa9fca93f6e9e8934b43d4aeb4594aea2202)

---

 .pick_status.json                |  2 +-
 src/intel/vulkan/anv_allocator.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index dfd3d1fb9b8..29b9da7b623 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -634,7 +634,7 @@
         "description": "anv: Align state pools to 2MiB on XeHP",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "c17e2216dd5f2ace77e44a8008b2b177d633b05e"
     },
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index a7060e347ce..821eadba3c9 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -374,6 +374,12 @@ anv_block_pool_init(struct anv_block_pool *pool,
 {
    VkResult result;
 
+   if (device->info.verx10 >= 125) {
+      /* Make sure VMA addresses are 2MiB aligned for the block pool */
+      assert(anv_is_aligned(start_address, 2 * 1024 * 1024));
+      assert(anv_is_aligned(initial_size, 2 * 1024 * 1024));
+   }
+
    pool->name = name;
    pool->device = device;
    pool->use_relocations = anv_use_relocations(device->physical);
@@ -838,9 +844,13 @@ anv_state_pool_init(struct anv_state_pool *pool,
    /* We don't want to ever see signed overflow */
    assert(start_offset < INT32_MAX - (int32_t)BLOCK_POOL_MEMFD_SIZE);
 
+   uint32_t initial_size = block_size * 16;
+   if (device->info.verx10 >= 125)
+      initial_size = MAX2(initial_size, 2 * 1024 * 1024);
+
    VkResult result = anv_block_pool_init(&pool->block_pool, device, name,
                                          base_address + start_offset,
-                                         block_size * 16);
+                                         initial_size);
    if (result != VK_SUCCESS)
       return result;
 



More information about the mesa-commit mailing list