-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL][ESIMD] Use vload/vstore for simd object getter/setter. #1887
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
@cmc-rep, please pick the PR as the author of the code |
; Function Attrs: norecurse nounwind | ||
define dso_local spir_func void @_Z3foov() local_unnamed_addr #1 { | ||
; CHECK-LABEL: @_Z3foov( | ||
; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i32> @llvm.genx.vload.v16i32.p0v16i32(<16 x i32>* getelementptr inbounds (%"class._ZTSN4sycl5intel3gpu4simdIiLi16EEE.sycl::intel::gpu::simd", %"class._ZTSN4sycl5intel3gpu4simdIiLi16EEE.sycl::intel::gpu::simd"* @vg, i64 0, i32 0)) |
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.
Is it expected that vload is not lowered in this case? It is not obvious why only vstore is lowered to the normal store.
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.
Yes, this is we are testing. vload/vstore associated with global variable with special attritube stays as vload/vstore. vload/vstore not associated with those global variables is changed to generic load/store. This is explained in the code 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.
This means that the lowering of the load is not tested, please add additional test to check lowering of the load.
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.
load/store are processed in the same fashion. I added one case for load and one case for store. That should be sufficient
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.
I don't see a test for load lowering, how I can be sure that your code for load lowering is working?
|
||
bool ESIMDLowerLoadStore::runOnFunction(Function &F) { | ||
bool Changed = false; | ||
Changed |= lowerLoadStore(F); |
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.
Is it possible to replace these 3 lines with
return lowerLoadStore(F); ?
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.
Why. It works and it is correct. Do we really need to pick on this detail?
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.
Is this review only about functional correctness?
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.
That is fine. I can change this one.
#include "llvm/IR/Module.h" | ||
#include "llvm/InitializePasses.h" | ||
#include "llvm/Support/Debug.h" | ||
#include "llvm/Support/raw_ostream.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.
Probably some includes are not needed.
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.
Which includes are not needed. Please be specific
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.
Review process doesn't work this way.
I pointed to "#include "llvm/Support/raw_ostream.h" which probably was used during debugging the code but is not needed in the published code. And you should check if other headers are needed.
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.
I will delete raw_ostream.h
@@ -34,6 +34,9 @@ class SYCLLowerESIMDPass : public PassInfoMixin<SYCLLowerESIMDPass> { | |||
FunctionPass *createSYCLLowerESIMDPass(); | |||
void initializeSYCLLowerESIMDLegacyPassPass(PassRegistry &); | |||
|
|||
FunctionPass *createESIMDLowerLoadStorePass(); |
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.
Pass is written to work with old pass manager only. Please support it for the new pass manager, SYCLLowerESIMDPass or other pass can be used as an example.
// lower all vload/vstore into normal load/store. | ||
std::vector<Instruction *> ToErase; | ||
for (Instruction &Inst : instructions(F)) { | ||
if (GenXIntrinsic::isVLoadStore(&Inst)) { |
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 loop body is one huge block which is hard to read.
Could you please use more early exits there? I think it will be much easier to read. For example:
if (!GenXIntrinsic::isVLoadStore(&Inst))
continue;
and so on.
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.
I think this is just your personal preference. Other people may prefer not to use continue
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 not my personal preference. Here is the link to the LLVM coding guidelines:
https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
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.
Coding style is just a guideline. Individual developer should have some freedom in applying it. In this case, for example, I do not like the negative sense in the condition when using condition. I prefer to use positive sense whenever possible for the condition test. Clearly, you read this code, and it did not confuse you.
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.
Individual reviewers should have freedom in insisting to apply such guidelines (which are essentially a set of BKMs to write robust/correct/maintainable code) if they seem them suitable. I'm exercising that freedom.
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.
Ok, I understand that you disagree, but I am not the person who determines the review process for this project.
@pvchupin @olegmaslovatintel @bader @romanovvlad Could you please help with this question?
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 project follows LLVM coding guidelines and this is requirement.
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.
I have used "continue"
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.
Probably you forgot to upload the new changes.
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.
Not sure what I did wrong. It should be up to date now: https://github.com/kbobrovs/llvm/blob/esimd-ldst/llvm/lib/SYCLLowerIR/LowerESIMDVLoadVStore.cpp
I have addressed all the comments last week |
@againull, please take another look |
Use special intrinsics to access simd objects in the private address space to disable standard LLVM optimizations on them. Author: Gang Chen <[email protected]> Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: gangche1 <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Had to rebase after ESIMD lowering merge. @againull, can you please approve again. |
List of changes: All Literal parameters of instructions in OpenCL.DebugInfo.100 are OpConstants in NonSemantic.Shader.DebugInfo.100 and NonSemantic.Shader.DebugInfo.200; SPV_KHR_non_semantic_info is being implicitly added for nonsemantic debug info; Original commit: KhronosGroup/SPIRV-LLVM-Translator@3fe4393
DO NOT REVIEW FIRST TWO COMMITS (covered by #1881)
Use special intrinsics to access simd objects in the private address space
to disable standard LLVM optimizations on them.
Author: Gang Chen [email protected]
Signed-off-by: Konstantin S Bobrovsky [email protected]