Skip to content

Commit

Permalink
[TorchToLinalg] Drop constexpr from ifs in argmin/max.dim (llvm#2617)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
qedawkins authored Dec 7, 2023
1 parent 141202b commit 63505ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Conversion/TorchToLinalg/Reduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ConvertAtenMinMaxDimOp : public OpConversionPattern<OpTy> {
Value resultVal, predicate;
if (inElementType.isa<mlir::FloatType>()) {
arith::CmpFPredicate predType;
if constexpr (isMax) {
if (isMax) {
predType = arith::CmpFPredicate::OGT;
resultVal = rewriter.create<arith::MaximumFOp>(
nestedLoc, newValue, oldValue);
Expand All @@ -201,7 +201,7 @@ class ConvertAtenMinMaxDimOp : public OpConversionPattern<OpTy> {
newValue, oldValue);
} else {
arith::CmpIPredicate predType;
if constexpr (isMax) {
if (isMax) {
predType = arith::CmpIPredicate::sgt;
resultVal = rewriter.create<arith::MaxSIOp>(nestedLoc, newValue,
oldValue);
Expand Down

0 comments on commit 63505ad

Please sign in to comment.