This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis][x86] Add option to prevent use of xmm8-xmm15 upper SSE registers
ClosedPublic

Authored by RKSimon on Nov 28 2022, 9:58 AM.

Details

Summary

Noticed while trying to use llvm-exegesis to get some accurate capture numbers on some old Atom/Silverment hardware as part of the work with D103695.

These targets' frontends are particularly poor and the use of the xmm8-xmm15 SSE registers results in longer instruction encodings which were affecting the latency/throughput estimates.

I'm not sure how best to add test coverage for this - any suggestions?

Diff Detail

Event Timeline

RKSimon created this revision.Nov 28 2022, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 9:59 AM
Herald added a subscriber: mstojanovic. · View Herald Transcript
RKSimon requested review of this revision.Nov 28 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 9:59 AM
tschuett added inline comments.
llvm/docs/CommandGuide/llvm-exegesis.rst
218

registers

I'm not sure how best to add test coverage for this - any suggestions?

--mode=inverse_throughput --opcode-name=ADDPSrr will try to make use of every register, so just check that the assembled snippet does not mention those regs.

courbet accepted this revision.Dec 5 2022, 6:00 AM

You can test by adding a test in test/tools/llvm-exegesis/X86/uops/ with something like:

# RUN: llvm-exegesis -mode=uops -opcode-name=ADDPSrr -repetition-mode=duplicate | FileCheck --check_prefix=ALL_REGS %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADDPSrr -repetition-mode=duplicate -x86-disable-upper-sse-registers | FileCheck --check_prefix=LOW_REGS %s

ALL_REGS:   XMM15
LOW_REGS-NOT:   XMM15
This revision is now accepted and ready to land.Dec 5 2022, 6:00 AM

Cheers - sorry for the delay - I've been away from any machines that had libPFM

This revision was landed with ongoing or failed builds.Dec 7 2022, 9:54 AM
This revision was automatically updated to reflect the committed changes.
lebedev.ri added inline comments.Dec 7 2022, 10:15 AM
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
41–42

FYI this doesn't work. You probably want to expose the declaration of
the normal BenchmarkOptions in a header and use it,
not add a new group, because it isn't being displayed.
Maybe other tools have some other example on how to handle this.

RKSimon added inline comments.Dec 7 2022, 10:21 AM
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
41–42

Cheers, I'll take a look as a follow up - you've probably guessed I was just doing an copy+paste of the lbr option :)

lebedev.ri added inline comments.Dec 7 2022, 10:25 AM
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
41–42

Yes.