[PATCH] D113214: [IR][ShuffleVector] Introduce `isReplicationMask()` matcher

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 14:50:51 PDT 2021


rupprecht added inline comments.


================
Comment at: llvm/unittests/IR/InstructionsTest.cpp:1133
+
+TEST(InstructionsTest, ShuffleMaskIsReplicationMask_undef) {
+  for (int ReplicationFactor : seq_inclusive(1, 6)) {
----------------
lebedev.ri wrote:
> lebedev.ri wrote:
> > rupprecht wrote:
> > > rupprecht wrote:
> > > > lebedev.ri wrote:
> > > > > rupprecht wrote:
> > > > > > These two exhaustive test cases take an extremely long time to test (3+ minutes for each one). Would it make sense to use `#ifdef EXPENSIVE_CHECKS` for these two?
> > > > > They take 1 and 2 seconds for me.
> > > > > How long do tests in `ConstantRangeTest.cpp` take for you?
> > > > Weird. `ConstantRangeTest` takes 23 seconds in total, most test cases being <.5s but a few being ~2 seconds.
> > > > 
> > > > ```
> > > > $ ./unittests/IR/IRTests --gtest_filter='InstructionsTest.ShuffleMask*'
> > > > Note: Google Test filter = InstructionsTest.ShuffleMask*
> > > > [==========] Running 4 tests from 1 test suite.
> > > > [----------] Global test environment set-up.
> > > > [----------] 4 tests from InstructionsTest
> > > > [ RUN      ] InstructionsTest.ShuffleMaskQueries
> > > > [       OK ] InstructionsTest.ShuffleMaskQueries (2 ms)
> > > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask
> > > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask (0 ms)
> > > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask_undef
> > > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask_undef (227553 ms)
> > > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask_Exhaustive_Correctness
> > > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask_Exhaustive_Correctness (203930 ms)
> > > > [----------] 4 tests from InstructionsTest (431486 ms total)
> > > > 
> > > > [----------] Global test environment tear-down
> > > > [==========] 4 tests from 1 test suite ran. (431486 ms total)
> > > > [  PASSED  ] 4 tests.
> > > > ```
> > > > 
> > > > I'm running a debug build. I would expect performance to be degraded, but not this much. I'll see if release build makes a difference.
> > > Yep, a release build is **much** faster:
> > > 
> > > ```
> > > $ ./unittests/IR/IRTests --gtest_filter='InstructionsTest.ShuffleMask*'
> > > Note: Google Test filter = InstructionsTest.ShuffleMask*
> > > [==========] Running 4 tests from 1 test suite.
> > > [----------] Global test environment set-up.
> > > [----------] 4 tests from InstructionsTest
> > > [ RUN      ] InstructionsTest.ShuffleMaskQueries
> > > [       OK ] InstructionsTest.ShuffleMaskQueries (1 ms)
> > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask
> > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask (0 ms)
> > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask_undef
> > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask_undef (4884 ms)
> > > [ RUN      ] InstructionsTest.ShuffleMaskIsReplicationMask_Exhaustive_Correctness
> > > [       OK ] InstructionsTest.ShuffleMaskIsReplicationMask_Exhaustive_Correctness (2030 ms)
> > > [----------] 4 tests from InstructionsTest (6915 ms total)
> > > 
> > > [----------] Global test environment tear-down
> > > [==========] 4 tests from 1 test suite ran. (6915 ms total)
> > > [  PASSED  ] 4 tests.
> > > ```
> > > 
> > > I wonder what is so horrendously bad about this test case that the optimizer is able to get rid of so much?
> > > Weird. ConstantRangeTest takes 23 seconds in total, most test cases being <.5s but a few being ~2 seconds.
> > 
> > In debug build, correct?
> I don't have much sympathy for debug optimization-less build. You get what you asked for.
> I've fine-tuned this in rG0b36431810076790b1f3362495b2eaebc9be96c7,
> hopefully that no longer leads to bad run time for you.
Yes, 23 seconds for ConstantRangeTest is in a debug build configuration.

The runtime of this test is now less than a second for each test case, so more reasonable for running tests in a plain debug build. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113214/new/

https://reviews.llvm.org/D113214



More information about the llvm-commits mailing list