#ifdef GEN_PASS_DECL
#define GEN_PASS_DECL_LOWERFOREACHTOSCF
#define GEN_PASS_DECL_LOWERSPARSEITERATIONTOSCF
#define GEN_PASS_DECL_LOWERSPARSEOPSTOFOREACH
#define GEN_PASS_DECL_PRESPARSIFICATIONREWRITE
#define GEN_PASS_DECL_SPARSEASSEMBLER
#define GEN_PASS_DECL_SPARSEBUFFERREWRITE
#define GEN_PASS_DECL_SPARSEGPUCODEGEN
#define GEN_PASS_DECL_SPARSEREINTERPRETMAP
#define GEN_PASS_DECL_SPARSESPACECOLLAPSE
#define GEN_PASS_DECL_SPARSETENSORCODEGEN
#define GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
#define GEN_PASS_DECL_SPARSEVECTORIZATION
#define GEN_PASS_DECL_SPARSIFICATIONANDBUFFERIZATION
#define GEN_PASS_DECL_SPARSIFICATIONPASS
#define GEN_PASS_DECL_STAGESPARSEOPERATIONS
#define GEN_PASS_DECL_STORAGESPECIFIERTOLLVM
#undef GEN_PASS_DECL
#endif
#ifdef GEN_PASS_DECL_LOWERFOREACHTOSCF
#undef GEN_PASS_DECL_LOWERFOREACHTOSCF
#endif
#ifdef GEN_PASS_DEF_LOWERFOREACHTOSCF
namespace impl {
template <typename DerivedT>
class LowerForeachToSCFBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerForeachToSCFBase;
LowerForeachToSCFBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerForeachToSCFBase(const LowerForeachToSCFBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerForeachToSCFBase& operator=(const LowerForeachToSCFBase &) = delete;
LowerForeachToSCFBase(LowerForeachToSCFBase &&) = delete;
LowerForeachToSCFBase& operator=(LowerForeachToSCFBase &&) = delete;
~LowerForeachToSCFBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-foreach-to-scf");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-foreach-to-scf"; }
::llvm::StringRef getDescription() const override { return "Decompose a complex sparse operation into multiple stages"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerForeachToSCF");
}
::llvm::StringRef getName() const override { return "LowerForeachToSCF"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerForeachToSCFBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_LOWERFOREACHTOSCF
#endif
#ifdef GEN_PASS_DECL_LOWERSPARSEITERATIONTOSCF
#undef GEN_PASS_DECL_LOWERSPARSEITERATIONTOSCF
#endif
#ifdef GEN_PASS_DEF_LOWERSPARSEITERATIONTOSCF
namespace impl {
template <typename DerivedT>
class LowerSparseIterationToSCFBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerSparseIterationToSCFBase;
LowerSparseIterationToSCFBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerSparseIterationToSCFBase(const LowerSparseIterationToSCFBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerSparseIterationToSCFBase& operator=(const LowerSparseIterationToSCFBase &) = delete;
LowerSparseIterationToSCFBase(LowerSparseIterationToSCFBase &&) = delete;
LowerSparseIterationToSCFBase& operator=(LowerSparseIterationToSCFBase &&) = delete;
~LowerSparseIterationToSCFBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-iteration-to-scf");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-iteration-to-scf"; }
::llvm::StringRef getDescription() const override { return "lower sparse_tensor.iterate/coiterate into scf loops"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerSparseIterationToSCF");
}
::llvm::StringRef getName() const override { return "LowerSparseIterationToSCF"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerSparseIterationToSCFBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_LOWERSPARSEITERATIONTOSCF
#endif
#ifdef GEN_PASS_DECL_LOWERSPARSEOPSTOFOREACH
struct LowerSparseOpsToForeachOptions { … };
#undef GEN_PASS_DECL_LOWERSPARSEOPSTOFOREACH
#endif
#ifdef GEN_PASS_DEF_LOWERSPARSEOPSTOFOREACH
namespace impl {
template <typename DerivedT>
class LowerSparseOpsToForeachBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = LowerSparseOpsToForeachBase;
LowerSparseOpsToForeachBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerSparseOpsToForeachBase(const LowerSparseOpsToForeachBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
LowerSparseOpsToForeachBase& operator=(const LowerSparseOpsToForeachBase &) = delete;
LowerSparseOpsToForeachBase(LowerSparseOpsToForeachBase &&) = delete;
LowerSparseOpsToForeachBase& operator=(LowerSparseOpsToForeachBase &&) = delete;
~LowerSparseOpsToForeachBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-ops-to-foreach");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-ops-to-foreach"; }
::llvm::StringRef getDescription() const override { return "Applies sparse tensor rewriting rules after sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerSparseOpsToForeach");
}
::llvm::StringRef getName() const override { return "LowerSparseOpsToForeach"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerSparseOpsToForeachBase<DerivedT>)
LowerSparseOpsToForeachBase(LowerSparseOpsToForeachOptions options) : LowerSparseOpsToForeachBase() {
enableRuntimeLibrary = std::move(options.enableRuntimeLibrary);
enableConvert = std::move(options.enableConvert);
}
protected:
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
::mlir::Pass::Option<bool> enableConvert{*this, "enable-convert", ::llvm::cl::desc("Enable rewriting rules for the convert operator"), ::llvm::cl::init(true)};
private:
};
}
#undef GEN_PASS_DEF_LOWERSPARSEOPSTOFOREACH
#endif
#ifdef GEN_PASS_DECL_PRESPARSIFICATIONREWRITE
#undef GEN_PASS_DECL_PRESPARSIFICATIONREWRITE
#endif
#ifdef GEN_PASS_DEF_PRESPARSIFICATIONREWRITE
namespace impl {
template <typename DerivedT>
class PreSparsificationRewriteBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = PreSparsificationRewriteBase;
PreSparsificationRewriteBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
PreSparsificationRewriteBase(const PreSparsificationRewriteBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
PreSparsificationRewriteBase& operator=(const PreSparsificationRewriteBase &) = delete;
PreSparsificationRewriteBase(PreSparsificationRewriteBase &&) = delete;
PreSparsificationRewriteBase& operator=(PreSparsificationRewriteBase &&) = delete;
~PreSparsificationRewriteBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("pre-sparsification-rewrite");
}
::llvm::StringRef getArgument() const override { return "pre-sparsification-rewrite"; }
::llvm::StringRef getDescription() const override { return "Applies sparse tensor rewriting rules prior to sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("PreSparsificationRewrite");
}
::llvm::StringRef getName() const override { return "PreSparsificationRewrite"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PreSparsificationRewriteBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_PRESPARSIFICATIONREWRITE
#endif
#ifdef GEN_PASS_DECL_SPARSEASSEMBLER
struct SparseAssemblerOptions { … };
#undef GEN_PASS_DECL_SPARSEASSEMBLER
#endif
#ifdef GEN_PASS_DEF_SPARSEASSEMBLER
namespace impl {
template <typename DerivedT>
class SparseAssemblerBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseAssemblerBase;
SparseAssemblerBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseAssemblerBase(const SparseAssemblerBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseAssemblerBase& operator=(const SparseAssemblerBase &) = delete;
SparseAssemblerBase(SparseAssemblerBase &&) = delete;
SparseAssemblerBase& operator=(SparseAssemblerBase &&) = delete;
~SparseAssemblerBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-assembler");
}
::llvm::StringRef getArgument() const override { return "sparse-assembler"; }
::llvm::StringRef getDescription() const override { return "Add [dis]assemble operations on external sparse tensors"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseAssembler");
}
::llvm::StringRef getName() const override { return "SparseAssembler"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<bufferization::BufferizationDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<tensor::TensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseAssemblerBase<DerivedT>)
SparseAssemblerBase(SparseAssemblerOptions options) : SparseAssemblerBase() {
directOut = std::move(options.directOut);
}
protected:
::mlir::Pass::Option<bool> directOut{*this, "direct-out", ::llvm::cl::desc("Directly returns buffers externally"), ::llvm::cl::init(false)};
private:
};
}
#undef GEN_PASS_DEF_SPARSEASSEMBLER
#endif
#ifdef GEN_PASS_DECL_SPARSEBUFFERREWRITE
struct SparseBufferRewriteOptions { … };
#undef GEN_PASS_DECL_SPARSEBUFFERREWRITE
#endif
#ifdef GEN_PASS_DEF_SPARSEBUFFERREWRITE
namespace impl {
template <typename DerivedT>
class SparseBufferRewriteBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseBufferRewriteBase;
SparseBufferRewriteBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseBufferRewriteBase(const SparseBufferRewriteBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseBufferRewriteBase& operator=(const SparseBufferRewriteBase &) = delete;
SparseBufferRewriteBase(SparseBufferRewriteBase &&) = delete;
SparseBufferRewriteBase& operator=(SparseBufferRewriteBase &&) = delete;
~SparseBufferRewriteBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-buffer-rewrite");
}
::llvm::StringRef getArgument() const override { return "sparse-buffer-rewrite"; }
::llvm::StringRef getDescription() const override { return "Rewrite sparse primitives on buffers to actual code"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseBufferRewrite");
}
::llvm::StringRef getName() const override { return "SparseBufferRewrite"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseBufferRewriteBase<DerivedT>)
SparseBufferRewriteBase(SparseBufferRewriteOptions options) : SparseBufferRewriteBase() {
enableBufferInitialization = std::move(options.enableBufferInitialization);
}
protected:
::mlir::Pass::Option<bool> enableBufferInitialization{*this, "enable-buffer-initialization", ::llvm::cl::desc("Enable zero-initialization of the memory buffers"), ::llvm::cl::init(false)};
private:
};
}
#undef GEN_PASS_DEF_SPARSEBUFFERREWRITE
#endif
#ifdef GEN_PASS_DECL_SPARSEGPUCODEGEN
struct SparseGPUCodegenOptions { … };
#undef GEN_PASS_DECL_SPARSEGPUCODEGEN
#endif
#ifdef GEN_PASS_DEF_SPARSEGPUCODEGEN
namespace impl {
template <typename DerivedT>
class SparseGPUCodegenBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseGPUCodegenBase;
SparseGPUCodegenBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseGPUCodegenBase(const SparseGPUCodegenBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseGPUCodegenBase& operator=(const SparseGPUCodegenBase &) = delete;
SparseGPUCodegenBase(SparseGPUCodegenBase &&) = delete;
SparseGPUCodegenBase& operator=(SparseGPUCodegenBase &&) = delete;
~SparseGPUCodegenBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-gpu-codegen");
}
::llvm::StringRef getArgument() const override { return "sparse-gpu-codegen"; }
::llvm::StringRef getDescription() const override { return "Generates GPU code during sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseGPUCodegen");
}
::llvm::StringRef getName() const override { return "SparseGPUCodegen"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<gpu::GPUDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseGPUCodegenBase<DerivedT>)
SparseGPUCodegenBase(SparseGPUCodegenOptions options) : SparseGPUCodegenBase() {
numThreads = std::move(options.numThreads);
enableRuntimeLibrary = std::move(options.enableRuntimeLibrary);
}
protected:
::mlir::Pass::Option<int32_t> numThreads{*this, "num-threads", ::llvm::cl::desc("Sets the number of GPU threads"), ::llvm::cl::init(1024)};
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
private:
};
}
#undef GEN_PASS_DEF_SPARSEGPUCODEGEN
#endif
#ifdef GEN_PASS_DECL_SPARSEREINTERPRETMAP
struct SparseReinterpretMapOptions { … };
#undef GEN_PASS_DECL_SPARSEREINTERPRETMAP
#endif
#ifdef GEN_PASS_DEF_SPARSEREINTERPRETMAP
namespace impl {
template <typename DerivedT>
class SparseReinterpretMapBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseReinterpretMapBase;
SparseReinterpretMapBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseReinterpretMapBase(const SparseReinterpretMapBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseReinterpretMapBase& operator=(const SparseReinterpretMapBase &) = delete;
SparseReinterpretMapBase(SparseReinterpretMapBase &&) = delete;
SparseReinterpretMapBase& operator=(SparseReinterpretMapBase &&) = delete;
~SparseReinterpretMapBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-reinterpret-map");
}
::llvm::StringRef getArgument() const override { return "sparse-reinterpret-map"; }
::llvm::StringRef getDescription() const override { return "Reinterprets sparse tensor type mappings"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseReinterpretMap");
}
::llvm::StringRef getName() const override { return "SparseReinterpretMap"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseReinterpretMapBase<DerivedT>)
SparseReinterpretMapBase(SparseReinterpretMapOptions options) : SparseReinterpretMapBase() {
scope = std::move(options.scope);
}
protected:
::mlir::Pass::Option<mlir::ReinterpretMapScope> scope{*this, "scope", ::llvm::cl::desc("Set the reiterpretation scope"), ::llvm::cl::init(mlir::ReinterpretMapScope::kAll), llvm::cl::values(
clEnumValN(mlir::ReinterpretMapScope::kAll, "all",
"Run on every applicable operations."),
clEnumValN(mlir::ReinterpretMapScope::kGenericOnly,
"only-generic",
"Run only on linalg.generic operations."),
clEnumValN(mlir::ReinterpretMapScope::kExceptGeneric,
"except-generic",
"Run on operations expect linalg.generic (e.g., foreach)"))};
private:
};
}
#undef GEN_PASS_DEF_SPARSEREINTERPRETMAP
#endif
#ifdef GEN_PASS_DECL_SPARSESPACECOLLAPSE
#undef GEN_PASS_DECL_SPARSESPACECOLLAPSE
#endif
#ifdef GEN_PASS_DEF_SPARSESPACECOLLAPSE
namespace impl {
template <typename DerivedT>
class SparseSpaceCollapseBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = SparseSpaceCollapseBase;
SparseSpaceCollapseBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseSpaceCollapseBase(const SparseSpaceCollapseBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
SparseSpaceCollapseBase& operator=(const SparseSpaceCollapseBase &) = delete;
SparseSpaceCollapseBase(SparseSpaceCollapseBase &&) = delete;
SparseSpaceCollapseBase& operator=(SparseSpaceCollapseBase &&) = delete;
~SparseSpaceCollapseBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-space-collapse");
}
::llvm::StringRef getArgument() const override { return "sparse-space-collapse"; }
::llvm::StringRef getDescription() const override { return "sparse space collapsing pass"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseSpaceCollapse");
}
::llvm::StringRef getName() const override { return "SparseSpaceCollapse"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseSpaceCollapseBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_SPARSESPACECOLLAPSE
#endif
#ifdef GEN_PASS_DECL_SPARSETENSORCODEGEN
struct SparseTensorCodegenOptions { … };
#undef GEN_PASS_DECL_SPARSETENSORCODEGEN
#endif
#ifdef GEN_PASS_DEF_SPARSETENSORCODEGEN
namespace impl {
template <typename DerivedT>
class SparseTensorCodegenBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseTensorCodegenBase;
SparseTensorCodegenBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseTensorCodegenBase(const SparseTensorCodegenBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseTensorCodegenBase& operator=(const SparseTensorCodegenBase &) = delete;
SparseTensorCodegenBase(SparseTensorCodegenBase &&) = delete;
SparseTensorCodegenBase& operator=(SparseTensorCodegenBase &&) = delete;
~SparseTensorCodegenBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-tensor-codegen");
}
::llvm::StringRef getArgument() const override { return "sparse-tensor-codegen"; }
::llvm::StringRef getDescription() const override { return "Convert sparse tensors and primitives to actual code"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseTensorCodegen");
}
::llvm::StringRef getName() const override { return "SparseTensorCodegen"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseTensorCodegenBase<DerivedT>)
SparseTensorCodegenBase(SparseTensorCodegenOptions options) : SparseTensorCodegenBase() {
enableBufferInitialization = std::move(options.enableBufferInitialization);
createSparseDeallocs = std::move(options.createSparseDeallocs);
}
protected:
::mlir::Pass::Option<bool> enableBufferInitialization{*this, "enable-buffer-initialization", ::llvm::cl::desc("Enable zero-initialization of the memory buffers"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> createSparseDeallocs{*this, "create-sparse-deallocs", ::llvm::cl::desc("Specify if the temporary buffers created by the sparse compiler should be deallocated. For compatibility with core bufferization passes. This option is only used when enable-runtime-library=false. See also create-deallocs for BufferizationOption."), ::llvm::cl::init(true)};
private:
};
}
#undef GEN_PASS_DEF_SPARSETENSORCODEGEN
#endif
#ifdef GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
#undef GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
#endif
#ifdef GEN_PASS_DEF_SPARSETENSORCONVERSIONPASS
namespace impl {
template <typename DerivedT>
class SparseTensorConversionPassBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseTensorConversionPassBase;
SparseTensorConversionPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseTensorConversionPassBase(const SparseTensorConversionPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseTensorConversionPassBase& operator=(const SparseTensorConversionPassBase &) = delete;
SparseTensorConversionPassBase(SparseTensorConversionPassBase &&) = delete;
SparseTensorConversionPassBase& operator=(SparseTensorConversionPassBase &&) = delete;
~SparseTensorConversionPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-tensor-conversion");
}
::llvm::StringRef getArgument() const override { return "sparse-tensor-conversion"; }
::llvm::StringRef getDescription() const override { return "Convert sparse tensors and primitives to library calls"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseTensorConversionPass");
}
::llvm::StringRef getName() const override { return "SparseTensorConversionPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseTensorConversionPassBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_SPARSETENSORCONVERSIONPASS
#endif
#ifdef GEN_PASS_DECL_SPARSEVECTORIZATION
struct SparseVectorizationOptions { … };
#undef GEN_PASS_DECL_SPARSEVECTORIZATION
#endif
#ifdef GEN_PASS_DEF_SPARSEVECTORIZATION
namespace impl {
template <typename DerivedT>
class SparseVectorizationBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseVectorizationBase;
SparseVectorizationBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseVectorizationBase(const SparseVectorizationBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseVectorizationBase& operator=(const SparseVectorizationBase &) = delete;
SparseVectorizationBase(SparseVectorizationBase &&) = delete;
SparseVectorizationBase& operator=(SparseVectorizationBase &&) = delete;
~SparseVectorizationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-vectorization");
}
::llvm::StringRef getArgument() const override { return "sparse-vectorization"; }
::llvm::StringRef getDescription() const override { return "Vectorizes loops after sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseVectorization");
}
::llvm::StringRef getName() const override { return "SparseVectorization"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<vector::VectorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseVectorizationBase<DerivedT>)
SparseVectorizationBase(SparseVectorizationOptions options) : SparseVectorizationBase() {
vectorLength = std::move(options.vectorLength);
enableVLAVectorization = std::move(options.enableVLAVectorization);
enableSIMDIndex32 = std::move(options.enableSIMDIndex32);
}
protected:
::mlir::Pass::Option<int32_t> vectorLength{*this, "vl", ::llvm::cl::desc("Set the vector length (use 0 to disable vectorization)"), ::llvm::cl::init(0)};
::mlir::Pass::Option<bool> enableVLAVectorization{*this, "enable-vla-vectorization", ::llvm::cl::desc("Enable vector length agnostic vectorization"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableSIMDIndex32{*this, "enable-simd-index32", ::llvm::cl::desc("Enable i32 indexing into vectors (for efficient gather/scatter)"), ::llvm::cl::init(false)};
private:
};
}
#undef GEN_PASS_DEF_SPARSEVECTORIZATION
#endif
#ifdef GEN_PASS_DECL_SPARSIFICATIONANDBUFFERIZATION
struct SparsificationAndBufferizationOptions { … };
#undef GEN_PASS_DECL_SPARSIFICATIONANDBUFFERIZATION
#endif
#ifdef GEN_PASS_DEF_SPARSIFICATIONANDBUFFERIZATION
namespace impl {
template <typename DerivedT>
class SparsificationAndBufferizationBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparsificationAndBufferizationBase;
SparsificationAndBufferizationBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparsificationAndBufferizationBase(const SparsificationAndBufferizationBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparsificationAndBufferizationBase& operator=(const SparsificationAndBufferizationBase &) = delete;
SparsificationAndBufferizationBase(SparsificationAndBufferizationBase &&) = delete;
SparsificationAndBufferizationBase& operator=(SparsificationAndBufferizationBase &&) = delete;
~SparsificationAndBufferizationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparsification-and-bufferization");
}
::llvm::StringRef getArgument() const override { return "sparsification-and-bufferization"; }
::llvm::StringRef getDescription() const override { return "Mini-pipeline that combines bufferization and sparsifiation"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparsificationAndBufferization");
}
::llvm::StringRef getName() const override { return "SparsificationAndBufferization"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<gpu::GPUDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<vector::VectorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparsificationAndBufferizationBase<DerivedT>)
SparsificationAndBufferizationBase(SparsificationAndBufferizationOptions options) : SparsificationAndBufferizationBase() {
vectorLength = std::move(options.vectorLength);
enableVLAVectorization = std::move(options.enableVLAVectorization);
enableSIMDIndex32 = std::move(options.enableSIMDIndex32);
enableGPULibgen = std::move(options.enableGPULibgen);
sparseEmitStrategy = std::move(options.sparseEmitStrategy);
parallelization = std::move(options.parallelization);
}
protected:
::mlir::Pass::Option<int32_t> vectorLength{*this, "vl", ::llvm::cl::desc("Set the vector length (use 0 to disable vectorization)"), ::llvm::cl::init(0)};
::mlir::Pass::Option<bool> enableVLAVectorization{*this, "enable-vla-vectorization", ::llvm::cl::desc("Enable vector length agnostic vectorization"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableSIMDIndex32{*this, "enable-simd-index32", ::llvm::cl::desc("Enable i32 indexing into vectors (for efficient gather/scatter)"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableGPULibgen{*this, "enable-gpu-libgen", ::llvm::cl::desc("Enable GPU acceleration by means of direct library calls"), ::llvm::cl::init(false)};
::mlir::Pass::Option<mlir::SparseEmitStrategy> sparseEmitStrategy{*this, "sparse-emit-strategy", ::llvm::cl::desc("Emit functional code or interfaces (to debug) for sparse loops"), ::llvm::cl::init(mlir::SparseEmitStrategy::kFunctional), llvm::cl::values(
clEnumValN(mlir::SparseEmitStrategy::kFunctional, "functional",
"Emit functional code (with scf.for/while)."),
clEnumValN(mlir::SparseEmitStrategy::kSparseIterator, "sparse-iterator",
"Emit (experimental) loops (with sparse.iterate)."),
clEnumValN(mlir::SparseEmitStrategy::kDebugInterface, "debug-interface",
"Emit non-functional but easy-to-read interfaces to debug."))};
::mlir::Pass::Option<mlir::SparseParallelizationStrategy> parallelization{*this, "parallelization-strategy", ::llvm::cl::desc("Set the parallelization strategy"), ::llvm::cl::init(mlir::SparseParallelizationStrategy::kNone), llvm::cl::values(
clEnumValN(mlir::SparseParallelizationStrategy::kNone, "none",
"Turn off sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseOuterLoop,
"dense-outer-loop",
"Enable dense outer loop sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageOuterLoop,
"any-storage-outer-loop",
"Enable sparse parallelization regardless of storage for the outer loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseAnyLoop,
"dense-any-loop",
"Enable dense parallelization for any loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageAnyLoop,
"any-storage-any-loop",
"Enable sparse parallelization for any storage and loop."))};
private:
};
}
#undef GEN_PASS_DEF_SPARSIFICATIONANDBUFFERIZATION
#endif
#ifdef GEN_PASS_DECL_SPARSIFICATIONPASS
struct SparsificationPassOptions { … };
#undef GEN_PASS_DECL_SPARSIFICATIONPASS
#endif
#ifdef GEN_PASS_DEF_SPARSIFICATIONPASS
namespace impl {
template <typename DerivedT>
class SparsificationPassBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparsificationPassBase;
SparsificationPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparsificationPassBase(const SparsificationPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparsificationPassBase& operator=(const SparsificationPassBase &) = delete;
SparsificationPassBase(SparsificationPassBase &&) = delete;
SparsificationPassBase& operator=(SparsificationPassBase &&) = delete;
~SparsificationPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparsification");
}
::llvm::StringRef getArgument() const override { return "sparsification"; }
::llvm::StringRef getDescription() const override { return "Automatically generate sparse tensor code from sparse tensor types"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparsificationPass");
}
::llvm::StringRef getName() const override { return "SparsificationPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparsificationPassBase<DerivedT>)
SparsificationPassBase(SparsificationPassOptions options) : SparsificationPassBase() {
parallelization = std::move(options.parallelization);
sparseEmitStrategy = std::move(options.sparseEmitStrategy);
enableRuntimeLibrary = std::move(options.enableRuntimeLibrary);
}
protected:
::mlir::Pass::Option<mlir::SparseParallelizationStrategy> parallelization{*this, "parallelization-strategy", ::llvm::cl::desc("Set the parallelization strategy"), ::llvm::cl::init(mlir::SparseParallelizationStrategy::kNone), llvm::cl::values(
clEnumValN(mlir::SparseParallelizationStrategy::kNone, "none",
"Turn off sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseOuterLoop,
"dense-outer-loop",
"Enable dense outer loop sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageOuterLoop,
"any-storage-outer-loop",
"Enable sparse parallelization regardless of storage for the outer loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseAnyLoop,
"dense-any-loop",
"Enable dense parallelization for any loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageAnyLoop,
"any-storage-any-loop",
"Enable sparse parallelization for any storage and loop."))};
::mlir::Pass::Option<mlir::SparseEmitStrategy> sparseEmitStrategy{*this, "sparse-emit-strategy", ::llvm::cl::desc("Emit functional code or interfaces (to debug) for sparse loops"), ::llvm::cl::init(mlir::SparseEmitStrategy::kFunctional), llvm::cl::values(
clEnumValN(mlir::SparseEmitStrategy::kFunctional, "functional",
"Emit functional code (with scf.for/while)."),
clEnumValN(mlir::SparseEmitStrategy::kSparseIterator, "sparse-iterator",
"Emit (experimental) loops (with sparse.iterate)."),
clEnumValN(mlir::SparseEmitStrategy::kDebugInterface, "debug-interface",
"Emit non-functional but easy-to-read interfaces to debug."))};
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
private:
};
}
#undef GEN_PASS_DEF_SPARSIFICATIONPASS
#endif
#ifdef GEN_PASS_DECL_STAGESPARSEOPERATIONS
#undef GEN_PASS_DECL_STAGESPARSEOPERATIONS
#endif
#ifdef GEN_PASS_DEF_STAGESPARSEOPERATIONS
namespace impl {
template <typename DerivedT>
class StageSparseOperationsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = StageSparseOperationsBase;
StageSparseOperationsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
StageSparseOperationsBase(const StageSparseOperationsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
StageSparseOperationsBase& operator=(const StageSparseOperationsBase &) = delete;
StageSparseOperationsBase(StageSparseOperationsBase &&) = delete;
StageSparseOperationsBase& operator=(StageSparseOperationsBase &&) = delete;
~StageSparseOperationsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("stage-sparse-ops");
}
::llvm::StringRef getArgument() const override { return "stage-sparse-ops"; }
::llvm::StringRef getDescription() const override { return "Decompose a complex sparse operation into multiple stages"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StageSparseOperations");
}
::llvm::StringRef getName() const override { return "StageSparseOperations"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StageSparseOperationsBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_STAGESPARSEOPERATIONS
#endif
#ifdef GEN_PASS_DECL_STORAGESPECIFIERTOLLVM
#undef GEN_PASS_DECL_STORAGESPECIFIERTOLLVM
#endif
#ifdef GEN_PASS_DEF_STORAGESPECIFIERTOLLVM
namespace impl {
template <typename DerivedT>
class StorageSpecifierToLLVMBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = StorageSpecifierToLLVMBase;
StorageSpecifierToLLVMBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
StorageSpecifierToLLVMBase(const StorageSpecifierToLLVMBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
StorageSpecifierToLLVMBase& operator=(const StorageSpecifierToLLVMBase &) = delete;
StorageSpecifierToLLVMBase(StorageSpecifierToLLVMBase &&) = delete;
StorageSpecifierToLLVMBase& operator=(StorageSpecifierToLLVMBase &&) = delete;
~StorageSpecifierToLLVMBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-storage-specifier-to-llvm");
}
::llvm::StringRef getArgument() const override { return "sparse-storage-specifier-to-llvm"; }
::llvm::StringRef getDescription() const override { return "Lower sparse storage specifer to llvm structure"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StorageSpecifierToLLVM");
}
::llvm::StringRef getName() const override { return "StorageSpecifierToLLVM"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StorageSpecifierToLLVMBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_STORAGESPECIFIERTOLLVM
#endif
#ifdef GEN_PASS_REGISTRATION
inline void registerLowerForeachToSCF() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerForeachToSCFPass();
});
}
inline void registerLowerForeachToSCFPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerForeachToSCFPass();
});
}
inline void registerLowerSparseIterationToSCF() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerSparseIterationToSCFPass();
});
}
inline void registerLowerSparseIterationToSCFPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerSparseIterationToSCFPass();
});
}
inline void registerLowerSparseOpsToForeach() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerSparseOpsToForeachPass();
});
}
inline void registerLowerSparseOpsToForeachPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createLowerSparseOpsToForeachPass();
});
}
inline void registerPreSparsificationRewrite() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createPreSparsificationRewritePass();
});
}
inline void registerPreSparsificationRewritePass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createPreSparsificationRewritePass();
});
}
inline void registerSparseAssembler() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseAssembler();
});
}
inline void registerSparseAssemblerPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseAssembler();
});
}
inline void registerSparseBufferRewrite() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseBufferRewritePass();
});
}
inline void registerSparseBufferRewritePass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseBufferRewritePass();
});
}
inline void registerSparseGPUCodegen() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseGPUCodegenPass();
});
}
inline void registerSparseGPUCodegenPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseGPUCodegenPass();
});
}
inline void registerSparseReinterpretMap() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseReinterpretMapPass();
});
}
inline void registerSparseReinterpretMapPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseReinterpretMapPass();
});
}
inline void registerSparseSpaceCollapse() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseSpaceCollapsePass();
});
}
inline void registerSparseSpaceCollapsePass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseSpaceCollapsePass();
});
}
inline void registerSparseTensorCodegen() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseTensorCodegenPass();
});
}
inline void registerSparseTensorCodegenPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseTensorCodegenPass();
});
}
inline void registerSparseTensorConversionPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseTensorConversionPass();
});
}
inline void registerSparseTensorConversionPassPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseTensorConversionPass();
});
}
inline void registerSparseVectorization() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseVectorizationPass();
});
}
inline void registerSparseVectorizationPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparseVectorizationPass();
});
}
inline void registerSparsificationAndBufferization() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparsificationAndBufferizationPass();
});
}
inline void registerSparsificationAndBufferizationPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparsificationAndBufferizationPass();
});
}
inline void registerSparsificationPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparsificationPass();
});
}
inline void registerSparsificationPassPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createSparsificationPass();
});
}
inline void registerStageSparseOperations() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createStageSparseOperationsPass();
});
}
inline void registerStageSparseOperationsPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createStageSparseOperationsPass();
});
}
inline void registerStorageSpecifierToLLVM() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createStorageSpecifierToLLVMPass();
});
}
inline void registerStorageSpecifierToLLVMPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return mlir::createStorageSpecifierToLLVMPass();
});
}
inline void registerSparseTensorPasses() {
registerLowerForeachToSCF();
registerLowerSparseIterationToSCF();
registerLowerSparseOpsToForeach();
registerPreSparsificationRewrite();
registerSparseAssembler();
registerSparseBufferRewrite();
registerSparseGPUCodegen();
registerSparseReinterpretMap();
registerSparseSpaceCollapse();
registerSparseTensorCodegen();
registerSparseTensorConversionPass();
registerSparseVectorization();
registerSparsificationAndBufferization();
registerSparsificationPass();
registerStageSparseOperations();
registerStorageSpecifierToLLVM();
}
#undef GEN_PASS_REGISTRATION
#endif
#ifdef GEN_PASS_CLASSES
template <typename DerivedT>
class LowerForeachToSCFBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerForeachToSCFBase;
LowerForeachToSCFBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerForeachToSCFBase(const LowerForeachToSCFBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerForeachToSCFBase& operator=(const LowerForeachToSCFBase &) = delete;
LowerForeachToSCFBase(LowerForeachToSCFBase &&) = delete;
LowerForeachToSCFBase& operator=(LowerForeachToSCFBase &&) = delete;
~LowerForeachToSCFBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-foreach-to-scf");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-foreach-to-scf"; }
::llvm::StringRef getDescription() const override { return "Decompose a complex sparse operation into multiple stages"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerForeachToSCF");
}
::llvm::StringRef getName() const override { return "LowerForeachToSCF"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerForeachToSCFBase<DerivedT>)
protected:
};
template <typename DerivedT>
class LowerSparseIterationToSCFBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerSparseIterationToSCFBase;
LowerSparseIterationToSCFBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerSparseIterationToSCFBase(const LowerSparseIterationToSCFBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerSparseIterationToSCFBase& operator=(const LowerSparseIterationToSCFBase &) = delete;
LowerSparseIterationToSCFBase(LowerSparseIterationToSCFBase &&) = delete;
LowerSparseIterationToSCFBase& operator=(LowerSparseIterationToSCFBase &&) = delete;
~LowerSparseIterationToSCFBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-iteration-to-scf");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-iteration-to-scf"; }
::llvm::StringRef getDescription() const override { return "lower sparse_tensor.iterate/coiterate into scf loops"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerSparseIterationToSCF");
}
::llvm::StringRef getName() const override { return "LowerSparseIterationToSCF"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerSparseIterationToSCFBase<DerivedT>)
protected:
};
template <typename DerivedT>
class LowerSparseOpsToForeachBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = LowerSparseOpsToForeachBase;
LowerSparseOpsToForeachBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerSparseOpsToForeachBase(const LowerSparseOpsToForeachBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
LowerSparseOpsToForeachBase& operator=(const LowerSparseOpsToForeachBase &) = delete;
LowerSparseOpsToForeachBase(LowerSparseOpsToForeachBase &&) = delete;
LowerSparseOpsToForeachBase& operator=(LowerSparseOpsToForeachBase &&) = delete;
~LowerSparseOpsToForeachBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-sparse-ops-to-foreach");
}
::llvm::StringRef getArgument() const override { return "lower-sparse-ops-to-foreach"; }
::llvm::StringRef getDescription() const override { return "Applies sparse tensor rewriting rules after sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerSparseOpsToForeach");
}
::llvm::StringRef getName() const override { return "LowerSparseOpsToForeach"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerSparseOpsToForeachBase<DerivedT>)
protected:
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
::mlir::Pass::Option<bool> enableConvert{*this, "enable-convert", ::llvm::cl::desc("Enable rewriting rules for the convert operator"), ::llvm::cl::init(true)};
};
template <typename DerivedT>
class PreSparsificationRewriteBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = PreSparsificationRewriteBase;
PreSparsificationRewriteBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
PreSparsificationRewriteBase(const PreSparsificationRewriteBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
PreSparsificationRewriteBase& operator=(const PreSparsificationRewriteBase &) = delete;
PreSparsificationRewriteBase(PreSparsificationRewriteBase &&) = delete;
PreSparsificationRewriteBase& operator=(PreSparsificationRewriteBase &&) = delete;
~PreSparsificationRewriteBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("pre-sparsification-rewrite");
}
::llvm::StringRef getArgument() const override { return "pre-sparsification-rewrite"; }
::llvm::StringRef getDescription() const override { return "Applies sparse tensor rewriting rules prior to sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("PreSparsificationRewrite");
}
::llvm::StringRef getName() const override { return "PreSparsificationRewrite"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PreSparsificationRewriteBase<DerivedT>)
protected:
};
template <typename DerivedT>
class SparseAssemblerBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseAssemblerBase;
SparseAssemblerBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseAssemblerBase(const SparseAssemblerBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseAssemblerBase& operator=(const SparseAssemblerBase &) = delete;
SparseAssemblerBase(SparseAssemblerBase &&) = delete;
SparseAssemblerBase& operator=(SparseAssemblerBase &&) = delete;
~SparseAssemblerBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-assembler");
}
::llvm::StringRef getArgument() const override { return "sparse-assembler"; }
::llvm::StringRef getDescription() const override { return "Add [dis]assemble operations on external sparse tensors"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseAssembler");
}
::llvm::StringRef getName() const override { return "SparseAssembler"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<bufferization::BufferizationDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<tensor::TensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseAssemblerBase<DerivedT>)
protected:
::mlir::Pass::Option<bool> directOut{*this, "direct-out", ::llvm::cl::desc("Directly returns buffers externally"), ::llvm::cl::init(false)};
};
template <typename DerivedT>
class SparseBufferRewriteBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseBufferRewriteBase;
SparseBufferRewriteBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseBufferRewriteBase(const SparseBufferRewriteBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseBufferRewriteBase& operator=(const SparseBufferRewriteBase &) = delete;
SparseBufferRewriteBase(SparseBufferRewriteBase &&) = delete;
SparseBufferRewriteBase& operator=(SparseBufferRewriteBase &&) = delete;
~SparseBufferRewriteBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-buffer-rewrite");
}
::llvm::StringRef getArgument() const override { return "sparse-buffer-rewrite"; }
::llvm::StringRef getDescription() const override { return "Rewrite sparse primitives on buffers to actual code"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseBufferRewrite");
}
::llvm::StringRef getName() const override { return "SparseBufferRewrite"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseBufferRewriteBase<DerivedT>)
protected:
::mlir::Pass::Option<bool> enableBufferInitialization{*this, "enable-buffer-initialization", ::llvm::cl::desc("Enable zero-initialization of the memory buffers"), ::llvm::cl::init(false)};
};
template <typename DerivedT>
class SparseGPUCodegenBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseGPUCodegenBase;
SparseGPUCodegenBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseGPUCodegenBase(const SparseGPUCodegenBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseGPUCodegenBase& operator=(const SparseGPUCodegenBase &) = delete;
SparseGPUCodegenBase(SparseGPUCodegenBase &&) = delete;
SparseGPUCodegenBase& operator=(SparseGPUCodegenBase &&) = delete;
~SparseGPUCodegenBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-gpu-codegen");
}
::llvm::StringRef getArgument() const override { return "sparse-gpu-codegen"; }
::llvm::StringRef getDescription() const override { return "Generates GPU code during sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseGPUCodegen");
}
::llvm::StringRef getName() const override { return "SparseGPUCodegen"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<gpu::GPUDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseGPUCodegenBase<DerivedT>)
protected:
::mlir::Pass::Option<int32_t> numThreads{*this, "num-threads", ::llvm::cl::desc("Sets the number of GPU threads"), ::llvm::cl::init(1024)};
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
};
template <typename DerivedT>
class SparseReinterpretMapBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseReinterpretMapBase;
SparseReinterpretMapBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseReinterpretMapBase(const SparseReinterpretMapBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseReinterpretMapBase& operator=(const SparseReinterpretMapBase &) = delete;
SparseReinterpretMapBase(SparseReinterpretMapBase &&) = delete;
SparseReinterpretMapBase& operator=(SparseReinterpretMapBase &&) = delete;
~SparseReinterpretMapBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-reinterpret-map");
}
::llvm::StringRef getArgument() const override { return "sparse-reinterpret-map"; }
::llvm::StringRef getDescription() const override { return "Reinterprets sparse tensor type mappings"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseReinterpretMap");
}
::llvm::StringRef getName() const override { return "SparseReinterpretMap"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseReinterpretMapBase<DerivedT>)
protected:
::mlir::Pass::Option<mlir::ReinterpretMapScope> scope{*this, "scope", ::llvm::cl::desc("Set the reiterpretation scope"), ::llvm::cl::init(mlir::ReinterpretMapScope::kAll), llvm::cl::values(
clEnumValN(mlir::ReinterpretMapScope::kAll, "all",
"Run on every applicable operations."),
clEnumValN(mlir::ReinterpretMapScope::kGenericOnly,
"only-generic",
"Run only on linalg.generic operations."),
clEnumValN(mlir::ReinterpretMapScope::kExceptGeneric,
"except-generic",
"Run on operations expect linalg.generic (e.g., foreach)"))};
};
template <typename DerivedT>
class SparseSpaceCollapseBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = SparseSpaceCollapseBase;
SparseSpaceCollapseBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseSpaceCollapseBase(const SparseSpaceCollapseBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
SparseSpaceCollapseBase& operator=(const SparseSpaceCollapseBase &) = delete;
SparseSpaceCollapseBase(SparseSpaceCollapseBase &&) = delete;
SparseSpaceCollapseBase& operator=(SparseSpaceCollapseBase &&) = delete;
~SparseSpaceCollapseBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-space-collapse");
}
::llvm::StringRef getArgument() const override { return "sparse-space-collapse"; }
::llvm::StringRef getDescription() const override { return "sparse space collapsing pass"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseSpaceCollapse");
}
::llvm::StringRef getName() const override { return "SparseSpaceCollapse"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseSpaceCollapseBase<DerivedT>)
protected:
};
template <typename DerivedT>
class SparseTensorCodegenBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseTensorCodegenBase;
SparseTensorCodegenBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseTensorCodegenBase(const SparseTensorCodegenBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseTensorCodegenBase& operator=(const SparseTensorCodegenBase &) = delete;
SparseTensorCodegenBase(SparseTensorCodegenBase &&) = delete;
SparseTensorCodegenBase& operator=(SparseTensorCodegenBase &&) = delete;
~SparseTensorCodegenBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-tensor-codegen");
}
::llvm::StringRef getArgument() const override { return "sparse-tensor-codegen"; }
::llvm::StringRef getDescription() const override { return "Convert sparse tensors and primitives to actual code"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseTensorCodegen");
}
::llvm::StringRef getName() const override { return "SparseTensorCodegen"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseTensorCodegenBase<DerivedT>)
protected:
::mlir::Pass::Option<bool> enableBufferInitialization{*this, "enable-buffer-initialization", ::llvm::cl::desc("Enable zero-initialization of the memory buffers"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> createSparseDeallocs{*this, "create-sparse-deallocs", ::llvm::cl::desc("Specify if the temporary buffers created by the sparse compiler should be deallocated. For compatibility with core bufferization passes. This option is only used when enable-runtime-library=false. See also create-deallocs for BufferizationOption."), ::llvm::cl::init(true)};
};
template <typename DerivedT>
class SparseTensorConversionPassBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseTensorConversionPassBase;
SparseTensorConversionPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseTensorConversionPassBase(const SparseTensorConversionPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseTensorConversionPassBase& operator=(const SparseTensorConversionPassBase &) = delete;
SparseTensorConversionPassBase(SparseTensorConversionPassBase &&) = delete;
SparseTensorConversionPassBase& operator=(SparseTensorConversionPassBase &&) = delete;
~SparseTensorConversionPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-tensor-conversion");
}
::llvm::StringRef getArgument() const override { return "sparse-tensor-conversion"; }
::llvm::StringRef getDescription() const override { return "Convert sparse tensors and primitives to library calls"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseTensorConversionPass");
}
::llvm::StringRef getName() const override { return "SparseTensorConversionPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseTensorConversionPassBase<DerivedT>)
protected:
};
template <typename DerivedT>
class SparseVectorizationBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparseVectorizationBase;
SparseVectorizationBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparseVectorizationBase(const SparseVectorizationBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparseVectorizationBase& operator=(const SparseVectorizationBase &) = delete;
SparseVectorizationBase(SparseVectorizationBase &&) = delete;
SparseVectorizationBase& operator=(SparseVectorizationBase &&) = delete;
~SparseVectorizationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-vectorization");
}
::llvm::StringRef getArgument() const override { return "sparse-vectorization"; }
::llvm::StringRef getDescription() const override { return "Vectorizes loops after sparsification"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparseVectorization");
}
::llvm::StringRef getName() const override { return "SparseVectorization"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<vector::VectorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseVectorizationBase<DerivedT>)
protected:
::mlir::Pass::Option<int32_t> vectorLength{*this, "vl", ::llvm::cl::desc("Set the vector length (use 0 to disable vectorization)"), ::llvm::cl::init(0)};
::mlir::Pass::Option<bool> enableVLAVectorization{*this, "enable-vla-vectorization", ::llvm::cl::desc("Enable vector length agnostic vectorization"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableSIMDIndex32{*this, "enable-simd-index32", ::llvm::cl::desc("Enable i32 indexing into vectors (for efficient gather/scatter)"), ::llvm::cl::init(false)};
};
template <typename DerivedT>
class SparsificationAndBufferizationBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparsificationAndBufferizationBase;
SparsificationAndBufferizationBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparsificationAndBufferizationBase(const SparsificationAndBufferizationBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparsificationAndBufferizationBase& operator=(const SparsificationAndBufferizationBase &) = delete;
SparsificationAndBufferizationBase(SparsificationAndBufferizationBase &&) = delete;
SparsificationAndBufferizationBase& operator=(SparsificationAndBufferizationBase &&) = delete;
~SparsificationAndBufferizationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparsification-and-bufferization");
}
::llvm::StringRef getArgument() const override { return "sparsification-and-bufferization"; }
::llvm::StringRef getDescription() const override { return "Mini-pipeline that combines bufferization and sparsifiation"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparsificationAndBufferization");
}
::llvm::StringRef getName() const override { return "SparsificationAndBufferization"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<gpu::GPUDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
registry.insert<vector::VectorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparsificationAndBufferizationBase<DerivedT>)
protected:
::mlir::Pass::Option<int32_t> vectorLength{*this, "vl", ::llvm::cl::desc("Set the vector length (use 0 to disable vectorization)"), ::llvm::cl::init(0)};
::mlir::Pass::Option<bool> enableVLAVectorization{*this, "enable-vla-vectorization", ::llvm::cl::desc("Enable vector length agnostic vectorization"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableSIMDIndex32{*this, "enable-simd-index32", ::llvm::cl::desc("Enable i32 indexing into vectors (for efficient gather/scatter)"), ::llvm::cl::init(false)};
::mlir::Pass::Option<bool> enableGPULibgen{*this, "enable-gpu-libgen", ::llvm::cl::desc("Enable GPU acceleration by means of direct library calls"), ::llvm::cl::init(false)};
::mlir::Pass::Option<mlir::SparseEmitStrategy> sparseEmitStrategy{*this, "sparse-emit-strategy", ::llvm::cl::desc("Emit functional code or interfaces (to debug) for sparse loops"), ::llvm::cl::init(mlir::SparseEmitStrategy::kFunctional), llvm::cl::values(
clEnumValN(mlir::SparseEmitStrategy::kFunctional, "functional",
"Emit functional code (with scf.for/while)."),
clEnumValN(mlir::SparseEmitStrategy::kSparseIterator, "sparse-iterator",
"Emit (experimental) loops (with sparse.iterate)."),
clEnumValN(mlir::SparseEmitStrategy::kDebugInterface, "debug-interface",
"Emit non-functional but easy-to-read interfaces to debug."))};
::mlir::Pass::Option<mlir::SparseParallelizationStrategy> parallelization{*this, "parallelization-strategy", ::llvm::cl::desc("Set the parallelization strategy"), ::llvm::cl::init(mlir::SparseParallelizationStrategy::kNone), llvm::cl::values(
clEnumValN(mlir::SparseParallelizationStrategy::kNone, "none",
"Turn off sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseOuterLoop,
"dense-outer-loop",
"Enable dense outer loop sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageOuterLoop,
"any-storage-outer-loop",
"Enable sparse parallelization regardless of storage for the outer loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseAnyLoop,
"dense-any-loop",
"Enable dense parallelization for any loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageAnyLoop,
"any-storage-any-loop",
"Enable sparse parallelization for any storage and loop."))};
};
template <typename DerivedT>
class SparsificationPassBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = SparsificationPassBase;
SparsificationPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
SparsificationPassBase(const SparsificationPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
SparsificationPassBase& operator=(const SparsificationPassBase &) = delete;
SparsificationPassBase(SparsificationPassBase &&) = delete;
SparsificationPassBase& operator=(SparsificationPassBase &&) = delete;
~SparsificationPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparsification");
}
::llvm::StringRef getArgument() const override { return "sparsification"; }
::llvm::StringRef getDescription() const override { return "Automatically generate sparse tensor code from sparse tensor types"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("SparsificationPass");
}
::llvm::StringRef getName() const override { return "SparsificationPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<affine::AffineDialect>();
registry.insert<arith::ArithDialect>();
registry.insert<bufferization::BufferizationDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<memref::MemRefDialect>();
registry.insert<scf::SCFDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparsificationPassBase<DerivedT>)
protected:
::mlir::Pass::Option<mlir::SparseParallelizationStrategy> parallelization{*this, "parallelization-strategy", ::llvm::cl::desc("Set the parallelization strategy"), ::llvm::cl::init(mlir::SparseParallelizationStrategy::kNone), llvm::cl::values(
clEnumValN(mlir::SparseParallelizationStrategy::kNone, "none",
"Turn off sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseOuterLoop,
"dense-outer-loop",
"Enable dense outer loop sparse parallelization."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageOuterLoop,
"any-storage-outer-loop",
"Enable sparse parallelization regardless of storage for the outer loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kDenseAnyLoop,
"dense-any-loop",
"Enable dense parallelization for any loop."),
clEnumValN(mlir::SparseParallelizationStrategy::kAnyStorageAnyLoop,
"any-storage-any-loop",
"Enable sparse parallelization for any storage and loop."))};
::mlir::Pass::Option<mlir::SparseEmitStrategy> sparseEmitStrategy{*this, "sparse-emit-strategy", ::llvm::cl::desc("Emit functional code or interfaces (to debug) for sparse loops"), ::llvm::cl::init(mlir::SparseEmitStrategy::kFunctional), llvm::cl::values(
clEnumValN(mlir::SparseEmitStrategy::kFunctional, "functional",
"Emit functional code (with scf.for/while)."),
clEnumValN(mlir::SparseEmitStrategy::kSparseIterator, "sparse-iterator",
"Emit (experimental) loops (with sparse.iterate)."),
clEnumValN(mlir::SparseEmitStrategy::kDebugInterface, "debug-interface",
"Emit non-functional but easy-to-read interfaces to debug."))};
::mlir::Pass::Option<bool> enableRuntimeLibrary{*this, "enable-runtime-library", ::llvm::cl::desc("Enable runtime library for manipulating sparse tensors"), ::llvm::cl::init(true)};
};
template <typename DerivedT>
class StageSparseOperationsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = StageSparseOperationsBase;
StageSparseOperationsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
StageSparseOperationsBase(const StageSparseOperationsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
StageSparseOperationsBase& operator=(const StageSparseOperationsBase &) = delete;
StageSparseOperationsBase(StageSparseOperationsBase &&) = delete;
StageSparseOperationsBase& operator=(StageSparseOperationsBase &&) = delete;
~StageSparseOperationsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("stage-sparse-ops");
}
::llvm::StringRef getArgument() const override { return "stage-sparse-ops"; }
::llvm::StringRef getDescription() const override { return "Decompose a complex sparse operation into multiple stages"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StageSparseOperations");
}
::llvm::StringRef getName() const override { return "StageSparseOperations"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StageSparseOperationsBase<DerivedT>)
protected:
};
template <typename DerivedT>
class StorageSpecifierToLLVMBase : public ::mlir::OperationPass<ModuleOp> {
public:
using Base = StorageSpecifierToLLVMBase;
StorageSpecifierToLLVMBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
StorageSpecifierToLLVMBase(const StorageSpecifierToLLVMBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}
StorageSpecifierToLLVMBase& operator=(const StorageSpecifierToLLVMBase &) = delete;
StorageSpecifierToLLVMBase(StorageSpecifierToLLVMBase &&) = delete;
StorageSpecifierToLLVMBase& operator=(StorageSpecifierToLLVMBase &&) = delete;
~StorageSpecifierToLLVMBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("sparse-storage-specifier-to-llvm");
}
::llvm::StringRef getArgument() const override { return "sparse-storage-specifier-to-llvm"; }
::llvm::StringRef getDescription() const override { return "Lower sparse storage specifer to llvm structure"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StorageSpecifierToLLVM");
}
::llvm::StringRef getName() const override { return "StorageSpecifierToLLVM"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<arith::ArithDialect>();
registry.insert<LLVM::LLVMDialect>();
registry.insert<sparse_tensor::SparseTensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StorageSpecifierToLLVMBase<DerivedT>)
protected:
};
#undef GEN_PASS_CLASSES
#endif