You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been playing with Bazel and apple_metal_library rule for a small project to compile MSL shaders. While it serves its purpose, I found it pretty challenging to generate symbols companion file for the metal library. These are pretty useful during development stages. So I'm curious if there are any suggestions or room for a PR :)
Internally apple_metal_library works in two phases:
generate air files (like xcrun -sdk macosx metal -o Shadow.ir -c Shadow.metal {COPTS})
and then combining set of air files into a library (like xcrun -sdk macosx metallib -o LightsAndShadow.metallib Lights.metalar Shadow.ir)
Add -frecord-sources to step 2 (so add anothe COPTS for linking stage?)
Separate the sources from the library and create a companion symbol file by running the metal-dsymutil command. (like % xcrun -sdk macosx metal-dsymutil -flat -remove-source LightsAndShadow.metallib)
This is quite complex.
Slightly easier option would be to simplify current implementation and reduce it to just one command:
For current scenario, the command would look like:
% xcrun -sdk macosx metal -o default.metallib Shadow.metal PointLights.metal DirectionalLight.metal
I've been playing with Bazel and
apple_metal_library
rule for a small project to compile MSL shaders. While it serves its purpose, I found it pretty challenging to generate symbols companion file for the metal library. These are pretty useful during development stages. So I'm curious if there are any suggestions or room for a PR :)Internally
apple_metal_library
works in two phases:xcrun -sdk macosx metal -o Shadow.ir -c Shadow.metal {COPTS}
)xcrun -sdk macosx metallib -o LightsAndShadow.metallib Lights.metalar Shadow.ir
)So to support debug symbols generation with multiple commands, we need:
-frecord-sources
COPTS in step 1.-frecord-sources
to step 2 (so add anothe COPTS for linking stage?)% xcrun -sdk macosx metal-dsymutil -flat -remove-source LightsAndShadow.metallib
)This is quite complex.
Slightly easier option would be to simplify current implementation and reduce it to just one command:
For current scenario, the command would look like:
With debug symbols:
Which can be satisfied via existing COPTS param.
cc: @aaronsky
The text was updated successfully, but these errors were encountered: