Burst + Xcode 13.3 builds for iOS/iPadOS/tvOS and IL2CPP + macOS

TL;DR - we’ve become aware of an issue when using Burst with Xcode 13.3 or newer to build for iOS/iPadOS/tvOS or using IL2CPP with macOS. The bug isn’t exactly a Burst issue, but what we believe to be a general Clang bug that we’ve uncovered affecting LLVM versions 12+, which manifests as a miscompilation of the Hash128 constructor as produced through IL2CPP, which causes issues in Burst with SharedStatic. To fix/workaround this, we’re going to have to land a fix for the Hash128 constructor to the 2022.1, 2021.3, and 2020.3 editors.

In the meantime we advise holding on the 13.2.1 release of Xcode when doing iOS/iPadOS/tvOS and IL2CPP with macOS builds with Burst.

The reason this issue manifests in Burst is when using SharedStatic’s. For those that do not know, SharedStatic’s use a Hash128 to create a hash of the types to GetOrCreate so that each SharedStatic gets a unique location in memory backing it. Burst and managed both have to generate the same hash for the same types to ensure they both access the same memory location, and we observed with Xcode 13.3 and newer that half of the hash was being incorrectly generated in the Hash128 constructor that was being produced via IL2CPP and compiled with Xcode’s Clang. This meant that Burst was accessing what it thought was a previously created SharedStatic, but since the managed side (IL2CPP) had used an incorrect hash, Burst was doing a null pointer dereference. Since SharedStatic’s are used so heavily in DOTS code (EG. the TypeManager in Entities), users using DOTS will be affected by the issue.

5 Likes

Hello @sheredom ! Is there any update on this or any bug tracking tickets we can follow? We have some folks whose iOS devices have been updated to an extent where they can no longer build without upgrading Xcode to 13.3

The PRs to Unity are landed my end, just waiting for them to go through the processes and go out as new editor patch versions.

The first editor with the fix is public - 2021.3.2 Unity 2021.3.2

IL2CPP: Workaround the Clang 12+ bug that could surface with IL2CPP by changing the Hash128 constructor code. (1422065)

1 Like

The next editor with the fix is public - 2022.1.1 Unity 2022.1.1

IL2CPP: Workaround the Clang 12+ bug that could surface with IL2CPP by changing the Hash128 constructor code. (1422065)

1 Like

The last editor with the fix is public - 2020.3.35 Unity 2020.3.35

IL2CPP: Workaround the Clang 12+ bug that could surface with IL2CPP by changing the Hash128 constructor code. (1422065)

This concludes the period where we advised you to hold on 13.2.1, and users should now be free to track the latest Xcode release.

1 Like

@sheredom I know this is a long shot but is there any chance at all that this issue or similar has persisted into 13.4.1, only for macOS builds but regardless of the scripting backend? For whatever reason Unity 2020.3 and 2021.3 just cannot get Burst to work for that.

1 Like

I’ve not seen this issue since I added the workarounds above. If you can submit a bug with a repro we can always take a look.

Already have, here is the link, thanks.
https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-13811

I also made a post about it here on the forum, with no response yet.