Page MenuHomePhabricator

[DAGCombiner] Teach scalarizeBinOpOfSplats handle scalable splat.
ClosedPublic

Authored by jacquesguan on Mar 31 2022, 2:15 AM.

Details

Summary

This revision supports to scalarize a binary operation of two scalable
splat vectors.

Diff Detail

Unit TestsFailed

TimeTest
150 msx64 debian > LLVM.CodeGen/AArch64::active_lane_mask.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=aarch64-linux-gnu -mattr=+sve < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/active_lane_mask.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/active_lane_mask.ll
80 msx64 debian > LLVM.CodeGen/AArch64::fdiv-combine.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=aarch64-unknown-unknown < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/fdiv-combine.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/fdiv-combine.ll
110 msx64 debian > LLVM.CodeGen/AArch64::sve-gep.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=aarch64-linux-gnu -mattr=+sve < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/sve-gep.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/AArch64/sve-gep.ll
140 msx64 debian > LLVM.CodeGen/X86::pr46189.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/X86/pr46189.ll -mtriple=x86_64-unknown-unknown -mattr=+sse2 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/X86/pr46189.ll --check-prefix=SSE
60,040 msx64 debian > MLIR.Examples/standalone::test.toy
Script: -- : 'RUN: at line 1'; /usr/bin/cmake /var/lib/buildkite-agent/builds/llvm-project/mlir/examples/standalone -G "Ninja" -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/var/lib/buildkite-agent/builds/llvm-project/build/lib/cmake/mlir ; /usr/bin/cmake --build . --target check-standalone | tee /var/lib/buildkite-agent/builds/llvm-project/build/tools/mlir/test/Examples/standalone/Output/test.toy.tmp | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/mlir/test/Examples/standalone/test.toy
View Full Test Results (6 Failed)

Event Timeline

jacquesguan created this revision.Mar 31 2022, 2:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 2:15 AM
jacquesguan requested review of this revision.Mar 31 2022, 2:15 AM

precommit the new tests and rebase so the patch shows the diff?

rebase the precommit test.

craig.topper added inline comments.Jun 14 2022, 9:49 PM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
23039

Not sure we should be creating SPLAT_VECTOR on targets that don't support SPLAT_VECTOR. At the very least it's a waste of compile time to convert it back to a BUILD_VECTOR.

RKSimon added inline comments.Jun 15 2022, 4:31 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
23013

Use DAG.isSplatValue instead?

23039

+1 at the very least we need a hasOperation() check for the getSplatVector path and getBuildVector fallback

Address comment.

Fix test case.

jacquesguan added inline comments.Jul 10 2022, 7:27 PM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
23013

I tried to use DAG.isSplatValue, but this way would affect many no splat cases of X86 target, some of them are negative.

23039

Done, I only build splat_vector when is scalable now.

RKSimon accepted this revision.Jul 18 2022, 1:53 AM

LGTM with one minor

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
23013

OK - please can you add a TODO comment? It sounds like something that needs revisiting in the future.

This revision is now accepted and ready to land.Jul 18 2022, 1:53 AM

Address comment.

This revision was landed with ongoing or failed builds.Jul 18 2022, 8:23 PM
This revision was automatically updated to reflect the committed changes.
jacquesguan reopened this revision.Jul 19 2022, 1:24 AM
This revision is now accepted and ready to land.Jul 19 2022, 1:24 AM

rebase main