Page MenuHomePhabricator

[SLP]Generalize cost model.
Needs ReviewPublic

Authored by ABataev on Dec 14 2021, 1:13 PM.

Details

Summary

Generalized the cost model estimation. Improved cost model estimation
for repeated scalars (no need to count their cost anymore), improved

cost model for extractelement instructions.

cpu2017

511.povray_r             0.57
520.omnetpp_r           -0.98
521.wrf_r               -0.01
525.x264_r               3.59 <+
526.blender_r           -0.12
531.deepsjeng_r         -0.07
538.imagick_r           -1.42

Geometric mean: 0.21

Diff Detail

Unit TestsFailed

TimeTest
1,850 msx64 debian > AddressSanitizer-x86_64-linux.TestCases::non-executable-pc.cpp
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/non-executable-pc.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/non-executable-pc.cpp.tmp
100 msx64 debian > LLVM.Bindings/Go::go.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-go go=/usr/bin/go test llvm.org/llvm/bindings/go/llvm

Event Timeline

ABataev created this revision.Dec 14 2021, 1:13 PM
ABataev requested review of this revision.Dec 14 2021, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2021, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 9:07 AM
Herald added a subscriber: vporpo. · View Herald Transcript
RKSimon added inline comments.Sat, Sep 10, 4:19 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4566–4567

I->getOperand(OpIdx) == Op0;

4566–4567

auto *Op = I->getOperand(OpIdx);

4569

true?

ABataev added inline comments.Mon, Sep 12, 7:12 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4569

Here is my idea. Generally speaking, here we can have only undef/poison or just a pointer (as part of getelementpr node) currently (maybe, need to add an assert). I thought that because of that we can treat its (virtual) operand as power-of-2, since it can be any value. Thoughts?

ABataev updated this revision to Diff 459464.Mon, Sep 12, 8:11 AM

Address comments

ABataev updated this revision to Diff 462887.Mon, Sep 26, 6:20 AM

Rebase. Ping!

RKSimon added inline comments.Wed, Sep 28, 6:13 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4862

Is this purely compile time saving?

4889

Can't we directly initialize Operands from PHI-> incoming_values()? Or even create a ArrayRef<> from it?

4938

We're going to lose the recent scalarization cost improvement here :-(

5138

Would isa<UnaryOperator> ? 0 : 1 be better?

5205

Why do you avoid allowing uniform as well? Can't you just use getOperandInfo(VL, 0)..getNoProps() below ?

ABataev added inline comments.Wed, Sep 28, 7:13 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4862

Replaced by 0, since it does not matter.

4889

operand_value returns llvm::Use, Operands list requires Value *. Did not find better way to do it.

5205

Just missed this change, will fix.

ABataev updated this revision to Diff 463564.Wed, Sep 28, 7:54 AM

Rebase, address comments