Cycles: Metal support for OpenImageDenoise #116124
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116124
Loading…
Reference in New Issue
No description provided.
Delete Branch "Stefan_Werner/blender:oidn_metal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enabling the Metal backend In OpenImageDenoise.
WIP label is here because this patch requires a public release of a version of OpenImageDenoise with built-in Metal support. The build_environment CMake script in this PR is still pointing at the 2.1.0 URL and hash and needs to be updated once the release is out.
@ -14,6 +14,7 @@ if(NOT APPLE)
${OIDN_EXTRA_ARGS}
-DOIDN_DEVICE_SYCL=ON
-DOIDN_DEVICE_SYCL_AOT=OFF
-DOIDN_DEVICE_METAL=ON
if(NOT APPLE)
block doesn't seem to be the correct location for this setting :)True.
Since OIDN 2.2 with Metal support is out (
9db3b38d50
), we should move forward with this PR.WIP: Metal support for OIDNto Cycles: Metal support for OpenImageDenoiseI have committed new macOS Arm libraries with OIDN metal support.
I'm getting an error when trying this in the viewport:
Also an assert when stopping viewport render:
This PR seems to be incomplete. The Metal backend doesn't support pointers, buffers must be used instead. This logic is missing from the code.
Here's a fix:
bcd2f39a81
The only remaining issue is that I had to disable the following workaround because OIDN doesn't support managed Metal buffers yet:
82942c7f2a/intern/cycles/device/metal/device_impl.mm (L729)
Is this workaround still needed? If it is, I could fix this in OIDN very quickly (today) but we'll then need to create a new release candidate.
I merged the patch from @aafra into this PR.
@aafra I would prefer to keep the workaround if we can, we haven't really raised our macOS version and GPU minimum requirements since that workaround was made, so it could still affect someone.
We can also apply a patch on our side if needed.
@brecht Do you know which GPUs or macOS versions actually need this workaround? OIDN supports Metal only on Apple silicon and macOS Ventura and later, so the workaround could be disabled only in these cases. It would be quite strange if M chips with unified memory would require managed memory for anything.
I'm not sure, maybe @Michael-Jones remembers. The commit message does not mention it.
The buildbot uses an M1 and macOS Ventura (13.x), so we'll see if the baking tests still fail.
@blender-bot build macos
I did a few test runs with that workaround removed on the 4.0 release branch, and the tests all still passed. It never really made sense why we needed it in the first place, so other than it being a mystery I think it should be safe to remove
Ok, I've removed that workaround in main now. The baking tests are still passing too.
The denoising tests are failing though:
Strange. I’ll run the tests locally and report back whether I get these errors too.
Do you think the x86 compositor failures could be related?
The compositor tests are just because this branch is slightly behind main, they can be ignored.
I just ran the tests on an M2 Max + Sonoma and only the compositor tests failed. But it seems
cycles_denoise_metal
didn't run at all. I simply ranmake test
. Do I need to do anything special to run this test too?It seems none of the Metal tests appear in the list of tests when running locally. How is it possible to enable them?
In
CMakeCache.txt
, setCYCLES_TEST_DEVICES:STRING=CPU;METAL
It worked, thanks!
M2 Max on Sonoma:
I'm now trying a different machine.
I finally managed to reproduce the issue. The problem happens when running the OIDN binaries on Ventura, which were compiled with an Xcode targeting the newer Sonoma by default. I think the problem is simply that the deployment target is not set when compiling OIDN's Metal shaders. I will create a new OIDN release candidate with the fix today, after which I think we should be able to merge this. I hope it won't be too late for Blender 4.1.
Thanks for figuring that out. It's fine, this can still make it to 4.1.
Attila found the fix and released an rc2 with it, here is a PR to adopt it: #117902
Let's try this again with the fix in the libraries.
@blender-bot build macos
That worked, thanks all.