[flang-commits] [flang] ea7d6a1 - [NFC][flang] Distinguish MATMUL and MATMUL-TRANSPOSE printouts.
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Fri Jul 21 12:57:06 PDT 2023
Author: Slava Zakharin
Date: 2023-07-21T12:56:50-07:00
New Revision: ea7d6a1bd6ca673ff8541859010ed8488d2ca859
URL: https://github.com/llvm/llvm-project/commit/ea7d6a1bd6ca673ff8541859010ed8488d2ca859
DIFF: https://github.com/llvm/llvm-project/commit/ea7d6a1bd6ca673ff8541859010ed8488d2ca859.diff
LOG: [NFC][flang] Distinguish MATMUL and MATMUL-TRANSPOSE printouts.
When MatmulTranpose reports incorrect shapes of the arguments
it cannot represent itself as MATMUL, because the reading
of the first argument's shape will be confusing.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D155911
Added:
Modified:
flang/runtime/matmul-transpose.cpp
Removed:
################################################################################
diff --git a/flang/runtime/matmul-transpose.cpp b/flang/runtime/matmul-transpose.cpp
index 345e3d8b41ac33..1a31ccc4591cd1 100644
--- a/flang/runtime/matmul-transpose.cpp
+++ b/flang/runtime/matmul-transpose.cpp
@@ -110,7 +110,8 @@ inline static void DoMatmulTranspose(
int yRank{y.rank()};
int resRank{xRank + yRank - 2};
if (xRank * yRank != 2 * resRank) {
- terminator.Crash("MATMUL: bad argument ranks (%d * %d)", xRank, yRank);
+ terminator.Crash(
+ "MATMUL-TRANSPOSE: bad argument ranks (%d * %d)", xRank, yRank);
}
SubscriptValue extent[2]{x.GetDimension(1).Extent(),
resRank == 2 ? y.GetDimension(1).Extent() : 0};
@@ -122,7 +123,8 @@ inline static void DoMatmulTranspose(
}
if (int stat{result.Allocate()}) {
terminator.Crash(
- "MATMUL: could not allocate memory for result; STAT=%d", stat);
+ "MATMUL-TRANSPOSE: could not allocate memory for result; STAT=%d",
+ stat);
}
} else {
RUNTIME_CHECK(terminator, resRank == result.rank());
@@ -134,7 +136,8 @@ inline static void DoMatmulTranspose(
}
SubscriptValue n{x.GetDimension(0).Extent()};
if (n != y.GetDimension(0).Extent()) {
- terminator.Crash("MATMUL: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
+ terminator.Crash(
+ "MATMUL-TRANSPOSE: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
static_cast<std::intmax_t>(x.GetDimension(0).Extent()),
static_cast<std::intmax_t>(x.GetDimension(1).Extent()),
static_cast<std::intmax_t>(y.GetDimension(0).Extent()),
@@ -163,7 +166,8 @@ inline static void DoMatmulTranspose(
}
// else V*M -> V (not allowed because TRANSPOSE() is only defined for rank
// 1 matrices
- terminator.Crash("MATMUL: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
+ terminator.Crash(
+ "MATMUL-TRANSPOSE: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
static_cast<std::intmax_t>(x.GetDimension(0).Extent()),
static_cast<std::intmax_t>(n),
static_cast<std::intmax_t>(y.GetDimension(0).Extent()),
@@ -231,7 +235,8 @@ inline static void DoMatmulTranspose(
}
} else { // V*M -> V
// TRANSPOSE(V) not allowed by fortran standard
- terminator.Crash("MATMUL: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
+ terminator.Crash(
+ "MATMUL-TRANSPOSE: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
static_cast<std::intmax_t>(x.GetDimension(0).Extent()),
static_cast<std::intmax_t>(n),
static_cast<std::intmax_t>(y.GetDimension(0).Extent()),
@@ -259,7 +264,7 @@ template <bool IS_ALLOCATING> struct MatmulTranspose {
CppTypeFor<YCAT, YKIND>>(result, x, y, terminator);
}
}
- terminator.Crash("MATMUL: bad operand types (%d(%d), %d(%d))",
+ terminator.Crash("MATMUL-TRANSPOSE: bad operand types (%d(%d), %d(%d))",
static_cast<int>(XCAT), XKIND, static_cast<int>(YCAT), YKIND);
}
};
More information about the flang-commits
mailing list