[Mlir-commits] [mlir] TosaToLinalg: Allow to skip the TOSA validation pass (PR #91742)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri May 10 06:31:35 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-linalg
Author: Matthias Gehre (mgehre-amd)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/91742.diff
2 Files Affected:
- (modified) mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h (+1-1)
- (modified) mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp (+8-6)
``````````diff
diff --git a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
index 5fd77c8a0211a..e1d0199dac447 100644
--- a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
+++ b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
@@ -38,7 +38,7 @@ void addTosaToLinalgPasses(
const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions =
TosaToLinalgNamedOptions(),
// Note: Default to 'none' level unless otherwise specified.
- tosa::TosaValidationOptions const &validationOptions = {
+ std::optional<tosa::TosaValidationOptions> validationOptions = tosa::TosaValidationOptions{
tosa::TosaProfileEnum::Undefined, false, tosa::TosaLevelEnum::None});
/// Populates TOSA to linalg pipelines
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
index ad7f6cf84e5ed..8904e3253922c 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
@@ -78,7 +78,7 @@ std::unique_ptr<Pass> mlir::tosa::createTosaToLinalg() {
void mlir::tosa::addTosaToLinalgPasses(
OpPassManager &pm, const TosaToLinalgOptions &options,
const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions,
- tosa::TosaValidationOptions const &validationOptions) {
+ std::optional<tosa::TosaValidationOptions> validationOptions) {
// Optional decompositions are designed to benefit linalg.
if (!options.disableTosaDecompositions)
pm.addNestedPass<func::FuncOp>(tosa::createTosaOptionalDecompositions());
@@ -93,7 +93,8 @@ void mlir::tosa::addTosaToLinalgPasses(
pm.addNestedPass<func::FuncOp>(tosa::createTosaLayerwiseConstantFoldPass(
{options.aggressiveReduceConstant}));
pm.addNestedPass<func::FuncOp>(tosa::createTosaMakeBroadcastablePass());
- pm.addPass(tosa::createTosaValidation(validationOptions));
+ if (validationOptions)
+ pm.addPass(tosa::createTosaValidation(*validationOptions));
pm.addNestedPass<func::FuncOp>(tosa::createTosaToLinalg());
}
@@ -110,11 +111,12 @@ void mlir::tosa::registerTosaToLinalgPipelines() {
[](OpPassManager &pm) {
TosaToLinalgOptions tosaToLinalgOptions;
TosaToLinalgNamedOptions tosaToLinalgNamedOptions;
+ TosaValidationOptions validationOptions;
+ validationOptions.profile = tosa::TosaProfileEnum::BaseInference;
+ validationOptions.StrictOperationSpecAlignment = true;
+ validationOptions.level = tosa::TosaLevelEnum::EightK;
tosa::addTosaToLinalgPasses(pm, tosaToLinalgOptions,
tosaToLinalgNamedOptions,
- /* validationOptions = */
- {tosa::TosaProfileEnum::BaseInference,
- /* StrictOperationSpecAlignment = */ true,
- tosa::TosaLevelEnum::EightK});
+ validationOptions);
});
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/91742
More information about the Mlir-commits
mailing list