metallib is bigger than metal

I have a simple "vertex shader" in metal file. and then use

metal.exe -std=ios-metal1.1 mios-version-min=8.0 -c test.metal -o test.air 
metalilb.exe test.air -o test.metallib 

metal.exe/metalib.exe is under folder "Metal Developer Toos"/ios/bin/ ("Metal Develop tools for windows")

I found that the .metallib file(3434 bytes) is bigger than the origin metal file(995 bytes)

is that right ?? how explain it ?

Hi ZoGo996,

Indeed, this is expected behavior. The metallib file is a binary format containing a bytecode representation of your shader programs that is optimized for MTLLibrary and pipeline state object creation. As such, its size will typically be larger than the source code that produced it. A very similar situation can be observed with classic CPU programs, where a few KB of source code usually generate an executable one order of magnitude larger, typically a few MB in size.

metallib is bigger than metal
 
 
Q