-
Notifications
You must be signed in to change notification settings - Fork 510
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
[XLA:GPU] Add SPIRV-LLVM-Translator and translation pass #11424
Conversation
Hi @penpornk , could you please review this PR? Thanks. |
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.
Thank you for the PR and sorry for the delay!
- SPIRAS_Private, | ||
+ SPIRAS_Generic, | ||
SPIRAS_Global, | ||
- SPIRAS_Constant, | ||
+ SPIRAS_Internal, | ||
SPIRAS_Local, | ||
- SPIRAS_Generic, | ||
+ SPIRAS_Constant, | ||
+ SPIRAS_Private, |
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.
Just curious, why do we need to reorder them?
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.
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.
This is useful context for people who are unfamiliar with the backend.
Could you please add this explanation in this patch file (between line 2 and 3)? I believe the patch tool will ignore anything above the --- a/lib/SPIRV/SPIRVInternal.h
line. E.g.,
diff --git a/lib/SPIRV/SPIRVInternal.h b/lib/SPIRV/SPIRVInternal.h
index a828add8..924e13b4 100644
<Explanation here>
--- a/lib/SPIRV/SPIRVInternal.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.
Done.
FeedLLVMWithFlags({"-slp-vectorize-hor=false"}); | ||
|
||
FeedLLVMWithFlags({ | ||
"-slp-min-reg-size=64", | ||
"-slp-max-reg-size=64", | ||
}); |
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.
Can these be merged into one call?
FeedLLVMWithFlags({"-slp-vectorize-hor=false"}); | |
FeedLLVMWithFlags({ | |
"-slp-min-reg-size=64", | |
"-slp-max-reg-size=64", | |
}); | |
FeedLLVMWithFlags({ | |
"-slp-vectorize-hor=false" | |
"-slp-min-reg-size=64", | |
"-slp-max-reg-size=64", | |
}); |
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.
Done.
@@ -1075,5 +1082,92 @@ absl::StatusOr<std::vector<uint8_t>> CompileToHsaco( | |||
|
|||
} // namespace amdgpu | |||
|
|||
namespace { |
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: Please add a blank line after this.
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.
Done.
llvm::PassRegistry* registry = llvm::PassRegistry::getPassRegistry(); | ||
InitializePasses(registry); | ||
} | ||
} // namespace |
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: Please add a blank line before this.
Please do the same for namespace spir
.
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.
Done.
a1db193
to
9abfdb8
Compare
- SPIRAS_Private, | ||
+ SPIRAS_Generic, | ||
SPIRAS_Global, | ||
- SPIRAS_Constant, | ||
+ SPIRAS_Internal, | ||
SPIRAS_Local, | ||
- SPIRAS_Generic, | ||
+ SPIRAS_Constant, | ||
+ SPIRAS_Private, |
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.
This is useful context for people who are unfamiliar with the backend.
Could you please add this explanation in this patch file (between line 2 and 3)? I believe the patch tool will ignore anything above the --- a/lib/SPIRV/SPIRVInternal.h
line. E.g.,
diff --git a/lib/SPIRV/SPIRVInternal.h b/lib/SPIRV/SPIRVInternal.h
index a828add8..924e13b4 100644
<Explanation here>
--- a/lib/SPIRV/SPIRVInternal.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.
Thank you very much!
Hi @penpornk |
@ShengYang1 Could you please rebase the PR on top of the latest state of the repo? Thanks! |
d454eb2
to
984ac8b
Compare
Done. |
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.
Thank you!
@ddunl This fails to import internally because copybara isn't sure where to put the new spirv files. It seems like it requires some extra configuration. Could you please advise what's needed to merge this? Thanks. |
TSL repository cannot be changed via PRs, you need to copy the changes manually as all changes to TSL repo are not imported. |
@akuegel Should I submit another PR for tsl changes? |
No, unfortunately it can only be changed internally. @xla-rotation importing this PR requires manual work, see comments above. |
This PR needs #11425 to be submitted first together with some internal changes. I'm working on those. Once that other PR is in, I will look into this one. |
Imported from GitHub PR #11424 It is a sub PR of #9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76 by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 FUTURE_COPYBARA_INTEGRATE_REVIEW=#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76 PiperOrigin-RevId: 661176906
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661065795
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 660362390
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661192298
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 PiperOrigin-RevId: 661186664
`protoc` has been warning of this unused import for a while now, so let's finally remove it to clean up build logs. FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661195599
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 660608962
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661065783
This has not fully landed yet due to changes in tsl. I'll let you know once this lands. |
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661222386
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661222386
This change should be in. |
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 PiperOrigin-RevId: 661272459
Imported from GitHub PR #11424 It is a sub PR of #9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76 by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 COPYBARA_INTEGRATE_REVIEW=#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76 PiperOrigin-RevId: 661272459
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 PiperOrigin-RevId: 661272459
Some parts of it will likely be re-used in a different Dockerfile. FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 661274311
Imported from GitHub PR #11424 It is a sub PR of #9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76 by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 COPYBARA_INTEGRATE_REVIEW=#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76 PiperOrigin-RevId: 661186664
Imported from GitHub PR #11424 It is a sub PR of #9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76 by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 COPYBARA_INTEGRATE_REVIEW=#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76 PiperOrigin-RevId: 661272459
We've been notified that the changes are merged and I have updated the internal PR track list, thank you very much! |
It is a sub PR of #9042 to add spirv-llvm-translator and translation pass