
Adds the `#llvm.target<triple = $TRIPLE, chip = $CHIP, features = $FEATURES>` attribute and along with a `-llvm-target-to-data-layout` pass to derive a MLIR data layout from the LLVM data layout string (using the existing `DataLayoutImporter`). The attribute implements the relevant DLTI-interfaces, to expose the `triple`, `chip` (AKA `cpu`) and `features` on `#llvm.target` and the full `DataLayoutSpecInterface`. The pass combines the generated `#dlti.dl_spec` with an existing `dl_spec` in case one is already present, e.g. a `dl_spec` which is there to specify size of the `index` type. Adds a `TargetAttrInterface` which can be implemented by all attributes representing LLVM targets. Similar to the Draft PR https://github.com/llvm/llvm-project/pull/78073. RFC on which this PR is based: https://discourse.llvm.org/t/mandatory-data-layout-in-the-llvm-dialect/85875
102 lines
3.9 KiB
C++
102 lines
3.9 KiB
C++
//===- RegisterAllPasses.cpp - MLIR Registration ----------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines a helper to trigger the registration of all passes to the
|
|
// system.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/InitAllPasses.h"
|
|
|
|
#include "mlir/Conversion/Passes.h"
|
|
#include "mlir/Dialect/AMDGPU/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Affine/Passes.h"
|
|
#include "mlir/Dialect/Arith/Transforms/Passes.h"
|
|
#include "mlir/Dialect/ArmSME/Transforms/Passes.h"
|
|
#include "mlir/Dialect/ArmSVE/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Async/Passes.h"
|
|
#include "mlir/Dialect/Bufferization/Pipelines/Passes.h"
|
|
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
|
|
#include "mlir/Dialect/EmitC/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Func/Transforms/Passes.h"
|
|
#include "mlir/Dialect/GPU/Pipelines/Passes.h"
|
|
#include "mlir/Dialect/GPU/Transforms/Passes.h"
|
|
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Linalg/Passes.h"
|
|
#include "mlir/Dialect/MLProgram/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Math/Transforms/Passes.h"
|
|
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
|
|
#include "mlir/Dialect/NVGPU/Transforms/Passes.h"
|
|
#include "mlir/Dialect/OpenACC/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Quant/Transforms/Passes.h"
|
|
#include "mlir/Dialect/SCF/Transforms/Passes.h"
|
|
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Shape/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Shard/Transforms/Passes.h"
|
|
#include "mlir/Dialect/SparseTensor/Pipelines/Passes.h"
|
|
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Tensor/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Transform/Transforms/Passes.h"
|
|
#include "mlir/Dialect/Vector/Transforms/Passes.h"
|
|
#include "mlir/Dialect/XeGPU/Transforms/Passes.h"
|
|
#include "mlir/Target/LLVMIR/Transforms/Passes.h"
|
|
#include "mlir/Transforms/Passes.h"
|
|
|
|
// This function may be called to register the MLIR passes with the
|
|
// global registry.
|
|
// If you're building a compiler, you likely don't need this: you would build a
|
|
// pipeline programmatically without the need to register with the global
|
|
// registry, since it would already be calling the creation routine of the
|
|
// individual passes.
|
|
// The global registry is interesting to interact with the command-line tools.
|
|
void mlir::registerAllPasses() {
|
|
// General passes
|
|
registerTransformsPasses();
|
|
|
|
// Conversion passes
|
|
registerConversionPasses();
|
|
|
|
// Dialect passes
|
|
acc::registerOpenACCPasses();
|
|
affine::registerAffinePasses();
|
|
amdgpu::registerAMDGPUPasses();
|
|
registerAsyncPasses();
|
|
arith::registerArithPasses();
|
|
bufferization::registerBufferizationPasses();
|
|
func::registerFuncPasses();
|
|
registerGPUPasses();
|
|
registerLinalgPasses();
|
|
registerNVGPUPasses();
|
|
registerSparseTensorPasses();
|
|
LLVM::registerLLVMPasses();
|
|
LLVM::registerTargetLLVMIRTransformsPasses();
|
|
math::registerMathPasses();
|
|
memref::registerMemRefPasses();
|
|
shard::registerShardPasses();
|
|
ml_program::registerMLProgramPasses();
|
|
quant::registerQuantPasses();
|
|
registerSCFPasses();
|
|
registerShapePasses();
|
|
spirv::registerSPIRVPasses();
|
|
tensor::registerTensorPasses();
|
|
tosa::registerTosaOptPasses();
|
|
transform::registerTransformPasses();
|
|
vector::registerVectorPasses();
|
|
arm_sme::registerArmSMEPasses();
|
|
arm_sve::registerArmSVEPasses();
|
|
emitc::registerEmitCPasses();
|
|
xegpu::registerXeGPUPasses();
|
|
|
|
// Dialect pipelines
|
|
bufferization::registerBufferizationPipelines();
|
|
sparse_tensor::registerSparseTensorPipelines();
|
|
tosa::registerTosaToLinalgPipelines();
|
|
gpu::registerGPUToNVVMPipeline();
|
|
}
|