LLVM-REMARK-SIZE-DIFF(1)

πŸ“¦ version 15.0.7, in opensuse-leap 16.0

πŸ’… LLVM-REMARK-SIZE-DIFF πŸ’…

okay so bestie, welcome to the llvm-remark-size-diff page β€” it's part of the LLVM manual set (yes, that LLVM, the big one πŸ‘‘), and it's genuinely one of the most underrated little tools in the whole box. let's get into it 🫢


✨ NAME ✨

llvm-remark-size-diff β€” diff size remarks, that's the whole vibe πŸ’–


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

So like. llvm-remark-size-diff diffs size remarks in two remark files: file_a and file_b. that's it, that's the job, and it ate πŸ’…

You use it to gain insight into which functions were impacted the most by code generation changes. literally a glow-up detector for your functions πŸ”₯

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. same source, different compiler, and this tool tells you who got bigger and who got smaller. main character energy fr fr ✨

llvm-remark-size-diff handles both YAML and bitstream remarks. both! versatile icon πŸ’–


⭐ OPTIONS ⭐

  • --parser=<yaml|bitstream> β€” Select the type of input remark parser. Required. ngl you literally cannot skip this one πŸ™ˆ
    • yaml: The tool will parse YAML remarks.
    • bitstream: The tool will parse bitstream remarks.
  • --report-style=<human|json> β€” Output style. pick your aesthetic πŸŽ€
    • 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. like, it just sits there being cute and useless 🫠

  • -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. the grand finale, the recap, the "so how did we do" moment πŸ’…

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. yeah. the math is on you bestie, we just hand you the numbers πŸ™ˆ

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 when it works, 😭 when it doesn't.


πŸ‘‘ AUTHOR πŸ‘‘

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


2003-2023, LLVM Project


and that's the whole page bestie, you're officially a size-remark scholar now, no cap πŸŽ“βœ¨ this was LLVM-REMARK-SIZE-DIFF(1), manual page 15, dated 2023-01-14, straight from the LLVM corner of the universe β€” go diff some remarks and have the best day πŸ’–πŸ¦‹πŸŒΈ periodt.

πŸ“¦ where this page comes from