Skip to content

Compilation Aborted (core dumped) #65155

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

Closed
ajarmusch opened this issue Aug 31, 2023 · 5 comments · Fixed by #65847
Closed

Compilation Aborted (core dumped) #65155

ajarmusch opened this issue Aug 31, 2023 · 5 comments · Fixed by #65847
Labels
backend:AMDGPU crash Prefer [crash-on-valid] or [crash-on-invalid] good first issue https://github.com/llvm/llvm-project/contribute

Comments

@ajarmusch
Copy link
Contributor

Getting an Aborted (core dumped) from compiling with clang. You can reproduce the core dump with the attached reduced.ll file using opt -p globalopt reduced.ll

reduced.ll:

; ModuleID = 'reduced.bc'
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8"
target triple = "amdgcn-amd-amdhsa"

@x = internal global i32 poison

; Function Attrs: norecurse
define amdgpu_kernel void @__omp_offloading_10306_92b48f5_test_uses_allocators_large_cap_l31(i32 %0) #0 {
entry:
  store i32 %0, ptr @x, align 4
  ret void
}

attributes #0 = { norecurse }
@ajarmusch ajarmusch added openmp crash Prefer [crash-on-valid] or [crash-on-invalid] labels Aug 31, 2023
@llvmbot
Copy link
Member

llvmbot commented Aug 31, 2023

@llvm/issue-subscribers-openmp

@llvmbot
Copy link
Member

llvmbot commented Sep 1, 2023

@llvm/issue-subscribers-backend-amdgpu

@jdoerfert jdoerfert added the good first issue https://github.com/llvm/llvm-project/contribute label Sep 1, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 1, 2023

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Assign the issue to you.
  2. Fix the issue locally.
  3. Run the test suite locally.
    3.1) Remember that the subdirectories under test/ create fine-grained testing targets, so you can
    e.g. use make check-clang-ast to only run Clang's AST tests.
  4. Create a git commit
  5. Run git clang-format HEAD~1 to format your changes.
  6. Submit the patch to Phabricator.
    6.1) Detailed instructions can be found here

For more instructions on how to submit a patch to LLVM, see our documentation.

If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue.

@llvm/issue-subscribers-good-first-issue

@jdoerfert
Copy link
Member

jdoerfert commented Sep 1, 2023

The code is semi-valid, we should not crash. The reason is that we replace the AS(0) global with one in AS(5), due to the data layout. This is a good beginner issue as one "simply" needs to add a AS cast before the RAUW operation in processGlobal (globalsopt pass).

That all said, we need to find out when the AS(0) global was added in the first place and fix that as well.

Godbold: https://godbolt.org/z/5e4K5cGcE

@arsenm
Copy link
Contributor

arsenm commented Sep 1, 2023

One does not simply introduce new addrspacecasts without target knowledge

tylanphear added a commit that referenced this issue Sep 9, 2023
Fix crash on RAUW due to locals and globals having different address
spaces. This is the intent of the original code, but it assumes the
alloca address space is 0. This patch fixes the code to check that the
global's address space matches `DL.getAllocaAddrSpace()` instead.

Fixes #65155
@Endilll Endilll changed the title [Clang][OpenMP] Compilation Aborted (core dumped) Compilation Aborted (core dumped) Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AMDGPU crash Prefer [crash-on-valid] or [crash-on-invalid] good first issue https://github.com/llvm/llvm-project/contribute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants