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);
Hello,

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

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.

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

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”).
How to disable Metal compiler warnings for SceneKit / ARKit?
 
 
Q