这是indexloc提供的服务,不要输入任何密码
Skip to content

How should implementations cope with Metal's 500k resources per-process soft-limit? #5441

@teoxoy

Description

@teoxoy

While working on some OOM tests I noticed that resource creation on Metal will become extremely slow once a threshold of 500k resources (textures, buffers) is reached.

The main issue here is that this seems to be a soft-limit meaning that resource creation will succeed but will take a long time instead of returning an OOM error, it's also undocumented.

Other anecdotal evidence I found online:

Instead, the 500k limit appears to be the maximal number of resources your application can use. Every time you create a texture object, Metal driver adds a descriptor to the hidden descriptor pool. If you try to create a lot of textures, you will experience major slowdown. No idea whether there is a hardware limitation or a driver implementation limit. And since it's fairly unlikely that a game will actually need half a million textures (not with current GPU memory sizes anyway), I don't see this limitation being relevant in practice for the next few years.

posted by jcookie in this thread: https://developer.apple.com/forums/thread/697590

Since this seems to be a per-process limit we can't add a limit to the WebGPU API for it (related: #5142 (comment)). The other solution I can think of is counting the nr of resources alive in a process and start returning OOM errors if a threshold is reached. Is 500k the threshold on all hardware/drivers? cc @mwyrzykowski

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions