-
Notifications
You must be signed in to change notification settings - Fork 6
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
Wrong LDA instruction generated for addresses passed into functions #21
Comments
Bump. Actually, I was using the latest branch hsail-stable-3.7. |
This program is supposed to be rejected by the frontend and is for me with trunk clang: |
If I fix it to be global address space, I see an assert: 0 clang-3.7 0x00000001038984ee llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46 |
I have no idea what the expected behavior of pointer initializers with a constant is. I can fix the crash by printing the number in place of a symbol name, but initialization of a pointer is an undocumented extension pragma initvarwithaddress so I'm not sure what it's supposed to do in this case. |
It seems to work for me emitting ld_privates
|
I've pushed a new hsail-review-v4 branch with the asserts fixed. I've also cherry picked the fix to the hsail-stable-3.7 branch and repeated it for the BRIGAsmPrinter. I'm not seeing the wrong load/store emitted though. |
Thank you very much for your support Mark! I'm using the frontend from the IIRC, the reason for using the global variable
When compiling this kernel with
|
The reason why the kernel compiles successfully with |
It does not compile successfully with OpenCL 2.0. Global variables still need to have a specified address space, they can't be generic. |
I pulled your changes, but it doesn't fix the issue for me. You're right. My argument doesn't hold for variables with program scope. Though, the OpenCL C Specification (Version 2.0) says in section 6.5:
So it should compile. Anyways,if your compiler doesn't like it, just change the declaration to As I wrote in my previous post, the original version of the kernel exhibiting this bug doesn't use any pointers in program scope, but a pointer passed in as kernel argument (see kernel above). Unfortunately, the code generator crashes when I try to compile this kernel. It would be nice if this bug could also be investigated on. What about updating the front-end binaries in the Thanks for your support! |
Can you post your IR testcase? |
Here you find all the intermediate files of running
|
Any news one this issue? |
I'm using the latest HLC compiler from the branch hsail-review-v2.
Consider the following OpenCL program:
This OpenCL program gets compiled into the following HSAIL code:
In the kernel
__OpenCL_Bug_kernel
, the address of off
is obtained by using thelda_private_u32
instruction, which computes an address relative to the private segment. However, in the functionFunc
, a flatld
instruction is used to read from that address.Shouldn't either be the
lda
instruction flat, or theld
instruction private, so that the segments they refer to match?The text was updated successfully, but these errors were encountered: