Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CGData][GMF] Skip No Params #116548

Merged
merged 4 commits into from
Nov 25, 2024
Merged

[CGData][GMF] Skip No Params #116548

merged 4 commits into from
Nov 25, 2024

Conversation

kyulee-com
Copy link
Contributor

@kyulee-com kyulee-com commented Nov 17, 2024

This update follows up on change #112671 and is mostly a NFC, with the following exceptions:

  • Introduced -global-merging-skip-no-params to bypass merging when no parameters are required.
  • Parameter count is now calculated based on the unique hash count.
  • Added -global-merging-inst-overhead to adjust the instruction overhead, reflecting the machine instruction size.
  • Costs and benefits are now computed using the double data type. Since the finalization process occurs offline, this should not significantly impact build time.
  • Moved a sorting operation outside of the loop.

This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.

@kyulee-com kyulee-com changed the title [GlobalMergeFunctions] Skip No Params [CGData][GMF] Skip No Params Nov 17, 2024
@kyulee-com
Copy link
Contributor Author

cc. @nocchijiang

@kyulee-com kyulee-com marked this pull request as ready for review November 17, 2024 21:07
SmallSet<stable_hash, 8> UniqueHashVals;
for (auto &SF : SFS) {
UniqueHashVals.clear();
for (auto &[IndexPair, Hash] : *SF->IndexOperandHashMap)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware that the unique values could differ, but it is still nice to count them precisely. This fix alone brings ~1% code size reduction on one of the projects I have tested.

unsigned ParamCount = UniqueHashVals.size();
if (ParamCount > GlobalMergingMaxParams)
return false;
if (GlobalMergingSkipNoParams && ParamCount == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this pass acts as an IR-level ICF when ParamCount == 0? If your testing result shows it is beneficial then I have no problems with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also thinking this. To be explicit, does ICF get the same size win as when GlobalMergingMaxParams = 0? If so I think it would be worth saying this in the flag description to help users understand the pass a bit better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be explicit, does ICF get the same size win as when GlobalMergingMaxParams = 0?

No, this might actually increase the size since it always creates redundant thunks. However, depending on downstream passes or an improved linker's ICF, the outcome could be different. I have now set the flag to true to skip this ICF case, but an option remains available to enable it if needed.

@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//

#include "llvm/CGData/StableFunctionMap.h"
#include "llvm/ADT/SmallSet.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: includes not sorted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually sorted correctly. The main header file (StableFunctionMap.h) should come first, corresponding to this file, StableFunctionMap.cpp. https://llvm.org/docs/CodingStandards.html#header-files

"global-merging-inst-overhead",
cl::desc("The overhead cost associated with each instruction when lowering "
"to machine instruction."),
cl::init(1.0), cl::Hidden);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we should set the default value slightly higher, maybe like 1.2? I believe 1.0 is a guaranteed underestimation for AArch64 backend.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a test with 1.2 and it delivered another 0.6% code size reduction on the same project I tested the effect of accurate ParamCount.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind changing the default value as it could eventually change depending on target/app. In theory, it's hard to precisely estimate final size impact for the given IR, anyhow,

unsigned ParamCount = UniqueHashVals.size();
if (ParamCount > GlobalMergingMaxParams)
return false;
if (GlobalMergingSkipNoParams && ParamCount == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also thinking this. To be explicit, does ICF get the same size win as when GlobalMergingMaxParams = 0? If so I think it would be worth saying this in the flag description to help users understand the pass a bit better.

Comment on lines +182 to +183
if (ParamCount > GlobalMergingMaxParams)
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand if, if a group of mergable functions have too many params, we can't merge any of them. Could we eliminate functions until the params are small enough and only merge a subset of the group?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. To compute the actual parameters, we need to iterate over the set of candidates with the same hash. By reducing these candidates, we might obtain a smaller set of parameters. However, this adds complexity to repeat these steps until we find a smaller set. In addition, since the overall function hash still matches, we may create unprofitable merging instances that the linker does not fold. I would maintain the current approach for simplicity.

@kyulee-com
Copy link
Contributor Author

I believe all the comments have been addressed. Are there any more?"

@kyulee-com
Copy link
Contributor Author

@nocchijiang @ellishg Can you take a look again? Thanks!

@kyulee-com kyulee-com merged commit fdf1f69 into llvm:main Nov 25, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/12484

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-no-params.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 9: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false < /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building llvm at step 8 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/11692

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-no-params.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 9: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false < /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/8209

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-no-params.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 9: /buildbot/worker/arc-folder/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false < /buildbot/worker/arc-folder/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll | /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
+ /buildbot/worker/arc-folder/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false
+ /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
/buildbot/worker/arc-folder/build/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/2529

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-local.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 7: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt -S --passes=global-merge-func /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt -S --passes=global-merge-func /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt: WARNING: failed to create target machine for 'arm64-unknown-ios12.0.0': unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.
RUN: at line 41: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -enable-global-merge-func=true < /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -enable-global-merge-func=true
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE

--

********************


kyulee-com added a commit that referenced this pull request Nov 25, 2024
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/8027

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-local.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 7: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt -S --passes=global-merge-func /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt -S --passes=global-merge-func /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt: WARNING: failed to create target machine for 'arm64-unknown-ios12.0.0': unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.
RUN: at line 41: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc -enable-global-merge-func=true < /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc -enable-global-merge-func=true
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/8479

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-no-params.ll' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 9
z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe -enable-global-merge-func=true -global-merging-skip-no-params=false < Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\CodeGen\Generic\cgdata-merge-no-params.ll | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\CodeGen\Generic\cgdata-merge-no-params.ll --check-prefix=MERGE
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe' -enable-global-merge-func=true -global-merging-skip-no-params=false
# .---command stderr------------
# | z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\CodeGen\Generic\cgdata-merge-no-params.ll' --check-prefix=MERGE
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\CodeGen\Generic\cgdata-merge-no-params.ll --check-prefix=MERGE
# `-----------------------------
# error: command failed with exit status: 2

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/9016

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-local.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 7: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -S --passes=global-merge-func /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -S --passes=global-merge-func /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/opt: WARNING: failed to create target machine for 'arm64-unknown-ios12.0.0': unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.
RUN: at line 41: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -enable-global-merge-func=true < /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -enable-global-merge-func=true
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-local.ll --check-prefix=MERGE

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 25, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/9014

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/Generic/cgdata-merge-no-params.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 9: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false < /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -enable-global-merge-func=true -global-merging-skip-no-params=false
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'arm64-unknown-ios12.0.0', see --version and --triple.FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/Generic/cgdata-merge-no-params.ll --check-prefix=MERGE

--

********************


kyulee-com added a commit that referenced this pull request Nov 25, 2024
This update follows up on change #112671 and is mostly a NFC, with the following exceptions:
  - Introduced `-global-merging-skip-no-params` to bypass merging when no parameters are required.
  - Parameter count is now calculated based on the unique hash count.
  - Added `-global-merging-inst-overhead` to adjust the instruction overhead, reflecting the machine instruction size.
  - Costs and benefits are now computed using the double data type. Since the finalization process occurs offline, this should not significantly impact build time.
  - Moved a sorting operation outside of the loop.

This is a patch for
https://discourse.llvm.org/t/rfc-global-function-merging/82608.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants