LLVM-REMARK-SIZE-DIFF(1)

πŸ’… NAME πŸ’…

okay so this is the LLVM-REMARK-SIZE-DIFF(1) manual page, and it's literally the bestie for diffing size remarks. The command is llvm-remark-size-diff β€” diff size remarks. periodt.

✨ SYNOPSIS ✨

llvm-remark-size-diff [options] file_a file_b –parser parser

πŸ’– DESCRIPTION πŸ’–

llvm-remark-size-diff diffs size remarks in two remark files: file_a and file_b. no cap.

You can use llvm-remark-size-diff to gain insight into which functions were impacted the most by code generation changes. it's giving β€œwho got bigger, who got smaller” energy and honestly it ate.

In most common use-cases file_a and file_b will be remarks output by compiling a fixed source with differing compilers or differing optimization settings.

llvm-remark-size-diff handles both YAML and bitstream remarks. πŸ¦‹

πŸŽ€ OPTIONS πŸŽ€

  • --parser=<yaml|bitstream> β€” select the type of input remark parser. Required, bestie β€” this one is mandatory.
    • yaml: the tool will parse YAML remarks.
    • bitstream: the tool will parse bitstream remarks.
  • --report-style=<human|json> β€” output style.
    • human: human-readable textual report. Default option.
    • json: JSON report.
  • --pretty β€” pretty-print JSON output. Optional.
    • If output is not set to JSON, this does nothing. literally nothing, iykyk.
  • -o=<file> β€” output file for the report. Outputs to stdout by default.

πŸ¦‹ HUMAN-READABLE OUTPUT πŸ¦‹

The human-readable format for llvm-remark-size-diff is composed of two sections:

  • Per-function changes.
  • A high-level summary of all changes.

πŸ’… Changed Function Section

Suppose you are comparing two remark files OLD and NEW.

For each function with a changed instruction count in OLD and NEW, llvm-remark-size-diff will emit a line like below:

(++|--|==) (>|<) function_name, N instrs, M stack B

A breakdown of the format is below:

  • (++|--|==) β€” which of OLD and NEW the function_name is present in.
    • ++: only in NEW. (β€œAdded”)
    • --: only in OLD. (β€œRemoved”)
    • ==: in both.
  • (>|<) β€” denotes if function_name has more instructions or fewer instructions in the second file.
    • >: more instructions in second file than first file.
    • <: fewer instructions in second file than in first file.
  • function_name β€” the name of the changed function.
  • N instrs β€” second file instruction count - first file instruction count.
  • M stack B β€” second file stack byte count - first file stack byte count.

🌈 Summary Section

llvm-remark-size-diff will output a high-level summary after printing all changed functions.

instruction count: N (inst_pct_change%)
stack byte usage: M (sb_pct_change%)
  • N β€” sum of all instruction count changes between the second and first file.
  • inst_pct_change% β€” percent increase or decrease in instruction count between the second and first file.
  • M β€” sum of all stack byte count changes between the second and first file.
  • sb_pct_change% β€” percent increase or decrease in stack byte usage between the second and first file.

⭐ JSON OUTPUT ⭐

πŸ‘‘ High-Level view

Suppose we are comparing two files, OLD and NEW.

llvm-remark-size-diff will output JSON as follows.

"Files": [
  "A": "path/to/OLD",
  "B": "path/to/NEW"
]

"InBoth": [
  ...
],

"OnlyInA": [
  ...
],

"OnlyInB": [
  ...
]
  • Files β€” original paths to remark files.
    • A: path to the first file.
    • B: path to the second file.
  • InBoth β€” functions present in both files.
  • OnlyInA β€” functions only present in the first file.
  • OnlyInB β€” functions only present in the second file.

πŸ“ Function JSON

The InBoth, OnlyInA, and OnlyInB sections contain size information for each function in the input remark files.

{
  "FunctionName" : "function_name"
  "InstCount": [
      INST_COUNT_A,
      INST_COUNT_B
    ],
  "StackSize": [
      STACK_BYTES_A,
      STACK_BYTES_B
    ],
}
  • FunctionName β€” name of the function.
  • InstCount β€” instruction counts for the function.
    • INST_COUNT_A: instruction count in OLD.
    • INST_COUNT_B: instruction count in NEW.
  • StackSize β€” stack byte counts for the function.
    • STACK_BYTES_A: stack bytes in OLD.
    • STACK_BYTES_B: stack bytes in NEW.

🧚 Computing Diffs From Function JSON

Function JSON does not contain the diffs. Tools consuming JSON output from llvm-remark-size-diff are responsible for computing the diffs separately.

To compute the diffs:

  • Instruction count diff: INST_COUNT_B - INST_COUNT_A
  • Stack byte count diff: STACK_BYTES_B - STACK_BYTES_A

πŸ’€ EXIT STATUS πŸ’€

llvm-remark-size-diff returns 0 on success, and a non-zero value otherwise. slay.

πŸ™ˆ AUTHOR

Maintained by the LLVM Team (https://llvm.org/). 🫢

2003-2023, LLVM Project


πŸ’– later, bestie β€” this page is from LLVM version 15, dated 2023-07-14, and it's the LLVM-REMARK-SIZE-DIFF(1) manual. πŸŽ€

πŸ“¦ where this page comes from