This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Insert IACA markers
AbandonedPublic

Authored by oontvoo on Apr 17 2019, 9:28 PM.

Details

Summary

LLVM-EXEgesis - IACA analysis

About the project

IACA is a static performance analysis tool that Intel provides to developers for analysing low-level performance problems with their code. It contains specialized models for several high-end Intel CPUs, including instruction latencies. The goal of the project is to be able to compare these latencies with the data that are currently in LLVM, and with other simulators and benchmarks.
IACA is distributed only in binary form, neither the CPU models it contains have been open-sourced, and we can observe them only by running the models on certain pieces of code.

Project plan
The simplest way to analyse the data from IACA would be to get them into llvm-exegesis, as it already has functions for generating the benchmarked code, and also for analysing the output. It could be done as another BenchmarkRunner for llvm-exegesis, that:

  • Produces an object file in the right format that can be processed by IACA. Llvm-exegesis already produces an object file that contains the benchmarked code, but this file does not have the IACA start/end markers. We would need to modify this function to be able to add the markers
  • Runs IACA on that file: Implement a BenchmarkRunner that runs the IACA code. This could be as simple as launching the IACA binary, the path to which will be specified via command-line flag. (Because we cannot include/distribute the IACA binary)
  • Parses the outputs and extracts the information needed by llvm-exegesis (the latency and the port pressure) and uses the llvm-exegesis analysis tools to process that information.

Diff Detail

Repository
rL LLVM

Event Timeline

oontvoo created this revision.Apr 17 2019, 9:28 PM
oontvoo updated this revision to Diff 195776.Apr 18 2019, 10:22 AM

Updated the diff (got rid of the "third_party/..." in paths.

Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2019, 10:22 AM
RKSimon added a subscriber: RKSimon.

Please add context to the diff

Please add description to differential.
What is the goal? What is this solving?

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
10

Use "llvm/Support/raw_ostream.h"

17

This can't go here, it needs to go into x86-specific file

lebedev.ri retitled this revision from Insert IACA markers to [MCA] Insert IACA markers.Apr 21 2019, 6:13 AM
oontvoo edited the summary of this revision. (Show Details)Apr 23 2019, 11:20 AM

Please add description to differential.
What is the goal? What is this solving?

I've added additional details on the project. PTAL. Thanks!

lebedev.ri retitled this revision from [MCA] Insert IACA markers to [llvm-exegesis] Insert IACA markers.Apr 23 2019, 11:26 AM

The goal of the project is to be able to compare these latencies with the data that are currently in LLVM, and with other simulators and benchmarks.

Okay, that is the goal of the changes.
But what's the actual real endgoal?
Generating llvm schedule data from IACA data, not measurements?
I'm sorry if that question makes no sense, i may be unaware of some previous discussions about this.

Relevant: https://bugs.llvm.org/show_bug.cgi?id=38437

Please add description to differential.
What is the goal? What is this solving?

I've added additional details on the project. PTAL. Thanks!

Other comments weren't addressed though.
Also, please always upload all patches with full context (-U99999)

llvm/tools/llvm-exegesis/lib/InlineAsmMCExpr.h
2

Missing starting comment, wrong header guard

llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
13–20

All these look wrong

59

This is x86-specific, needs to go into x86/ dir

courbet added inline comments.Apr 25 2019, 12:49 AM
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
202

Please remove the debugging code.

llvm/tools/llvm-exegesis/lib/InlineAsmMCExpr.h
2

More specifically, every llvm file needs a header: https://llvm.org/docs/CodingStandards.html#file-headers.

12

I would ditch this intermediate class and only have IacaMarkerBytesMCExpr.

30

I don't think the namespace is really useful here.

45

I can see that :) Please remove the comment.

49

Ditto

llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
10

The file header is missing.

13

Did you build and run the tests ? This should not be compiling on your local checkout.

13

Hm, actually I see you're missing and entry in CMakeLists for this, so this is never built & run.

26

TestIacaBenchmarkRunner ?

51

I think you can remove these.

78

I think testing form string equality is a bit brittle. What about:

const auto IsImmOperand = [](int64_t Imm) {
  return AllOf(Property(&MCOperand::isImm, Eq(true)), Property(&MCOperand::getImm, Eq(Imm)));
};

const auto IsIacaMarkerOperand = ...;

EXPECT_THAT(Inst, ElementsAre(IsIacaMarkerOperand, IsImmOperand(1)))
88

why not call the real thing directly ?

122

s/maker/marker/ (same below)

127

Same remark as above: let's use matchers.

oontvoo abandoned this revision.May 9 2019, 6:47 AM

Withdrawing review request since IACA is going away. Thanks, all for the comments!