From 1ab3a4f234e38904f9935d02a696a52d1e5dff71 Mon Sep 17 00:00:00 2001 From: Slava Zakharin Date: Tue, 1 Apr 2025 08:04:45 -0700 Subject: [PATCH] [flang-rt][NFC] Work around CTK12.8 compilation failure. (#133833) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- flang-rt/lib/runtime/matmul-transpose.cpp | 3 ++- flang-rt/lib/runtime/matmul.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flang-rt/lib/runtime/matmul-transpose.cpp b/flang-rt/lib/runtime/matmul-transpose.cpp index e20abbdddcd3..8666167e1947 100644 --- a/flang-rt/lib/runtime/matmul-transpose.cpp +++ b/flang-rt/lib/runtime/matmul-transpose.cpp @@ -331,6 +331,7 @@ template ; + using ResultTy = Fortran::common::optional>; RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x, const Descriptor &y, const char *sourceFile, int line) const { Terminator terminator{sourceFile, line}; @@ -339,7 +340,7 @@ struct MatmulTransposeHelper { RUNTIME_CHECK(terminator, xCatKind.has_value() && yCatKind.has_value()); RUNTIME_CHECK(terminator, xCatKind->first == XCAT); RUNTIME_CHECK(terminator, yCatKind->first == YCAT); - if constexpr (constexpr auto resultType{ + if constexpr (constexpr ResultTy resultType{ GetResultType(XCAT, XKIND, YCAT, YKIND)}) { return DoMatmulTransposefirst, resultType->second, CppTypeFor, CppTypeFor>( diff --git a/flang-rt/lib/runtime/matmul.cpp b/flang-rt/lib/runtime/matmul.cpp index f14cea922d21..693e51082bd4 100644 --- a/flang-rt/lib/runtime/matmul.cpp +++ b/flang-rt/lib/runtime/matmul.cpp @@ -424,6 +424,7 @@ static inline RT_API_ATTRS void DoMatmul( template struct MatmulHelper { + using ResultTy = Fortran::common::optional>; using ResultDescriptor = std::conditional_t; RT_API_ATTRS void operator()(ResultDescriptor &result, const Descriptor &x, @@ -439,7 +440,7 @@ struct MatmulHelper { xCatKind->first == TypeCategory::Unsigned) && (yCatKind->first == TypeCategory::Integer || yCatKind->first == TypeCategory::Unsigned)))); - if constexpr (constexpr auto resultType{ + if constexpr (constexpr ResultTy resultType{ GetResultType(XCAT, XKIND, YCAT, YKIND)}) { return DoMatmulfirst, resultType->second, CppTypeFor, CppTypeFor>(