Skip to content

Revert "[flang][cuda] Add c_devptr and bypass output semantic check" #107349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

clementval
Copy link
Contributor

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir flang:semantics labels Sep 5, 2024
@clementval clementval merged commit abbcfff into main Sep 5, 2024
8 of 10 checks passed
@clementval clementval deleted the revert-107318-cuf_devptr branch September 5, 2024 04:16
@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2024

@llvm/pr-subscribers-flang-fir-hlfir

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

Reverts llvm/llvm-project#107318

It breaks a test https://lab.llvm.org/buildbot/#/builders/143/builds/1933


Full diff: https://github.com/llvm/llvm-project/pull/107349.diff

3 Files Affected:

  • (modified) flang/lib/Semantics/check-io.cpp (-5)
  • (modified) flang/module/__fortran_builtins.f90 (-4)
  • (removed) flang/test/Lower/CUDA/cuda-devptr.cuf (-16)
diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp
index d7d2f0fa322cbb..54e8e09cbf7e48 100644
--- a/flang/lib/Semantics/check-io.cpp
+++ b/flang/lib/Semantics/check-io.cpp
@@ -1171,11 +1171,6 @@ parser::Message *IoChecker::CheckForBadIoType(const evaluate::DynamicType &type,
             "Derived type '%s' in I/O may not be polymorphic unless using defined I/O"_err_en_US,
             derived.name());
       }
-      if (IsBuiltinDerivedType(&derived, "c_ptr") ||
-          IsBuiltinDerivedType(&derived, "c_devptr")) {
-        // Bypass the check below for c_ptr and c_devptr.
-        return nullptr;
-      }
       if (const Symbol *
           bad{FindInaccessibleComponent(which, derived, scope)}) {
         return &context_.Say(where,
diff --git a/flang/module/__fortran_builtins.f90 b/flang/module/__fortran_builtins.f90
index a9d3ac897eb583..44b0f17339cd96 100644
--- a/flang/module/__fortran_builtins.f90
+++ b/flang/module/__fortran_builtins.f90
@@ -102,10 +102,6 @@
     __builtin_threadIdx, __builtin_blockDim, __builtin_blockIdx, &
     __builtin_gridDim
   integer, parameter, public :: __builtin_warpsize = 32
-  
-  type, public, bind(c) :: __builtin_c_devptr
-    type(__builtin_c_ptr) :: cptr
-  end type
 
   intrinsic :: __builtin_fma
   intrinsic :: __builtin_ieee_is_nan, __builtin_ieee_is_negative, &
diff --git a/flang/test/Lower/CUDA/cuda-devptr.cuf b/flang/test/Lower/CUDA/cuda-devptr.cuf
deleted file mode 100644
index 4e11e3c0fc8f85..00000000000000
--- a/flang/test/Lower/CUDA/cuda-devptr.cuf
+++ /dev/null
@@ -1,16 +0,0 @@
-! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
-
-! Test CUDA Fortran specific type
-
-subroutine sub1()
-  use iso_c_binding
-  use __fortran_builtins, only : c_devptr => __builtin_c_devptr
-
-  type(c_ptr) :: ptr
-  type(c_devptr) :: dptr
-  print*,ptr
-  print*,dptr
-end
-
-! CHECK-LABEL: func.func @_QPsub1()
-! CHECK-COUNT-2: %{{.*}} = fir.call @_FortranAioOutputDerivedType

@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2024

@llvm/pr-subscribers-flang-semantics

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

Reverts llvm/llvm-project#107318

It breaks a test https://lab.llvm.org/buildbot/#/builders/143/builds/1933


Full diff: https://github.com/llvm/llvm-project/pull/107349.diff

3 Files Affected:

  • (modified) flang/lib/Semantics/check-io.cpp (-5)
  • (modified) flang/module/__fortran_builtins.f90 (-4)
  • (removed) flang/test/Lower/CUDA/cuda-devptr.cuf (-16)
diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp
index d7d2f0fa322cbb..54e8e09cbf7e48 100644
--- a/flang/lib/Semantics/check-io.cpp
+++ b/flang/lib/Semantics/check-io.cpp
@@ -1171,11 +1171,6 @@ parser::Message *IoChecker::CheckForBadIoType(const evaluate::DynamicType &type,
             "Derived type '%s' in I/O may not be polymorphic unless using defined I/O"_err_en_US,
             derived.name());
       }
-      if (IsBuiltinDerivedType(&derived, "c_ptr") ||
-          IsBuiltinDerivedType(&derived, "c_devptr")) {
-        // Bypass the check below for c_ptr and c_devptr.
-        return nullptr;
-      }
       if (const Symbol *
           bad{FindInaccessibleComponent(which, derived, scope)}) {
         return &context_.Say(where,
diff --git a/flang/module/__fortran_builtins.f90 b/flang/module/__fortran_builtins.f90
index a9d3ac897eb583..44b0f17339cd96 100644
--- a/flang/module/__fortran_builtins.f90
+++ b/flang/module/__fortran_builtins.f90
@@ -102,10 +102,6 @@
     __builtin_threadIdx, __builtin_blockDim, __builtin_blockIdx, &
     __builtin_gridDim
   integer, parameter, public :: __builtin_warpsize = 32
-  
-  type, public, bind(c) :: __builtin_c_devptr
-    type(__builtin_c_ptr) :: cptr
-  end type
 
   intrinsic :: __builtin_fma
   intrinsic :: __builtin_ieee_is_nan, __builtin_ieee_is_negative, &
diff --git a/flang/test/Lower/CUDA/cuda-devptr.cuf b/flang/test/Lower/CUDA/cuda-devptr.cuf
deleted file mode 100644
index 4e11e3c0fc8f85..00000000000000
--- a/flang/test/Lower/CUDA/cuda-devptr.cuf
+++ /dev/null
@@ -1,16 +0,0 @@
-! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
-
-! Test CUDA Fortran specific type
-
-subroutine sub1()
-  use iso_c_binding
-  use __fortran_builtins, only : c_devptr => __builtin_c_devptr
-
-  type(c_ptr) :: ptr
-  type(c_devptr) :: dptr
-  print*,ptr
-  print*,dptr
-end
-
-! CHECK-LABEL: func.func @_QPsub1()
-! CHECK-COUNT-2: %{{.*}} = fir.call @_FortranAioOutputDerivedType

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 5, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building flang at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/7927

Here is the relevant piece of the build log for the reference
Step 6 (build-unified-tree) failure: build (failure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants