How to disable Metal compiler warnings for SceneKit / ARKit?

The Metal compiler when invoked by SceneKit is generating a lot of spurious warnings in iOS / iPadOS 14 Beta 7 & 8. This seems to be causing a significant degradation in performance for our SceneKit/ARKit-based app.

Is there any way to disable this unnecessary Metal compiler logging? I tried making a MTLCOMPILERFLAGS = -w environment variable, but it didn't seem to have any effect.

Feedback ID FB8618939.

Logging looks like this:
2020-09-09 14:23:33.700122-0700 App[4672:1638397] [Metal Compiler Warning] Warning: Compilation succeeded with: 



programsource:95:26: warning: unused function 'reduceop'

    static inline float4 reduceop(float4 d0, float4 d1)

                         ^

program
source:581:26: warning: unused variable 'scnshadowsamplerordz'

static constexpr sampler scnshadowsamplerordz = sampler(coord::normalized, filter::linear, mipfilter::none, address::clamptoedge, comparefunc::greaterequal);

                         ^

2020-09-09 14:23:33.962519-0700 App[4672:1638397] [Metal Compiler Warning] Warning: Compilation succeeded with: 



program
source:95:26: warning: unused function 'reduceop'

    static inline float4 reduce
op(float4 d0, float4 d1)

                         ^

programsource:581:26: warning: unused variable 'scnshadowsamplerordz'

static constexpr sampler scn
shadowsamplerordz = sampler(coord::normalized, filter::linear, mipfilter::none, address::clamptoedge, comparefunc::greaterequal);

Replies

Hello,

Same issue here since iOS14.
Still haven't found any workaround ;(

Post not yet marked as solved Up vote reply of Gil Down vote reply of Gil
Still no improvement in this week's iOS 14.5 Beta 4 and macOS 11.3 Beta 4. And still no help from Apple on a workaround. Sigh.
Post not yet marked as solved Up vote reply of lenk Down vote reply of lenk

I got the following response from Apple's feedback assistant regarding the issue,

  • Just tested the performance using today's Xcode 13.0 and iOS 15.0 beta 1 builds and there is still NO improvement. The shader compiles still occur on the DisplayLink event, freezing the whole UI for long periods of time (300-400 msec per model).

    There are also only minor changes to SceneKit APIs in iOS 15 / macOS 12 for Swift async, but there are significant changes and enhancements to RealityKit APIs. It sure looks like SceneKit has been abandoned.

  • It does seem as though SceneKit has been abandoned @lenk - I haven’t found any mention of it this WWDC. That’s really a shame because I think SceneKit has a great place in iOS. I don’t really feel comfortable continuing to use SceneKit in my apps if Apple clearly has no intention of maintaining it. There are already some bugs I wish could be fixed, let alone this compiler issue being introduced.

    Can RealityKit be used for non-AR use cases? If not, what is the recommended stack for apps with 3D features that aren’t AR? Unity is great for games, but often the 3D aspect is just one feature that needs to be integrated with the rest of the user interface.

Add a Comment

Our team had a similar issue with Metal Compiler Warning in the Xcode console log. One side note is that even though the Xcode log says that it is a Warning, the Xcode Instruments tool says it's an Error.

I was able to spend a 1/2 hour with two Metal engineers during WWDC Lab hours. The discussion with that team was useful and hopefully this helps others down the line:

  • Be sure to test outside of Xcode, as Xcode does Extra Metal Validation. Here are two entries in our log related at the start of the Metal portion of the code.
    • Metal GPU Frame Capture Enabled
    • Metal API Validation Enabled
  • In the Simulator, the container path changes, possibly every time (TBD), which could cause the Metal code to be re-compiled
  • While using instrumentation via Xcode Instruments, be sure to watch for the MetalCompilerService in Instruments and the Console logs.
  • Verify if the Metal Compiler Warnings go away in the condition after a reboot (“ this is expected to happen”).