-
Notifications
You must be signed in to change notification settings - Fork 803
[HIP][CodeGen] Making local variable use correct address space for CGDecl #5374
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. The change LGTM, but could you please add a test?
Also, please note that HIP AMD GPU Test Suite is failing (with some of tests xpassing though).
|
Here is PR for removing XFAILs in test suite intel/llvm-test-suite#763 |
…as UndefValue and has addrspace(3)
|
Test added in |
Fznamznon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
smanna12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@hdelan, I think we need to disable |
Thanks, change made in intel/llvm-test-suite#763 |
The code:
Was failing for the HIP backend.
The variable
floois in local memory. Since the default address space for variables isprivate, the address space needs to be changed tolocal. The lineLangAS AS = GetGlobalVarAddressSpace(&D);correctly gets the appropriate address space. However, when checking for the value of the address space, the new address space is not used, rather the old oneThis results in
floobeing initialized asWhich is incorrect. Instead of
On AMD,
floonot being anUndefValuethrows an assert later on in the compilation chain inllvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cppTherefore it is necessary to use the address space returned by
GetGlobalVarAddressSpace(&D), instead of the default address space when seeing whether the variable should be initialized as an UndefValue or a NullConstant. This results in the proper initialization of this kind of local variable as anUndefValuecc @npmiller