Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
//===- LinalgToLLVM.cpp - conversion from Linalg to LLVM dialect ----------===// | //===- LinalgToLLVM.cpp - conversion from Linalg to LLVM dialect ----------===// | ||||
Lint: Lint: clang-format-diff not found in user's PATH; not linting file. | |||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
▲ Show 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | patterns.insert<RangeOpConversion, ReshapeOpConversion, SliceOpConversion, | ||||
TransposeOpConversion, YieldOpConversion>(ctx, converter); | TransposeOpConversion, YieldOpConversion>(ctx, converter); | ||||
// Populate the type conversions for the linalg types. | // Populate the type conversions for the linalg types. | ||||
converter.addConversion( | converter.addConversion( | ||||
[&](RangeType type) { return convertRangeType(type, converter); }); | [&](RangeType type) { return convertRangeType(type, converter); }); | ||||
} | } | ||||
namespace { | namespace { | ||||
struct ConvertLinalgToLLVMPass : public ModulePass<ConvertLinalgToLLVMPass> { | struct ConvertLinalgToLLVMPass | ||||
: public OperationPass<ConvertLinalgToLLVMPass, ModuleOp> { | |||||
/// Include the generated pass utilities. | /// Include the generated pass utilities. | ||||
#define GEN_PASS_ConvertLinalgToLLVM | #define GEN_PASS_ConvertLinalgToLLVM | ||||
#include "mlir/Conversion/Passes.h.inc" | #include "mlir/Conversion/Passes.h.inc" | ||||
void runOnModule() override; | void runOnOperation() override; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
void ConvertLinalgToLLVMPass::runOnModule() { | void ConvertLinalgToLLVMPass::runOnOperation() { | ||||
auto module = getModule(); | auto module = getOperation(); | ||||
// Convert to the LLVM IR dialect using the converter defined above. | // Convert to the LLVM IR dialect using the converter defined above. | ||||
OwningRewritePatternList patterns; | OwningRewritePatternList patterns; | ||||
LLVMTypeConverter converter(&getContext()); | LLVMTypeConverter converter(&getContext()); | ||||
populateAffineToStdConversionPatterns(patterns, &getContext()); | populateAffineToStdConversionPatterns(patterns, &getContext()); | ||||
populateLoopToStdConversionPatterns(patterns, &getContext()); | populateLoopToStdConversionPatterns(patterns, &getContext()); | ||||
populateStdToLLVMConversionPatterns(converter, patterns, /*useAlloca=*/false, | populateStdToLLVMConversionPatterns(converter, patterns, /*useAlloca=*/false, | ||||
/*emitCWrappers=*/true); | /*emitCWrappers=*/true); | ||||
Show All 16 Lines |
clang-format-diff not found in user's PATH; not linting file.