-
Notifications
You must be signed in to change notification settings - Fork 189
[CIR][AMDGPU] Add module flags for AMDGPU target #2100
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
|
CC: @bcardosolopes, @xlauko |
bcardosolopes
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.
Overall makes sense, some nits
| } | ||
|
|
||
| if (getTriple().isAMDGPU()) { | ||
| if (target.getTargetOpts().CodeObjectVersion != |
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.
Create a emitAMDGPUMetadata (similar to emitOpenCLMetadata) and add this code over there.
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 feedback. Have updated PR to use emitAMDGPUMetadata() instead.
| if (target.getTargetOpts().CodeObjectVersion != | ||
| llvm::CodeObjectVersionKind::COV_None) { | ||
| theModule->setAttr( | ||
| "cir.amdhsa_code_object_version", |
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.
The name of these attributes shouldn't be hardcoded, please use something akin to getOpenCLVersionAttrName here and in the one below.
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.
getAMDGPUCodeObjectVersionAttrName()
getAMDGPUPrintfKindAttrName()
above methods have been added for querying the attr names.
22f67af to
83c22c0
Compare
This PR adds support to emit AMDGPU-specific module flags
amdhsa_code_object_versionandamdgpu_printf_kindto match OGCG behavior.In CIRGenModule, the flags are stored as CIR module attributes:
During lowering to LLVM IR (in LowerToLLVMIR.cpp), these attributes are converted to LLVM module flags.