MTL4FXTemporalDenoisedScaler initialization

I’m trying to use MTL4FXTemporalDenoisedScaler, and I’m seeing a crash during initialization even with a very simple sample app.

I created a minimal sample here: https://github.com/tatsuya-ogawa/MetalFXInitExample

The exception is:

NSException: "-[AGXG16XFamilyHeap baseObject]: unrecognized selector sent to instance ..."

What I found is: • This works: descriptor.makeTemporalDenoisedScaler(device: device) • This crashes: descriptor.makeTemporalDenoisedScaler(device: device, compiler: metal4Compiler)

So the issue seems to happen only with the Metal4FX version.

For testing, I’m using an iPhone 15 Pro. According to the Metal Feature Set Tables, MetalFX denoised upscaling should be supported on Apple9 and later, so I believe the device itself should meet the requirements.

Reference: https://aninterestingwebsite.com/metal/Metal-Feature-Set-Tables.pdf

Has anyone seen this before, or knows what might be causing it? I’d appreciate any advice.

Thanks.

The MTLFXTemporalDenoisedScalerDescriptor class provides a method specifically for checking Metal 4 FX support before creating the scaler:

+ (BOOL)supportsMetal4FX:(nonnull id<MTLDevice>)device;

In Swift:

if MTLFXTemporalDenoisedScalerDescriptor.supportsMetal4FX(device) {
    let scaler = descriptor.makeTemporalDenoisedScaler(device: device, compiler: metal4Compiler)
} else {
    let scaler = descriptor.makeTemporalDenoisedScaler(device: device)
}

In Objective-C:

if ([MTLFXTemporalDenoisedScalerDescriptor supportsMetal4FX:device]) {
    id<MTL4FXTemporalDenoisedScaler> scaler = [descriptor newTemporalDenoisedScalerWithDevice:device compiler:metal4Compiler];
} else {
    id<MTLFXTemporalDenoisedScaler> scaler = [descriptor newTemporalDenoisedScalerWithDevice:device];
}

Call this before attempting the Metal 4 path. Your iPhone 15 Pro (A17 Pro) likely returns false for this check, which means Metal 4 FX denoised upscaling isn't supported on that device. The non-Metal4 version works because you're already calling the corresponding supportsDevice: check (or the device does support it).

The crash you're seeing is the result of passing a Metal 4 compiler to a device that doesn't support the Metal 4 FX code path.

Thanks for the clarification. On my iPhone 15 Pro (A17 Pro), MTLFXTemporalDenoisedScalerDescriptor.supportsMetal4FX(device) actually returns true. In other words, because supportsMetal4FX(device) returns true on iPhone 15 Pro, I have no way to avoid taking the Metal 4 FX code path.

Thank you for testing that. Since supportsMetal4FX(_:) returns true on your iPhone 15 Pro but makeTemporalDenoisedScaler(device:compiler:) crashes, this is a framework bug — the capability check reports support, but initialization fails.

Please file a feedback report at https://feedbackassistant.apple.com and attach your sample project from GitHub. The crash in AGXG16XFamilyHeap points to an internal GPU driver issue that engineering will need to investigate. Post the feedback number here so we can track it.

In the meantime, use the non-Metal 4 path as a workaround:

let scaler = descriptor.makeTemporalDenoisedScaler(device: device)

This avoids the crash and still gives you temporal denoised upscaling, without the Metal 4 command buffer integration.

Thank you.I posted the feedback. FB22575333

MTL4FXTemporalDenoisedScaler initialization
 
 
Q