[all-commits] [llvm/llvm-project] 91be35: [mlir][GPUToVulkan] Port conversion passes and `ml...

zero9178 via All-commits all-commits at lists.llvm.org
Fri Feb 24 08:16:16 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 91be3586b52e8c5fd2891a35524068dc139a7d23
      https://github.com/llvm/llvm-project/commit/91be3586b52e8c5fd2891a35524068dc139a7d23
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-24 (Fri, 24 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
    M mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
    M mlir/test/Conversion/GPUToVulkan/invoke-vulkan.mlir
    M mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
    A mlir/test/Conversion/GPUToVulkan/typed-pointers.mlir
    M mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp

  Log Message:
  -----------
  [mlir][GPUToVulkan] Port conversion passes and `mlir-vulkan-runner` to opaque pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the new pass option 'use-opaque-pointers' to `-launch-func-to-vulkan` instructing the pass to emit LLVM opaque pointers instead of typed pointers.

Note that the pass as it was previously implemented relied on the fact LLVM pointers carried an element type. The passed used this information to deduce both the rank of a "lowered-to-llvm" MemRef as well as the element type. Since the element type when using LLVM opaque pointers is completely erased it is not possible to deduce the element type.

I therefore added a new attribute that is attached to the `vulkanLaunch` call alongside the binary blob and entry point name by the `-convert-gpu-launch-to-vulkan-launch` pass. It simply attaches a type array specifying the element types of each memref. This way the `-launch-func-to-vulkan` can simply read out the element type from the attribute.
The rank can still be deduced from the auto-generated C interface from `FinalizeMemRefToLLVM`. This is admittedly a bit fragile but I was not sure whether it was worth the effort to also add a rank array attribute.

As a last step, the use of opaque-pointers in `mlir-vulkan-runners` codegen pipeline was also enabled, since all covnersion passes used fully support it.

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


  Commit: dff04fc21c6a88a958495c02776a367829783f17
      https://github.com/llvm/llvm-project/commit/dff04fc21c6a88a958495c02776a367829783f17
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-24 (Fri, 24 Feb 2023)

  Changed paths:
    M mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp

  Log Message:
  -----------
  [mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

All passes required for lowering have already been successfully converted to allowing opaque-pointers. Switching the Spir-V runner to opaque-pointers is therefore only a matter of turning it on in these conversion passes. Regression tests also did not find any issues.

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


Compare: https://github.com/llvm/llvm-project/compare/01402831aaae...dff04fc21c6a


More information about the All-commits mailing list