[Torch] Disable 1-d quantized convolution (#3601)

To fix https://github.com/nod-ai/SHARK-Turbine/issues/253#issuecomment-2271815640
Prevent fusion for 1d convolution ops and just do it as an f32 conv
since there isn't a linalg named op for quantized 1-d convolution yet.  
Get 24 onnx eca* models passed in iree-comiple.
pull/3607/head
Chi_Liu 2024-08-07 09:01:16 -07:00 committed by GitHub
parent 2d6bfb2dec
commit a51b4e014a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,15 @@ public:
llvm::SmallVector<Value> operands(op->getOperands()); llvm::SmallVector<Value> operands(op->getOperands());
bool dequanted = false; bool dequanted = false;
// Prevent fusion for 1d convolution ops and just do it as an f32 conv since
// there isn't a linalg named op for quantized 1-d convolution yet.
// TODO: Remove this and add support for 1-d quantized convolution.
int64_t inputRank =
cast<ValueTensorType>(operands[0].getType()).getSizes().size();
if (isa<Torch::AtenConvolutionOp>(op) && inputRank < 4)
return rewriter.notifyMatchFailure(
op, "1-d quantized convolution is not supported");
for (unsigned i : QuantInfo<SrcOp>::operandsToQuantize) { for (unsigned i : QuantInfo<SrcOp>::operandsToQuantize) {
Value operand = operands[i]; Value operand = operands[i];
std::stack<mlir::Operation *> commutingOpStack; std::stack<mlir::Operation *> commutingOpStack;