MTLDevice.currentAllocatedSize incorrect on late 2014 iMacs

I have two iMacs where MTLDevice.currentAllocatedSize is acting strange--the reported size keeps rising, despite periodically freeing resources to keep under MTLDevice.recommendedMaxWorkingSetSize.

The affected iMacs are both late 2014 models running MacOS Big Sur 11.6, one with an AMD Radeon R9 M290X and the other with an AMD Radeon R9 M295X.

So far none of our other Macs have shown this behaviour, which suggests this may be an API or driver problem.

I do have the option of using my own resource size estimates, but that's likely not as accurate as what the system reports, assuming MTLDevice.currentAllocatedSize is working properly.

Any suggestions?

Replies

Hi dwn,

Some amount of growth could be expected because of caching mechanisms happening behind the scenes. I recommend disabling the GPU capture and debug layers and verifying if the behavior persists. If this is still the case, I definitely encourage you to file a Feedback Assistant ticket with us so we can investigate the problem.

  • The reported size grows to the hundreds of megabytes to several gigabytes with no apparent upper limit, and it happens when running a release build outside of Xcode, so it's likely to be related to caching or GPU capture. I'll write up a Feedback Assistant ticket, but it may be hard to reproduce since I don't have physical access to the affected devices.

Add a Comment

Those functions don't deal with the small allocation sub-allocation strategy used with 128K buffers. So gpu capture tends to just report 128K for the sizes regardless of whether each buffer is shared inside the same 128K buffer. The tool needed to dedupe those allocations. I filed a forum post and feedback assistant on this, and Apple was looking to fix the issue.