This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Prevent llvm-exegesis from using unsupported opcodes
ClosedPublic

Authored by kpdev42 on Mar 17 2023, 8:22 AM.

Details

Summary

When generating snippets for AArch64 with --opcode-index=-1, the code
generator asserts on opcodes that are not supported according to CPU
features.

The same assertion can be triggered even when generating a serial
snippet for a supported opcode if SERIAL_VIA_NON_MEMORY_INSTR execution
mode is used and an unsupported instruction is chosen as the "other
instruction". Unlike the first case, this one may result in flaky
failures because the other instruction is randomly chosen from the
instructions suitable for serializing execution.

This patch adjusts TableGen emitter for *GenInstrInfo.inc to make
possible to query for opcode availability instead of just asserting on
unsupported ones.

~~

Huawei RRI, OS Lab

Diff Detail

Event Timeline

kpdev42 created this revision.Mar 17 2023, 8:22 AM
kpdev42 requested review of this revision.Mar 17 2023, 8:22 AM

In principle I like that, however this has implications on the size of the various llvm binaries. Can you please measure the increase in binary size for e.g. clang ?

In principle I like that, however this has implications on the size of the various llvm binaries. Can you please measure the increase in binary size for e.g. clang ?

Sure. Built with the following cmake cache

set(CMAKE_C_COMPILER   /usr/bin/clang   CACHE STRING "")
set(CMAKE_CXX_COMPILER /usr/bin/clang++ CACHE STRING "")
set(LLVM_PARALLEL_LINK_JOBS 6 CACHE STRING "")
set(LLVM_CCACHE_BUILD  ON CACHE BOOL "")

set(CMAKE_BUILD_TYPE       Release CACHE STRING "")
set(LLVM_ENABLE_ASSERTIONS OFF     CACHE BOOL "")

set(LLVM_ENABLE_PROJECTS  "clang;lld" CACHE STRING "")
set(LLVM_TARGETS_TO_BUILD "all" CACHE STRING "")

Host compiler is

$ /usr/bin/clang --version
Ubuntu clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Size of bin/clang-17 increases by about 150 kilobytes mostly because of the .rodata section.

Thanks for the data. Can you get someone to approve that the size change is OK ? Otherwise LGTM for the exegesis part.

kpdev42 updated this revision to Diff 511670.Apr 7 2023, 5:41 AM

Rebase patch

Thanks for the data. Can you get someone to approve that the size change is OK ? Otherwise LGTM for the exegesis part.

I will try to find someone )

kpdev42 updated this revision to Diff 514177.Apr 17 2023, 5:50 AM

Reworked the patch. Now it should not increase the size of unrelated
llvm tools and clang. Most of the changes to TableGen emitter are
factored out into a separate patch https://reviews.llvm.org/D148516

courbet accepted this revision.Apr 18 2023, 7:53 AM
This revision is now accepted and ready to land.Apr 18 2023, 7:53 AM
kpdev42 updated this revision to Diff 544395.Jul 26 2023, 9:29 AM

Change according to clang-format