dougallj / applegpu

Apple G13 GPU architecture docs and tools
BSD 3-Clause "New" or "Revised" License
545 stars 40 forks source link

Looking for suggestions #47

Open kenfuliang opened 1 year ago

kenfuliang commented 1 year ago

Hi,

Will it be possible to have sample file (code.bin) on the repo? I guess the code.bin is generated with compiler_explorer.py. If yes, maybe we can have a sample metal file (sample.metal) to generate code.bin as well.

thanks for sharing this project,

TellowKrinkle commented 1 year ago

code.bin is a raw AGX binary, I used to get them using a hex editor and copying out the part that looked like AGX code, but I haven't touched that since compiler_explorer.py was added (which calls disassemble internally so you don't have to).

Unless you have a raw AGX binary with no headers that you'd like to decompile, just pass it to compiler_explorer.py and it'll probably do what you want (it autodetects metal source, metallibs, and compiled binary archives and does the right thing for each). If you'd like a sample metal file, you can always use the one in hwtestbed (python3 compiler_explorer.py hwtestbed/compute.metal).

You can inspect the compiler_explorer.py source to see the tools it uses to get partial results, including raw AGX binaries if you really want them, but most likely you just want to run it.

...we should probably update the readme