[TorchToLinalg] Drop constexpr from ifs in argmin/max.dim (#2617)

MSVC-19 does not support constexprs of lambda captured constexpr values
like this: https://godbolt.org/z/ej65rMzdr
Instead, this just drops the constexpr from the if statements.

See the discussion in
https://discord.com/channels/689900678990135345/1062405112292712499/1182338050664185999
pull/2623/head
Quinn Dawkins 2023-12-07 13:08:17 -05:00 committed by GitHub
parent 141202bc01
commit 63505ad6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ public:
Value resultVal, predicate; Value resultVal, predicate;
if (inElementType.isa<mlir::FloatType>()) { if (inElementType.isa<mlir::FloatType>()) {
arith::CmpFPredicate predType; arith::CmpFPredicate predType;
if constexpr (isMax) { if (isMax) {
predType = arith::CmpFPredicate::OGT; predType = arith::CmpFPredicate::OGT;
resultVal = rewriter.create<arith::MaximumFOp>( resultVal = rewriter.create<arith::MaximumFOp>(
nestedLoc, newValue, oldValue); nestedLoc, newValue, oldValue);
@ -201,7 +201,7 @@ public:
newValue, oldValue); newValue, oldValue);
} else { } else {
arith::CmpIPredicate predType; arith::CmpIPredicate predType;
if constexpr (isMax) { if (isMax) {
predType = arith::CmpIPredicate::sgt; predType = arith::CmpIPredicate::sgt;
resultVal = rewriter.create<arith::MaxSIOp>(nestedLoc, newValue, resultVal = rewriter.create<arith::MaxSIOp>(nestedLoc, newValue,
oldValue); oldValue);