Skip to content

Commit

Permalink
bugfix else (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Mar 10, 2024
1 parent 57ddcc2 commit e652346
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/enzyme_ad/jax/Passes/EnzymeHLOOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

#include "mlir/Dialect/CommonFolders.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"

#define DEBUG_TYPE "enzyme"

Expand Down Expand Up @@ -156,8 +157,7 @@ struct SlicePad final : OpRewritePattern<mlir::stablehlo::SliceOp> {
op.getLoc(), pad.getOperand(), start, end, step);
rewriter.replaceOpWithNewOp<stablehlo::PadOp>(
op, nslice, pad.getPaddingValue(), lpads, hpads, interiors);
}
{
} else {
rewriter.replaceOpWithNewOp<stablehlo::SliceOp>(op, pad.getOperand(),
start, end, step);
}
Expand Down
4 changes: 4 additions & 0 deletions src/enzyme_ad/jax/Passes/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ namespace mhlo {
class MhloDialect;
} // end namespace mhlo

namespace tensor {
class TensorDialect;
} // namespace tensor

namespace stablehlo {
class StablehloDialect;
} // namespace stablehlo
Expand Down
3 changes: 2 additions & 1 deletion src/enzyme_ad/jax/Passes/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def ArithRaisingPass : Pass<"arith-raise"> {
def EnzymeHLOOptPass : Pass<"enzyme-hlo-opt"> {
let summary = "Optimize stablehlo";
let dependentDialects = [
"stablehlo::StablehloDialect"
"stablehlo::StablehloDialect",
"tensor::TensorDialect"
];
let constructor = "mlir::enzyme::createEnzymeHLOOptPass()";
}
Expand Down

0 comments on commit e652346

Please sign in to comment.