You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
genx_volatile-attributed globals pointers can indeed be used by bitcast (constant expressions or in instruction form) before being used in genx.vload/vstore.
#325
Open
lsatanov opened this issue
Apr 12, 2024
· 0 comments
For this particular reason e.g. genx::getAVLoadSrcOrNull(...) routine will do the scan through bitcasts in reverse direction, up the def-use chain using getBitCastedValue(...): const auto *Src = getBitCastedValue(I->getOperand(0))
N.B. present LIT-tests do not include this kind of usage, but it can be found during real world workloads compilation, so, most probably it'd be useful to include those cases in the LIT test for GenXVerify.cpp.
genx::peelBitCastsWhileSingleUserChain(...) should be done before casting to an Instruction, like this:
auto InvalidUser = llvm::find_if(GV.users(), [](const User *U) {
constauto *I = dyn_cast<Instruction>(genx::peelBitCastsWhileSingleUserChain(U));
return !I || !(genx::isAVStore(I) || genx::isAVLoad(I));
});
Additionally, it would be also nice to see all of the wrong usages in IR, not only the first one, hence the code could look like this:
auto IsInvalidUser = [](const User *U) {
constauto *I = dyn_cast<Instruction>(genx::peelBitCastsWhileSingleUserChain(U));
return !I || !(genx::isAVStore(I) || genx::isAVLoad(I));
};
for(constauto &U: GV.users())
ensure(!IsInvalidUser(*U),
"a global volatile variable may only be used in genx.vload/genx.vstore"
"intrinsics or volatile load/store instructions, optionally preceeded"
" by a pointer type bitcast",
U);
The text was updated successfully, but these errors were encountered:
lsatanov
changed the title
genx_volatile-attributed globals can indeed be used by bitcast constant expressions (in-call-embedded and standalone).
genx_volatile-attributed globals can indeed be used by bitcast constant expressions (e.g. in-call-embedded).
Apr 12, 2024
lsatanov
changed the title
genx_volatile-attributed globals can indeed be used by bitcast constant expressions (e.g. in-call-embedded).
genx_volatile-attributed globals pointers can indeed be used by (bitcast constant expressions or in instruction form) before being used in genx.vload/vstore.
Apr 12, 2024
lsatanov
changed the title
genx_volatile-attributed globals pointers can indeed be used by (bitcast constant expressions or in instruction form) before being used in genx.vload/vstore.
genx_volatile-attributed globals pointers can indeed be used by bitcast (constant expressions or in instruction form) before being used in genx.vload/vstore.
Apr 12, 2024
Hi, @KorovinVlad.
The commit
4f6d330
introduces checks for genx_volatile-attributed globals users.
One detail is that they can indeed be used by bitcast constant expression or instruction bitcasts before genx.vload/vstore.
E.g. pseudocode:
v = genx.vload(bitcast(@g*... to ...))
OR
ptr = bitcast(@g*... to ...)
v = genx.vload(ptr)
For this particular reason e.g. genx::getAVLoadSrcOrNull(...) routine will do the scan through bitcasts in reverse direction, up the def-use chain using getBitCastedValue(...): const auto *Src = getBitCastedValue(I->getOperand(0))
N.B. present LIT-tests do not include this kind of usage, but it can be found during real world workloads compilation, so, most probably it'd be useful to include those cases in the LIT test for GenXVerify.cpp.
Therefore here
intel-graphics-compiler/IGC/VectorCompiler/lib/GenXCodeGen/GenXVerify.cpp
Line 72 in 4f6d330
genx::peelBitCastsWhileSingleUserChain(...) should be done before casting to an Instruction, like this:
Additionally, it would be also nice to see all of the wrong usages in IR, not only the first one, hence the code could look like this:
The text was updated successfully, but these errors were encountered: