Skip to content

Commit

Permalink
Replace notifyMatchFailure with ErrorHandler::compilerError
Browse files Browse the repository at this point in the history
The former is currently not properly supported by Daphne. While it does work, it is replaced with Daphne's own error handler to display the error messages.
  • Loading branch information
AlexRTer committed Nov 29, 2024
1 parent 741faf4 commit d6376f8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/compiler/lowering/AggAllOpLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <utility>

#include "compiler/utils/LoweringUtils.h"
#include <util/ErrorHandler.h>

#include "ir/daphneir/Daphne.h"
#include "ir/daphneir/Passes.h"
Expand Down Expand Up @@ -90,8 +91,9 @@ class AggAllOpLowering : public OpConversionPattern<AggOp> {
ssize_t numCols = matrixType.getNumCols();

if (numRows < 0 || numCols < 0) {
return rewriter.notifyMatchFailure(
op, "aggAllOp codegen currently only works with matrix dimensions that are known at compile time");
throw ErrorHandler::compilerError(
loc, "AggAllOpLowering",
"aggAllOp codegen currently only works with matrix dimensions that are known at compile time");
}

Type matrixElementType = matrixType.getElementType();
Expand Down
12 changes: 8 additions & 4 deletions src/compiler/lowering/AggDimOpLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <utility>

#include "compiler/utils/LoweringUtils.h"
#include <util/ErrorHandler.h>

#include "ir/daphneir/Daphne.h"
#include "ir/daphneir/Passes.h"
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
Expand Down Expand Up @@ -100,8 +102,9 @@ class AggDimOpLowering : public OpConversionPattern<AggOp> {
ssize_t numCols = matrixType.getNumCols();

if (numRows < 0 || numCols < 0) {
return rewriter.notifyMatchFailure(
op, "aggDimOp codegen currently only works with matrix dimensions that are known at compile time");
throw ErrorHandler::compilerError(
loc, "AggDimOpLowering",
"aggDimOp codegen currently only works with matrix dimensions that are known at compile time");
}

Type matrixElementType = matrixType.getElementType();
Expand Down Expand Up @@ -236,8 +239,9 @@ class AggDimIdxOpLowering : public OpConversionPattern<AggOp> {
ssize_t numCols = matrixType.getNumCols();

if (numRows < 0 || numCols < 0) {
return rewriter.notifyMatchFailure(
op, "aggDimOp codegen currently only works with matrix dimensions that are known at compile time");
throw ErrorHandler::compilerError(
loc, "AggDimOpLowering",
"aggDimOp codegen currently only works with matrix dimensions that are known at compile time");
}

Type matrixElementType = matrixType.getElementType();
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/lowering/SparsityExploitationPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class SparsityExploitation final : public mlir::OpConversionPattern<daphne::AllA

if (sparseLhsRows < 0 || sparseLhsCols < 0 || denseLhsRows < 0 || denseLhsCols < 0 || denseRhsRows < 0 ||
denseRhsCols < 0) {
return rewriter.notifyMatchFailure(
op,
throw ErrorHandler::compilerError(
loc, "SparseExploitLowering",
"sparse exploit codegen currently only works with matrix dimensions that are known at compile time");
}

Expand Down
6 changes: 4 additions & 2 deletions src/compiler/lowering/TransposeOpLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "compiler/utils/LoweringUtils.h"
#include "ir/daphneir/Daphne.h"
#include "ir/daphneir/Passes.h"
#include <util/ErrorHandler.h>

#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
Expand Down Expand Up @@ -80,8 +81,9 @@ class TransposeOpLowering : public OpConversionPattern<daphne::TransposeOp> {
ssize_t numCols = matrixType.getNumCols();

if (numRows < 0 || numCols < 0) {
return rewriter.notifyMatchFailure(
op, "transposeOp codegen currently only works with matrix dimensions that are known at compile time");
throw ErrorHandler::compilerError(
loc, "TransposeOpLowering",
"transposeOp codegen currently only works with matrix dimensions that are known at compile time");
}

Value argMemref = rewriter.create<daphne::ConvertDenseMatrixToMemRef>(
Expand Down

0 comments on commit d6376f8

Please sign in to comment.