📘

Metal code をオフラインコンパイルするメモ

に公開

シンタックスだけ確認したいとか,
事前コンパイルしたいとか...

https://developer.apple.com/documentation/metal/building-a-shader-library-by-precompiling-source-files

xcrun -sdk macosx metalmetal コマンドがあります.

実態は

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal

で中身としては clang.

そのため '.cu' な CUDA ソースファイルとか与えると cuda モードになり

metal: error: cannot find libdevice for sm_35; provide path to different CUDA installation via '--cuda-path', or pass '-nocudalib' to build without linking with libdevice

などとエラーをだす.

https://qiita.com/syoyo/items/4e60543aded0210fde49

Discussion