Skip to content

Commit

Permalink
fix crashing due to block args not having a defining op
Browse files Browse the repository at this point in the history
  • Loading branch information
zjgarvey committed May 10, 2024
1 parent 03719af commit 684f924
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Dialect/Torch/Transforms/FuseQuantizedOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ class QuantizeOperandsPastCommutingOps : public OpRewritePattern<SrcOp> {

for (unsigned i : QuantInfo<SrcOp>::operandsToQuantize) {
Value operand = operands[i];
operand.dump();
std::stack<mlir::Operation *> commutingOpStack;
Value dequantOpd, MPTQTOpd;
for (unsigned k = 0; k < depth + 1; k++) {
auto currOp = operand.getDefiningOp();
// Case 0 : currOp is a nullptr (e.g., operand is a block argument)
if (!currOp)
break;
// Case 1 : currOp is a q commuting op (continue loop)
if (isQCommutingOp(currOp)) {
commutingOpStack.push(currOp);
Expand Down

0 comments on commit 684f924

Please sign in to comment.