llvm/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp

//===- SparseTensorPasses.cpp - Pass for autogen sparse tensor code -------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/Transforms/Patterns.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

namespace mlir {
#define GEN_PASS_DEF_SPARSEASSEMBLER
#define GEN_PASS_DEF_SPARSEREINTERPRETMAP
#define GEN_PASS_DEF_PRESPARSIFICATIONREWRITE
#define GEN_PASS_DEF_SPARSIFICATIONPASS
#define GEN_PASS_DEF_LOWERSPARSEITERATIONTOSCF
#define GEN_PASS_DEF_LOWERSPARSEOPSTOFOREACH
#define GEN_PASS_DEF_LOWERFOREACHTOSCF
#define GEN_PASS_DEF_SPARSETENSORCONVERSIONPASS
#define GEN_PASS_DEF_SPARSETENSORCODEGEN
#define GEN_PASS_DEF_SPARSEBUFFERREWRITE
#define GEN_PASS_DEF_SPARSEVECTORIZATION
#define GEN_PASS_DEF_SPARSEGPUCODEGEN
#define GEN_PASS_DEF_STAGESPARSEOPERATIONS
#define GEN_PASS_DEF_STORAGESPECIFIERTOLLVM
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
} // namespace mlir

usingnamespacemlir;
usingnamespacemlir::sparse_tensor;

namespace {

//===----------------------------------------------------------------------===//
// Passes implementation.
//===----------------------------------------------------------------------===//

struct SparseAssembler : public impl::SparseAssemblerBase<SparseAssembler> {};

struct SparseReinterpretMap
    : public impl::SparseReinterpretMapBase<SparseReinterpretMap> {};

struct PreSparsificationRewritePass
    : public impl::PreSparsificationRewriteBase<PreSparsificationRewritePass> {};

struct SparsificationPass
    : public impl::SparsificationPassBase<SparsificationPass> {};

struct StageSparseOperationsPass
    : public impl::StageSparseOperationsBase<StageSparseOperationsPass> {};

struct LowerSparseOpsToForeachPass
    : public impl::LowerSparseOpsToForeachBase<LowerSparseOpsToForeachPass> {};

struct LowerForeachToSCFPass
    : public impl::LowerForeachToSCFBase<LowerForeachToSCFPass> {};

struct LowerSparseIterationToSCFPass
    : public impl::LowerSparseIterationToSCFBase<
          LowerSparseIterationToSCFPass> {};

struct SparseTensorConversionPass
    : public impl::SparseTensorConversionPassBase<SparseTensorConversionPass> {};

struct SparseTensorCodegenPass
    : public impl::SparseTensorCodegenBase<SparseTensorCodegenPass> {};

struct SparseBufferRewritePass
    : public impl::SparseBufferRewriteBase<SparseBufferRewritePass> {};

struct SparseVectorizationPass
    : public impl::SparseVectorizationBase<SparseVectorizationPass> {};

struct SparseGPUCodegenPass
    : public impl::SparseGPUCodegenBase<SparseGPUCodegenPass> {};

struct StorageSpecifierToLLVMPass
    : public impl::StorageSpecifierToLLVMBase<StorageSpecifierToLLVMPass> {};

} // namespace

//===----------------------------------------------------------------------===//
// Pass creation methods.
//===----------------------------------------------------------------------===//

std::unique_ptr<Pass> mlir::createSparseAssembler() {}

std::unique_ptr<Pass> mlir::createSparseReinterpretMapPass() {}

std::unique_ptr<Pass>
mlir::createSparseReinterpretMapPass(ReinterpretMapScope scope) {}

std::unique_ptr<Pass> mlir::createPreSparsificationRewritePass() {}

std::unique_ptr<Pass> mlir::createSparsificationPass() {}

std::unique_ptr<Pass>
mlir::createSparsificationPass(const SparsificationOptions &options) {}

std::unique_ptr<Pass> mlir::createStageSparseOperationsPass() {}

std::unique_ptr<Pass> mlir::createLowerSparseOpsToForeachPass() {}

std::unique_ptr<Pass>
mlir::createLowerSparseOpsToForeachPass(bool enableRT, bool enableConvert) {}

std::unique_ptr<Pass> mlir::createLowerForeachToSCFPass() {}

std::unique_ptr<Pass> mlir::createLowerSparseIterationToSCFPass() {}

std::unique_ptr<Pass> mlir::createSparseTensorConversionPass() {}

std::unique_ptr<Pass> mlir::createSparseTensorCodegenPass() {}

std::unique_ptr<Pass>
mlir::createSparseTensorCodegenPass(bool createSparseDeallocs,
                                    bool enableBufferInitialization) {}

std::unique_ptr<Pass> mlir::createSparseBufferRewritePass() {}

std::unique_ptr<Pass>
mlir::createSparseBufferRewritePass(bool enableBufferInitialization) {}

std::unique_ptr<Pass> mlir::createSparseVectorizationPass() {}

std::unique_ptr<Pass>
mlir::createSparseVectorizationPass(unsigned vectorLength,
                                    bool enableVLAVectorization,
                                    bool enableSIMDIndex32) {}

std::unique_ptr<Pass> mlir::createSparseGPUCodegenPass() {}

std::unique_ptr<Pass> mlir::createSparseGPUCodegenPass(unsigned numThreads,
                                                       bool enableRT) {}

std::unique_ptr<Pass> mlir::createStorageSpecifierToLLVMPass() {}