[all-commits] [llvm/llvm-project] afccee: [mlir][LLVM] Don't make `LLVM_IntPtrBase` a `Build...

zero9178 via All-commits all-commits at lists.llvm.org
Tue Feb 21 11:46:57 PST 2023


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

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
    M mlir/test/Conversion/AsyncToLLVM/convert-coro-to-llvm.mlir
    M mlir/test/Dialect/LLVMIR/callgraph.mlir
    M mlir/test/Dialect/LLVMIR/invalid.mlir
    M mlir/test/Dialect/LLVMIR/nvvm.mlir
    M mlir/test/Dialect/LLVMIR/roundtrip.mlir
    M mlir/test/Target/LLVMIR/Import/intrinsic.ll
    M mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
    M mlir/test/Target/LLVMIR/llvmir.mlir
    M mlir/test/Target/LLVMIR/nvvmir.mlir
    M mlir/test/mlir-cpu-runner/x86-varargs.mlir

  Log Message:
  -----------
  [mlir][LLVM] Don't make `LLVM_IntPtrBase` a `BuildableType` to allow the use of opaque pointers

Making the constraint a buildable type makes them incompatible with opaque pointers, at least while we still support typed pointers, since Ops making use of the constraint will then automatically create a typed pointer on parse.

This patch therefore fixes that issue by removing the `BuildableType` mixin. This has a bit of a cascading effect however, as all users of the constraint now need operands of that type to be added to the assembly format, hence a lot of adjustments to the syntax of a lot of (mostly intrinsic) ops.

Few things of note: The syntax as is, is only required while we're supporting both typed and opaque pointers. Once we drop support for typed pointers, we can make it a `BuildableType` again. As a drive by I also fixed the address space not being verified in the constraint. Finally, I added some roundtripping tests, most importantly for ops with `type($specific_operand)` occurences. These are printed incorrectly with typed pointers if not wrapped within a `qualified`.

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


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

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
    M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
    M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
    M mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
    M mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
    M mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir
    M mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir
    M mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir
    A mlir/test/Conversion/GPUCommon/lower-memory-space-attrs-typed-pointers.mlir
    M mlir/test/Conversion/GPUCommon/lower-memory-space-attrs.mlir
    M mlir/test/Conversion/GPUCommon/lower-memset-to-gpu-runtime-calls.mlir
    M mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir
    M mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
    M mlir/test/Conversion/GPUCommon/transfer_write.mlir
    A mlir/test/Conversion/GPUCommon/typed-pointers.mlir
    M mlir/test/Conversion/GPUToCUDA/lower-nvvm-kernel-to-cubin.mlir
    M mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
    A mlir/test/Conversion/GPUToNVVM/typed-pointers.mlir
    M mlir/test/Conversion/GPUToNVVM/wmma-ops-to-nvvm.mlir
    M mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl-hip.mlir
    M mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl-opencl.mlir
    M mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
    M mlir/test/Conversion/GPUToROCDL/memref.mlir
    A mlir/test/Conversion/GPUToROCDL/typed-pointers.mlir
    M mlir/test/Conversion/GPUToROCm/lower-rocdl-kernel-to-hsaco.mlir

  Log Message:
  -----------
  [mlir][GPUToLLVM] Add support for emitting 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 the GPU to LLVM lowerings (including ROCD and NVVM) and adapts the code to support using opaque pointers in addition to typed pointers.
The required changes mostly boil down to avoiding `getElementType` and specifying base types in GEP and Alloca.

In the future opaque pointers will be the only supported model, hence tests have been ported to using opaque pointers by default. Additional regression tests for typed-pointers have been added to avoid breaking existing clients.

Note: This does not yet port the `GpuToVulkan` passes.

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


Compare: https://github.com/llvm/llvm-project/compare/dad3741e3bdc...0e5aeae6f582


More information about the All-commits mailing list