llvm.org GIT mirror llvm / 4ce34f1
[llvm-exegesis] Throughput support in analysis mode Summary: D57000 / [[ https://bugs.llvm.org/show_bug.cgi?id=37698 | PR37698 ]] added support for measuring of the inverse throughput. But the support for the analysis was not added. This attempts to fix that. (analysis done o bdver2 / piledriver) First, small-scale experiment: ``` $ ./bin/llvm-exegesis -num-repetitions=10000 -mode=inverse_throughput -opcode-name=BSF64rr Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-d0acdd.o --- mode: inverse_throughput key: instructions: - 'BSF64rr RAX RDX' config: '' register_initial_values: - 'RDX=0x0' cpu_name: bdver2 llvm_triple: x86_64-unknown-linux-gnu num_repetitions: 10000 measurements: - { key: inverse_throughput, value: 3.0278, per_snippet_value: 3.0278 } error: '' info: instruction has no tied variables picking Uses different from defs assembled_snippet: 48BA0000000000000000480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2C3 ... ``` If we plug `bsfq %r12, %r10` into llvm-mca: https://godbolt.org/z/ZtOyhJ ``` Dispatch Width: 4 uOps Per Cycle: 3.00 IPC: 0.50 Block RThroughput: 2.0 ``` So RThroughput mismatch exists. Now, let's upscale and analyse: {F8207148} `$ ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html`: {F8207172} {F8207197} And if we now look at https://www.agner.org/optimize/instruction_tables.pdf, `Reciprocal throughput` for `BSF r,r` is listed as `3`. Yay? Reviewers: courbet, gchatelet Reviewed By: courbet Subscribers: tschuett, RKSimon, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57647 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353023 91177308-0d34-0410-b5e6-96231b3b80d8 Roman Lebedev 1 year, 9 months ago
1 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
315315 writeLatencySnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
316316 break;
317317 case InstructionBenchmark::Uops:
318 case InstructionBenchmark::InverseThroughput:
318319 writeUopsSnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
319320 break;
320321 default:
506507 }
507508 ClusterCenterPoint[I].PerInstructionValue = Representative[I].avg();
508509 }
510 } else if (Mode == InstructionBenchmark::InverseThroughput) {
511 for (int I = 0, E = Representative.size(); I < E; ++I) {
512 SchedClassPoint[I].PerInstructionValue =
513 MCSchedModel::getReciprocalThroughput(STI, *RSC.SCDesc);
514 ClusterCenterPoint[I].PerInstructionValue = Representative[I].min();
515 }
509516 } else {
510 llvm::errs() << "unimplemented measurement matching for mode " << Mode
511 << "\n";
517 llvm_unreachable("unimplemented measurement matching mode");
512518 return false;
513519 }
514520 return Clustering.isNeighbour(ClusterCenterPoint, SchedClassPoint);
518524 llvm::raw_ostream &OS) const {
519525 OS << ""; ";"; "; "; ";
520526 OS << "
ValidVariantNumMicroOpsLatency
521 "th>WriteProcRes
522 "resource (port) pressure assuming ideal distribution\">Idealized "
523 "Resource Pressure
527 "th>RThroughputWriteProcRes
528 "idealized unit resource (port) pressure assuming ideal "
529 "distribution\">Idealized Resource Pressure
524530 if (RSC.SCDesc->isValid()) {
525531 const auto &SM = SubtargetInfo_->getSchedModel();
526532 OS << "
539545 OS << "";
540546 }
541547 OS << "
548 // inverse throughput.
549 OS << "";
550 writeMeasurementValue(
551 OS,
552 MCSchedModel::getReciprocalThroughput(*SubtargetInfo_, *RSC.SCDesc));
553 OS << "
542554 // WriteProcRes.
543555 OS << "
    ";
544556 for (const auto &WPR : RSC.NonRedundantWriteProcRes) {