SPIRV-REMAP(1)

πŸ’… SPIRV-REMAP β€” ok bestie, let's talk about spirv-remap(1)

Like, this is a General Commands Manual page, and it's about a utility that squishes SPIR-V binaries. Sit down, hydrate, let's go. ✨


🌸 NAME 🌸

spirv-remap β€” a utility to compress of SPIR-V binary files πŸŽ€

(yes, the original says "to compress of". I don't make the rules, I just report them. periodt.)


πŸ¦‹ SYNOPSIS πŸ¦‹

spirv-remap [OPTION]...

That's it. That's the whole vibe. Options only, no positional drama. πŸ’…


✨ DESCRIPTION ✨

Okay so spirv-remap is a utility that makes SPIR-V binary files compress better by reducing entropy. It can also optionally strip debug info and do load/store optimization, if you're feeling spicy. It transforms SPIR-V to SPIR-V, and along the way it remaps IDs. πŸ”

And here's the tea: the resulting modules have an increased ID range β€” like, IDs are not as tightly packed around zero anymore. Sounds bad? Nope, it's giving glow up. Because when you compress multiple modules together, they compress better, since the compressor's dictionary can find better cross-module commonality. Cross-module commonality is the friend group of compression, fr fr. 🫢

The way remapping works is via canonicalization. Which means you can compress modules one at a time with no loss of quality compared to operating on a whole pile of modules at once. Iconic. The command line tool only handles multiple modules in the trivial repetition sense, purely for ease of use. The remapper API? It only accepts a single module at a time. One at a time. Boundaries. 🧚

⚠️ Real talk: spirv-remap is currently in an alpha state. There are no known remapping defects, but it has only been exercised on one real world game shader workload. So like, it's a talented baby. Be gentle. 😭

πŸ”₯ OPTIONS πŸ”₯

  • -? --help β€” shows help. the classic cry for guidance πŸ’–
  • -V --version β€” shows version. who are you, really ✨
  • -v -vv ... --verbose [int] β€” sets verbosity. And listen: with no verbosity, the command is silent. no thoughts, head empty, zero output 🀫
  • -i --input file1 [file2...] β€” files to process. feed it the files bestie πŸ“
  • -o --output DESTDIR β€” output directory. where the glow-up gets delivered πŸ“¦
  • -s --strip-all --strip all β€” strips all debug info. goodbye secrets πŸ™ˆ
  • --map (all|types|names|funcs) β€” canonicalizes type IDs / named data / function bodies. pick your fighter πŸ‘‘
  • --dce (all|types|funcs) β€” removes dead types / functions. rip to them but they're different πŸ’€
  • --opt (all|loadstore) β€” optimizes unneeded loads/stores. waste not want not 🌈
  • --do-everything β€” Synonym for --map all --dce all --opt all --strip all. the full send. main character energy only ⭐

πŸŽ€ RETURNS πŸŽ€

  • 0 on success β€” slay βœ…
  • a positive integer error on failure β€” not slay, but informative ❌

🌈 EXAMPLES 🌈

Example one β€” the remap moment:

spirv-remap -v --map all --input *.spv --output /tmp/out_dir

Perform ID remapping on all shaders in "*.spv", writing new files with the same basenames to /tmp/out_dir. cute, clean, basenames preserved, no chaos. 🫢

Example two β€” the everything bagel:

spirv-remap-linux-64 -v --do-everything --input *.spv --output /tmp/out_dir

Perform all possible size reductions. maximum shrinkage. πŸ”₯

Note that

(that's it. that's the whole note. the original page literally just says "Note that" and then stops. I am not making this up. the sentence never arrives. it's giving cliffhanger. πŸ˜­πŸ’€)


πŸ’œ ALSO SEE πŸ’œ


🧚 Sign-off 🧚

That's the page, bestie β€” it came from User Commands, dated December 2017, and it lives under the name SPIRV-REMAP(1). Go compress something and make it tiny and gorgeous. byeee πŸ’–βœ¨πŸŽ€