Skip to content

Commit 1ab3a4f

Browse files
authored
[flang-rt][NFC] Work around CTK12.8 compilation failure. (#133833)
It happened in https://lab.llvm.org/buildbot/#/builders/152/builds/1131 when the buildbot was switched from CTK12.3 to CTK12.8. The logs are gone by now, so the above link is useless. The error was: error: ‘auto’ not permitted in template argument This workaround helps, but I also reported the issue to NVCC devs.
1 parent 4e6c48f commit 1ab3a4f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

flang-rt/lib/runtime/matmul-transpose.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ template <bool IS_ALLOCATING, TypeCategory XCAT, int XKIND, TypeCategory YCAT,
331331
struct MatmulTransposeHelper {
332332
using ResultDescriptor =
333333
std::conditional_t<IS_ALLOCATING, Descriptor, const Descriptor>;
334+
using ResultTy = Fortran::common::optional<std::pair<TypeCategory, int>>;
334335
RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x,
335336
const Descriptor &y, const char *sourceFile, int line) const {
336337
Terminator terminator{sourceFile, line};
@@ -339,7 +340,7 @@ struct MatmulTransposeHelper {
339340
RUNTIME_CHECK(terminator, xCatKind.has_value() && yCatKind.has_value());
340341
RUNTIME_CHECK(terminator, xCatKind->first == XCAT);
341342
RUNTIME_CHECK(terminator, yCatKind->first == YCAT);
342-
if constexpr (constexpr auto resultType{
343+
if constexpr (constexpr ResultTy resultType{
343344
GetResultType(XCAT, XKIND, YCAT, YKIND)}) {
344345
return DoMatmulTranspose<IS_ALLOCATING, resultType->first,
345346
resultType->second, CppTypeFor<XCAT, XKIND>, CppTypeFor<YCAT, YKIND>>(

flang-rt/lib/runtime/matmul.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ static inline RT_API_ATTRS void DoMatmul(
424424
template <bool IS_ALLOCATING, TypeCategory XCAT, int XKIND, TypeCategory YCAT,
425425
int YKIND>
426426
struct MatmulHelper {
427+
using ResultTy = Fortran::common::optional<std::pair<TypeCategory, int>>;
427428
using ResultDescriptor =
428429
std::conditional_t<IS_ALLOCATING, Descriptor, const Descriptor>;
429430
RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x,
@@ -439,7 +440,7 @@ struct MatmulHelper {
439440
xCatKind->first == TypeCategory::Unsigned) &&
440441
(yCatKind->first == TypeCategory::Integer ||
441442
yCatKind->first == TypeCategory::Unsigned))));
442-
if constexpr (constexpr auto resultType{
443+
if constexpr (constexpr ResultTy resultType{
443444
GetResultType(XCAT, XKIND, YCAT, YKIND)}) {
444445
return DoMatmul<IS_ALLOCATING, resultType->first, resultType->second,
445446
CppTypeFor<XCAT, XKIND>, CppTypeFor<YCAT, YKIND>>(

0 commit comments

Comments
 (0)