Thanks for the reply! During the last couple of days, this has turned into quite a mysterious journey. I am now at the point where I don't think it has anything to do with UIKit at all, and might possibly be more widespread.
Here's what I have tried:
presentsWithTransaction = true, maximumDrawableCount = 3, custom Metal view using CADisplayLink set to 60 fps, present(_: ): 12-20-12 cadence occurs sometimes, mostly after interactions with UIKit
presentsWithTransaction = true, maximumDrawableCount = 3, custom Metal view using CADisplayLink set to 60 fps, present(afterMinimumDuration: 0.016): 12-20-12 cadence persists. From my perspective, this is already an indication that something under the hood might be wrong: why is a frame being displayed for 12 ms when the minimum duration is set to 16 ms?
I have then started to take out most of my custom code, starting with replacing my custom Metal view with an MTKView. The problem persisted. I then took out my custom UIKit overlay - still, the problem persisted. I tried switching to double-buffering by setting maximumDrawableCount = 2 - now, the 12-20-12 cadence seems to occur all the time, not just after interactions with UIKit.
Today, I wanted to try a different approach and started from a blank Xcode project. I added an MTKView, set preferredFramesPerSecond = 60 and: the 12-20-12 cadence showed up again(!).
I have uploaded the project here.
I have also noticed that when I set the minimum duration to 0.016 when double-buffering, the frames are being displayed for much longer (around 250 ms). The two problems might be unrelated, but this behavior can also be found in the sample project and I wanted to at least mention it here.
FB9860634
Post
Replies
Boosts
Views
Activity
The ones that have been reported happened on iOS 15.6.1 and 15.5. Simply removing the input argument with the [[threads_per_simdgroup]] attribute and hardcoding a value has worked as a temporary workaround btw, though obviously not optimal.
The ones that have been reported happened on iOS 15.6.1 and 15.5.
(For some reason, my comments keep disappearing, so I'll just post this as an answer.)
The crashes that have been reported happened on iOS 15.6.1 and 15.5 and on every launch, not just from time to time.
As a side note, removing the input argument with the [[threads_per_simdgroup]] attribute from the kernel function and replacing it with a hardcoded value works as a temporary fix, though obviously not optimal.
I wanted to follow up with a quick update, since quite some time has passed since I first made this post.
Sadly, the problem still exists on all of my test iPads with ProMotion, updated to iPadOS 15.7, in my eyes significantly downgrading the user experience for apps targeting 60 fps.
The 12-20-12 cadence can be observed via Metal System Trace with my minimal sample project uploaded here.
The problem disappears as soon as the display refresh rate is limited "externally" by Low Power Mode, making the app run noticeably smoother.
Interestingly, I have yet to see the issue on iPhones with ProMotion.
I can see that there are probably more urgent problems to solve, but would be really thankful if this issue could be looked at again.
Update:
Solved by disabling Metal API Validation.
Update: Solved by including the binary Metallib in the "Resources" directory of the app instead of the framework.