From 2afe7f10c23d7b7413c4ffc9c50eeaa303e7ea8d Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Tue, 18 Mar 2025 14:53:15 -0700 Subject: [PATCH] [flang][cuda] Check for ignore_tkr(d) when resolving generic call --- flang/lib/Support/Fortran.cpp | 3 +++ flang/test/Semantics/cuf13.cuf | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/flang/lib/Support/Fortran.cpp b/flang/lib/Support/Fortran.cpp index 746b7c9740728..f91c72d96fc97 100644 --- a/flang/lib/Support/Fortran.cpp +++ b/flang/lib/Support/Fortran.cpp @@ -111,6 +111,9 @@ bool AreCompatibleCUDADataAttrs(std::optional x, bool isCudaUnified{features ? features->IsEnabled(common::LanguageFeature::CudaUnified) : false}; + if (ignoreTKR.test(common::IgnoreTKR::Device)) { + return true; + } if (!x && !y) { return true; } else if (x && y && *x == *y) { diff --git a/flang/test/Semantics/cuf13.cuf b/flang/test/Semantics/cuf13.cuf index dafcffa5e93bd..ab8e60cabdf5e 100644 --- a/flang/test/Semantics/cuf13.cuf +++ b/flang/test/Semantics/cuf13.cuf @@ -8,6 +8,13 @@ module matching module procedure sub_unified end interface + interface + subroutine ignore(a) + !dir$ ignore_tkr(d) a + integer, managed :: a(:) + end subroutine + end interface + contains subroutine sub_host(a) integer :: a(:) @@ -43,9 +50,11 @@ program m call sub(u) ! Should resolve to sub_unified call sub(d) ! Should resolve to sub_device + call ignore(a) end ! CHECK: CALL sub_host ! CHECK: CALL sub_managed ! CHECK: CALL sub_unified ! CHECK: CALL sub_device +! CHECK: CALL ignore