-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Crash asking me to report it here #96135
Comments
Update: even when I remove everything related to openmp in the function that is indicated in the crash report, it still crashs and apparently in the same function |
@llvm/issue-subscribers-clang-codegen Author: Line (Line-fr)
Hi, I have been trying to port my code to openMP recently and while it seemed to work fine for the first part of my code, for the second, I made it quite unhappy. Instead of getting a proper error allowing me to know what to do about it, it crashed giving me this: (the files do not have the exact same name but from a previous compilation without any modification
compilation command: clang++ main.cpp -fopenmp --offload-arch=gfx90a I hope you will be able to solve this crash for the future nice error messages by my side, I am gonna try to solve it blindly |
Could you please try 18 or |
HI Thank you for your reply, I am gonna try recompiling it but I have never done such thing and I am not a sudo user in the server in question. I will keep you in touch of my progress for this compilation and using of another llvm version |
Okay I succeeded and got the error again:
|
I found why in my code! It was not in the function printed by the error. I don't know if it is supposed to make such a crash but #pragma omp parallel for reduction(+:allresults[0: (2*localqbits)]) breaks it #pragma omp parallel for reduction(+:allresults[0:64]) works This new functionnality of openMP 4.5 allowing to reduce arrays seems to break on non compiling time constant size array I hope this issue was not useless to you, sorry for the time |
It's absolutely not. We shouldn't be crashing on both good inputs and bad inputs, so there's something to fix here. |
@llvm/issue-subscribers-openmp Author: Line (Line-fr)
Hi, I have been trying to port my code to openMP recently and while it seemed to work fine for the first part of my code, for the second, I made it quite unhappy. Instead of getting a proper error allowing me to know what to do about it, it crashed giving me this: (the files do not have the exact same name but from a previous compilation without any modification
compilation command: clang++ main.cpp -fopenmp --offload-arch=gfx90a I hope you will be able to solve this crash for the future nice error messages by my side, I am gonna try to solve it blindly |
The compiler should never crash like this. It would be very helpful if you could create a small reproducer and either post it here or through https://godbolt.org/. |
Hi, it was not so easy to isolate exactly at first but by copying my code and removing progressively, I ended up reducing it drastically!
#include<omp.h>
#include<iostream>
using namespace std;
int main(){
int localqbits = 7;
double allresults[64]; //allocating on gpu or not do not change anything, allresults just needs to be a pointer
#pragma omp target device(0) is_device_ptr(allresults)
{
#pragma omp parallel for reduction(+:allresults[0:2*localqbits])
for (int m = 0; m < 1; m++){
}
}
return 0;
} Note that if I add "const int localqbits" it stops crashing. the bug is on the default clang of my system. Here is how I compiled main branch to test again:
result of compilation checks
It crashes on main branch too I hope that it helped you and that I did a good enough job at reducing it! |
@Line-fr Thank you, you did a good job!
Clang 18.1.0 crash:
|
If you compile it with an NVPTX architecture you get a warning bout VLAs.
I wonder why you don't need this in the AMDGPU version, considering we don't fully support VLAs there either. |
FWIW, this works if you make the |
Hi all! I saw this just recently on a recent rocm installation with the provided clang, but obviously it's an upstream bug. #include <malloc.h>
int main(int argc, char* argv[])
{
int* arr = (int*) malloc(1000 * sizeof(int));
#pragma omp target enter data map(alloc: arr[0:1000])
#pragma omp target teams distribute parallel for
for(int i=0; i<1000; i++) { arr[i] = -1.0; }
int len = 1000;
#pragma omp target teams distribute parallel for reduction(+:arr[0:len])
for(int i = 0; i < 1000; i++)
arr[i] += 1;
} See also https://godbolt.org/z/xEGxYYfrv |
Hi, I have been trying to port my code to openMP recently and while it seemed to work fine for the first part of my code, for the second, I made it quite unhappy. Instead of getting a proper error allowing me to know what to do about it, it crashed giving me this: (the files do not have the exact same name but from a previous compilation without any modification
compilation command: clang++ main.cpp -fopenmp --offload-arch=gfx90a
I use MI250x with rocm which worked well with openmp up to now
errormessage.txt
main-bd92e5.zip
I hope you will be able to solve this crash for the future nice error messages by my side, I am gonna try to solve it blindly
Thank you
The text was updated successfully, but these errors were encountered: