[Mlir-commits] [mlir] ff9aab7 - [mlir][vulkan-runner] Use aligned pointer for host buffer

Lei Zhang llvmlistbot at llvm.org
Mon Aug 22 17:43:29 PDT 2022


Author: jackalcooper
Date: 2022-08-22T20:42:54-04:00
New Revision: ff9aab757203dfda9945ea4705bf633e20d380ff

URL: https://github.com/llvm/llvm-project/commit/ff9aab757203dfda9945ea4705bf633e20d380ff
DIFF: https://github.com/llvm/llvm-project/commit/ff9aab757203dfda9945ea4705bf633e20d380ff.diff

LOG: [mlir][vulkan-runner] Use aligned pointer for host buffer

Fix incorrect pointer usage in Vulkan buffer and Memref descriptor binding:
- Vulkan runtime produced incorrect result if there is alignment.
- There was illegal memory access if binding a LLVM global materialized
  from a constant op (0xdeadbeef).

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D132291

Added: 
    

Modified: 
    mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp b/mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp
index c7ee02cdc9d89..f1ed571734459 100644
--- a/mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp
+++ b/mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp
@@ -85,7 +85,7 @@ void bindMemRef(void *vkRuntimeManager, DescriptorSetIndex setIndex,
   uint32_t size = sizeof(T);
   for (unsigned i = 0; i < S; i++)
     size *= ptr->sizes[i];
-  VulkanHostMemoryBuffer memBuffer{ptr->allocated, size};
+  VulkanHostMemoryBuffer memBuffer{ptr->aligned, size};
   reinterpret_cast<VulkanRuntimeManager *>(vkRuntimeManager)
       ->setResourceData(setIndex, bindIndex, memBuffer);
 }


        


More information about the Mlir-commits mailing list