[PATCH] D105651: [AMDGPU] Tune perfhint analysis to account access width
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 14 11:20:01 PDT 2021
rampitec updated this revision to Diff 358671.
rampitec added a comment.
Rebased.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105651/new/
https://reviews.llvm.org/D105651
Files:
llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
llvm/test/CodeGen/AMDGPU/perfhint.ll
Index: llvm/test/CodeGen/AMDGPU/perfhint.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/perfhint.ll
+++ llvm/test/CodeGen/AMDGPU/perfhint.ll
@@ -16,16 +16,6 @@
%tmp8 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp7, align 16
%tmp9 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp6
store <4 x i32> %tmp8, <4 x i32> addrspace(1)* %tmp9, align 16
- %tmp10 = add nuw nsw i64 %tmp2, 2
- %tmp11 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp10
- %tmp12 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp11, align 16
- %tmp13 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp10
- store <4 x i32> %tmp12, <4 x i32> addrspace(1)* %tmp13, align 16
- %tmp14 = add nuw nsw i64 %tmp2, 3
- %tmp15 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp14
- %tmp16 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp15, align 16
- %tmp17 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp14
- store <4 x i32> %tmp16, <4 x i32> addrspace(1)* %tmp17, align 16
ret void
}
Index: llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
@@ -209,13 +209,16 @@
for (auto &B : F) {
LastAccess = MemAccessInfo();
for (auto &I : B) {
- if (getMemoryInstrPtr(&I)) {
+ if (const Value *Ptr = getMemoryInstrPtr(&I)) {
if (isIndirectAccess(&I))
++FI.IAMInstCount;
if (isLargeStride(&I))
++FI.LSMInstCount;
- ++FI.MemInstCount;
- ++FI.InstCount;
+ unsigned Size = divideCeil(
+ Ptr->getType()->getPointerElementType()->getPrimitiveSizeInBits(),
+ 32);
+ FI.MemInstCount += Size;
+ FI.InstCount += Size;
continue;
}
if (auto *CB = dyn_cast<CallBase>(&I)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105651.358671.patch
Type: text/x-patch
Size: 2032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210714/4faeff2b/attachment-0001.bin>
More information about the llvm-commits
mailing list