Skip to content
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

[Debug] Assertion failure in llvm #781

Closed
kiranchandramohan opened this issue Aug 22, 2019 · 7 comments
Closed

[Debug] Assertion failure in llvm #781

kiranchandramohan opened this issue Aug 22, 2019 · 7 comments
Labels
bug nvidia verify This issue appears to be resolved.

Comments

@kiranchandramohan
Copy link
Collaborator

kiranchandramohan commented Aug 22, 2019

Compiling the following code with "-g" leads to assertion failure on the release_70 branch of LLVM.

module mod_vars1
  type outpatch_list
    integer, allocatable, dimension(:) :: patch_list
  end type outpatch_list
end module

The assertion failure is likely due to DIFortranSubrange taking a DIDerivedType for lowerBound and upperBound instead of a DIVariable.

!14 = !DIDerivedType(tag: DW_TAG_member, file: !3, scope: !13, name: "patch_list$sd", size: 1024, align: 64, offset: 128, baseType: !28)
!15 = !DIExpression(DW_OP_plus_uconst, 80, DW_OP_deref)
!16 = !DIExpression(DW_OP_dup, DW_OP_plus_uconst, 80, DW_OP_deref, DW_OP_swap, DW_OP_plus_uconst, 88, DW_OP_deref, DW_OP_plus, DW_OP_constu, 1, DW_OP_minus)
!17 = !DIFortranSubrange(lowerBound: !14, lowerBoundExpression: !15, upperBound: !14, upperBoundExpression: !16)

Note:

  1. This issue was exposed after merging "Improve LLVM debug metadata"
    a322f86
  2. It might have been introduced by "Add debug support for allocatable within modules"
    65863b1
@gklimowicz
Copy link
Contributor

gklimowicz commented Aug 28, 2019

@jiel-nv Can you take a look at this? It may be fixed in a set of changes that are not yet in Flang.

@kiranchandramohan says this LLVM assertion failure happens with other cases as well.

@kiranchandramohan
Copy link
Collaborator Author

@gklimowicz Do you have an update on this issue? Please let me know if you need additional info.

I would like to know,

  1. Can you reproduce the issue?
  2. Is this issue already fixed and the fix is in your queue?
  3. Is there an extension to LLVM metadata to support debug for allocatables in derived types?

@jiel-nv
Copy link

jiel-nv commented Sep 11, 2019

I'm not able to reproduce the reported assertion failure.

And the debug support for allocatable in derived types is working in progress.

@kiranchandramohan
Copy link
Collaborator Author

I am able to reproduce the issue with the following build script. The script builds LLVM with assertions and builds flang with FLANG_LLVM_EXTENSIONS.

Note: You will have to exclude/revert the last PR merge to avoid a build failure.
commit ca301c3
Merge: a0a67c5 a32d3ab
Author: Steve Scalpone sscalpone@nvidia.com
Date: Wed Sep 11 13:53:16 2019 -0700
Merge pull request #795 from ThePortlandGroup/nv_stage
Pull 2019-09-11T13-10 Recent NVIDIA Changes

INSTALL_DIR=$PWD
cd $INSTALL_DIR
git clone https://github.com/flang-compiler/llvm.git
cd llvm
git checkout release_80
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_CONFIG=$INSTALL_DIR/bin/llvm-config  ..
make -j24
make install

cd $INSTALL_DIR
git clone https://github.com/flang-compiler/flang-driver.git
cd flang-driver
git checkout release_80
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_CONFIG=$INSTALL_DIR/bin/llvm-config  ..
make -j24
make install

cd $INSTALL_DIR
git clone https://github.com/llvm-mirror/openmp.git
cd openmp/runtime
git checkout release_80
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_CONFIG=$INSTALL_DIR/bin/llvm-config -DCMAKE_CXX_COMPILER=$INSTALL_DIR/bin/clang++ -DCMAKE_C_COMPILER=$INSTALL_DIR/bin/clang  ../..
make -j24
make install

cd $INSTALL_DIR
git clone https://github.com/flang-compiler/flang.git

cd $INSTALL_DIR
cd flang/runtime/libpgmath
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_CONFIG=$INSTALL_DIR/bin/llvm-config -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran ..
make -j24
make install

cd $INSTALL_DIR
cd flang
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DFLANG_LLVM_EXTENSIONS=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_CONFIG=$INSTALL_DIR/bin/llvm-config -DCMAKE_CXX_COMPILER=$INSTALL_DIR/bin/clang++ -DCMAKE_C_COMPILER=$INSTALL_DIR/bin/clang  -DCMAKE_Fortran_COMPILER=$INSTALL_DIR/bin/flang -DLLVM_LIT_OUTPUT_DIR=$INSTALL_DIR/llvm/build/bin ..
make -j24
make install

@jiel-nv
Copy link

jiel-nv commented Sep 30, 2019

Investigated, once the debug info support for allocatable in derived type gets merged in (currently in queue), this issue will be resolved.

@kiranchandramohan
Copy link
Collaborator Author

Thanks @jiel-nv.

@jiel-nv jiel-nv added the verify This issue appears to be resolved. label Oct 10, 2019
@kiranchandramohan
Copy link
Collaborator Author

I can confirm that the assertion failure has been fixed. Thanks @gklimowicz, @jiel-nv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug nvidia verify This issue appears to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants