-
Notifications
You must be signed in to change notification settings - Fork 179
[CIR][HIP] Lower Device CIR to LLVM IR #1967
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
base: main
Are you sure you want to change the base?
Conversation
|
@bcardosolopes this code interleaves alloca's with address space casts. Is this allowed? Or should I add the allocas at the function entry point? |
| @@ -0,0 +1,72 @@ | |||
| //===- AMDGPU.cpp - TargetInfo for AMDGPU | |||
| //-----------------------------------===// | |||
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.
80-cols
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.
Nice catch! Fixed
| @@ -0,0 +1,19 @@ | |||
| #include "../Inputs/cuda.h" | |||
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.
nit: pass -I ../Inputs in the invocation below and just use #include "cuda.h"
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.
Fixed
| @@ -0,0 +1,19 @@ | |||
| #include "../Inputs/cuda.h" | |||
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.
Similar comment from above
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.
Fixed
| j = i; | ||
| } | ||
|
|
||
| // CIR: cir.global "private" internal dso_local addrspace(offload_local) @_ZZ2fnvE1j : !s32i |
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.
Please also add LLVM checks for lowering here, and add OGCG for tracking classic codegen alongside (see clang/test/CIR/CodeGen/CUDA/cuda-builtin-vars.cu as an example). Same for the other tests!
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.
Fixed
The allocas should already be at the function entry BB, are you seeing anything different? How does the final LLVM IR looks like? We should try to emit it to be the most similar as possible, but intermingling them within the function entry BB doesn't seem too problematic. |
Here is the device code generated for a device function through clangir: Here is OG: Both codes as far as I can tell are equivalent and should be fine. |
No description provided.