Metal compiler crashing on XCode 8 / tvOS 10.0

I am seeing the following crash attempting to compile my apps for tvOS 10.0 with XCode 8. In addition all of the existing versions of my apps are crashing on tvOS 10.0.


CompileMetalFile MagicWindowTV/MWFragmentRGBA.metal
    cd "/Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV"
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/usr/bin/metal -arch air64 -emit-llvm -c -gline-tables-only -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk -ffast-math -serialize-diagnostics /Users/joshm/Library/Developer/Xcode/DerivedData/MagicWindowTV-bhkaproqjkjwbhbxwzeteeclerti/Build/Intermediates/MagicWindowTV.build/Debug-appletvos/Earthlapse.build/Metal/MWFragmentRGBA.dia -o /Users/joshm/Library/Developer/Xcode/DerivedData/MagicWindowTV-bhkaproqjkjwbhbxwzeteeclerti/Build/Intermediates/MagicWindowTV.build/Debug-appletvos/Earthlapse.build/Metal/MWFragmentRGBA.air "" /Users/joshm/Projects/Magic\ Window\ Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal
Invalid cast from half* to half addrspace(1)*
0  metal                    0x0000000103f2ce89 void* llvm::object_creator<llvm::StringMap<void*, llvm::MallocAllocator> >() + 43657
1  metal                    0x0000000103f2c636 void* llvm::object_creator<llvm::StringMap<void*, llvm::MallocAllocator> >() + 41526
2  metal                    0x0000000103f2d85f void* llvm::object_creator<std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >() + 767
3  libsystem_platform.dylib 0x00007fff88da852a _sigtramp + 26
4  libsystem_platform.dylib 0x0000000000000004 _sigtramp + 1998945012
5  libsystem_c.dylib        0x00007fff862026e7 abort + 129
6  metal                    0x000000010439299b clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2065037
7  metal                    0x00000001043dda9f clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2372497
8  metal                    0x00000001043dd35d clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2370639
9  metal                    0x00000001043fa0c0 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2488754
10 metal                    0x00000001043f054c clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2448958
11 metal                    0x00000001043f0516 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2448904
12 metal                    0x00000001043c6919 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2277899
13 metal                    0x00000001043c81da clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2284236
14 metal                    0x00000001043c75c6 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2281144
15 metal                    0x00000001043c5d7a clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2274924
16 metal                    0x0000000104438c01 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2745587
17 metal                    0x0000000104434bb0 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2729122
18 metal                    0x000000010443420a clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2726652
19 metal                    0x0000000104439280 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2747250
20 metal                    0x000000010444bd49 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2823739
21 metal                    0x000000010445b7ab clang::CodeGen::CGBuilderInserter<false>::InsertHelper(llvm::Instruction*, llvm::Twine const&, llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>) const + 56461
22 metal                    0x000000010445998f clang::CodeGen::CGBuilderInserter<false>::InsertHelper(llvm::Instruction*, llvm::Twine const&, llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>) const + 48753
23 metal                    0x000000010445c2a2 clang::CodeGen::CGBuilderInserter<false>::InsertHelper(llvm::Instruction*, llvm::Twine const&, llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>) const + 59268
24 metal                    0x00000001044926a3 clang::CodeGen::CGBuilderInserter<false>::InsertHelper(llvm::Instruction*, llvm::Twine const&, llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>) const + 281477
25 metal                    0x0000000104442ac6 clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::makeValue(clang::ASTContext const&, clang::Decl*) + 2786232
26 metal                    0x00000001045e77ca llvm::Registry<clang::PluginASTAction, llvm::RegistryTraits<clang::PluginASTAction> >::entries() + 544200
27 metal                    0x0000000104563dca llvm::Registry<clang::PluginASTAction, llvm::RegistryTraits<clang::PluginASTAction> >::entries() + 5064
28 metal                    0x000000010453b92c clang::CodeGen::CGBuilderInserter<false>::InsertHelper(llvm::Instruction*, llvm::Twine const&, llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>) const + 974350
29 metal                    0x00000001045904c4 llvm::Registry<clang::PluginASTAction, llvm::RegistryTraits<clang::PluginASTAction> >::entries() + 187074
30 metal                    0x00000001033362ce
31 metal                    0x00000001033391c0
32 libdyld.dylib            0x00007fff9421d5ad start + 1
33 libdyld.dylib            0x0000000000000039 start + 1809721997
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/usr/bin/metal -cc1 -triple air64-apple-tvos10.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-llvm-bc -emit-llvm-uselists -disable-free -disable-llvm-verifier -main-file-name MWFragmentRGBA.metal -mrelocation-model static -mthread-model posix -mdisable-fp-elim -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -freciprocal-math -ffp-contract=fast -ffast-math -masm-verbose -target-linker-version 241.4 -gline-tables-only -gdwarf-2 -dwarf-column-info -coverage-file /Users/joshm/Library/Developer/Xcode/DerivedData/MagicWindowTV-bhkaproqjkjwbhbxwzeteeclerti/Build/Intermediates/MagicWindowTV.build/Debug-appletvos/Earthlapse.build/Metal/MWFragmentRGBA.air -resource-dir /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/usr/bin/../lib/clang/3.5 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk -Wmtl-shader-return-type -Werror=mtl-shader-return-type -fdebug-compilation-dir /Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=ios-10.0.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -serialize-diagnostic-file /Users/joshm/Library/Developer/Xcode/DerivedData/MagicWindowTV-bhkaproqjkjwbhbxwzeteeclerti/Build/Intermediates/MagicWindowTV.build/Debug-appletvos/Earthlapse.build/Metal/MWFragmentRGBA.dia -o /Users/joshm/Library/Developer/Xcode/DerivedData/MagicWindowTV-bhkaproqjkjwbhbxwzeteeclerti/Build/Intermediates/MagicWindowTV.build/Debug-appletvos/Earthlapse.build/Metal/MWFragmentRGBA.air -x metal /Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal
1. /Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal:114:1 <Spelling=/Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal:104:50>: current parser token '\
fragment'
2. /Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal:113:1 <Spelling=<scratch space>:51:1>: LLVM IR generation of declaration 'videoFrameFragBlendedRGB_None'
3. /Users/joshm/Projects/Magic Window Current/magicwindow/MagicWindowTV/MagicWindowTV/MWFragmentRGBA.metal:113:1 <Spelling=<scratch space>:51:1>: Generating code for declaration 'videoFrameFragBlendedRGB_None'
metal: error: unable to execute command: Abort trap: 6
metal: error: clang frontend command failed due to signal (use -v to see invocation)
LLVM version 3.5
Target: air64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/usr/bin
metal: note: diagnostic msg: PLEASE submit a bug report to http:/
metal: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
metal: note: diagnostic msg: /var/folders/_w/v_2rm09s7zz6qqs6ys7scnxc0000gn/T/MWFragmentRGBA-472751.metal
metal: note: diagnostic msg: /var/folders/_w/v_2rm09s7zz6qqs6ys7scnxc0000gn/T/MWFragmentRGBA-472751.sh
metal: note: diagnostic msg:
********************

Replies

Has anyone seen anything similar to this on their apps on XCode 8? Any suggestions as to how to proceed? I went to the LLVM bug filing page listed here and it feels like a path to nowhere. Posted to Radar 27292187.

Thanks for filing, we'll take a look.