[all-commits] [llvm/llvm-project] 7ceffa: [mlir] Convert OpTrait::FunctionLike to FunctionOp...

River Riddle via All-commits all-commits at lists.llvm.org
Tue Jan 18 21:00:03 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ceffae18c43d0752741ed9ea80d2d7ee4daa70b
      https://github.com/llvm/llvm-project/commit/7ceffae18c43d0752741ed9ea80d2d7ee4daa70b
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-01-18 (Tue, 18 Jan 2022)

  Changed paths:
    M mlir/docs/Traits.md
    M mlir/include/mlir/Dialect/GPU/GPUDialect.h
    M mlir/include/mlir/Dialect/GPU/GPUOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
    M mlir/include/mlir/Dialect/Linalg/Passes.td
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
    M mlir/include/mlir/IR/BuiltinOps.h
    M mlir/include/mlir/IR/BuiltinOps.td
    M mlir/include/mlir/IR/BuiltinTypes.td
    M mlir/include/mlir/IR/CMakeLists.txt
    M mlir/include/mlir/IR/FunctionImplementation.h
    A mlir/include/mlir/IR/FunctionInterfaces.h
    A mlir/include/mlir/IR/FunctionInterfaces.td
    R mlir/include/mlir/IR/FunctionSupport.h
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/Transforms/DialectConversion.h
    M mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
    M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
    M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
    M mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
    M mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
    M mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    M mlir/lib/Dialect/LLVMIR/IR/TypeDetail.h
    M mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
    M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
    M mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
    M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
    M mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp
    M mlir/lib/IR/BuiltinDialect.cpp
    M mlir/lib/IR/BuiltinTypes.cpp
    M mlir/lib/IR/CMakeLists.txt
    M mlir/lib/IR/FunctionImplementation.cpp
    A mlir/lib/IR/FunctionInterfaces.cpp
    R mlir/lib/IR/FunctionSupport.cpp
    M mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
    M mlir/lib/Transforms/NormalizeMemRefs.cpp
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/Dialect/LLVMIR/func.mlir
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/lib/IR/TestFunc.cpp

  Log Message:
  -----------
  [mlir] Convert OpTrait::FunctionLike to FunctionOpInterface

This commit refactors the FunctionLike trait into an interface (FunctionOpInterface).
FunctionLike as it is today is already a pseudo-interface, with many users checking the
presence of the trait and then manually into functionality implemented in the
function_like_impl namespace. By transitioning to an interface, these accesses are much
cleaner (ideally with no direct calls to the impl namespace outside of the implementation
of the derived function operations, e.g. for parsing/printing utilities).

I've tried to maintain as much compatability with the current state as possible, while
also trying to clean up as much of the cruft as possible. The general migration plan for
current users of FunctionLike is as follows:

* function_like_impl -> function_interface_impl
Realistically most user calls should remove references to functions within this namespace
outside of a vary narrow set (e.g. parsing/printing utilities). Calls to the attribute name
accessors should be migrated to the `FunctionOpInterface::` equivalent, most everything
else should be updated to be driven through an instance of the interface.

* OpTrait::FunctionLike -> FunctionOpInterface
`hasTrait` checks will need to be moved to isa, along with the other various Trait vs
Interface API differences.

* populateFunctionLikeTypeConversionPattern -> populateFunctionOpInterfaceTypeConversionPattern

Fixes #52917

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




More information about the All-commits mailing list