There is some discussion on the bitcast for vector and x86_amx at https://reviews.llvm.org/D99152. This patch is to introduce a x86 specific cast for vector and x86_amx, so that it can avoid some unnecessary optimization by middle-end. On the other way, we have to optimize the x86 specific cast by ourselves. This patch also optimize the cast operation to eliminate redundant code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Would you summarize the the title in fewer words and elaborate it in description and commit message?
Could you also document those intrinsics in the LangRef?
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
71 | can you just return match() || match()? Also it looks like you are not using Vec, so you could use m_Any() or something like that instead. |
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
800 | Drop brace. | |
820 | Drop brace. | |
822 | Drop brace. | |
837 | of | |
841 | What does ACI stand for? AMX cast intrinsic? | |
857 | Drop brace. | |
917 | We can erase dead cast code from Vec2TileInsts and Vec2TileInsts and get AMX cast instruction from there, so that we can avoid iterate basic block again. |
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
71 | Thanks for comments. You're right, I will change it. |
llvm/test/CodeGen/X86/AMX/lat-combine-amx-bitcast.ll | ||
---|---|---|
107 | We can optimize udef or zero vector with tilezero. We may do it in another patch. | |
153 | This may be optimized to "phi <x86_amx>", and cast back to vector for its user %evilphi2. But we can optimize it in another patch. | |
400 | Could you simplify the name? | |
llvm/test/CodeGen/X86/AMX/lat-transform-amx-bitcast.ll | ||
142 | We can forward llvm.x86.tilestored64.internal to finial store (line 143). We can optimize it in another patch. | |
292 | We can combine load and cast to @llvm.x86.tileloadd64.internal. |
looks like target-specific ones are not documented there so far, not sure if there's a different place to document them.
This appears to be causing failures on EXPENSIVE_CHECKS builds: https://bugs.llvm.org/show_bug.cgi?id=51513
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
1049 | Doesn't C needs to be updated based on the results of combineAMXcast and transformAllAMXCast as well ? |
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
1049 | Yes. C should be updated. Thanks, Simon. |
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
178 | This function has no user now? |
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
915 | PN has no user. Should be removed to avoid warning. |
I created patch https://reviews.llvm.org/D108269 to fix the bug and address Pengfei's comments.
llvm/lib/Target/X86/X86LowerAMXType.cpp | ||
---|---|---|
178 | I agree, this function seems to be unused? I get the following warning compiling trunk with gcc: ../lib/Target/X86/X86LowerAMXType.cpp:181:8: warning: 'llvm::Value* {anonymous}::X86LowerAMXType::getRowFromCol(llvm::Instruction*, llvm::Value*, unsigned int)' defined but not used [-Wunused-function] 181 | Value *X86LowerAMXType::getRowFromCol(Instruction *II, Value *V, | ^~~~~~~~~~~~~~~ |
can you just return match() || match()?
Also it looks like you are not using Vec, so you could use m_Any() or something like that instead.