Fix crashes when system has 2 or more OpenCL platforms. Add async copy to device interface. Fixed completely broken Multi device. Add command throttle. #31836

Closed
opened 2012-06-14 19:50:22 +02:00 by Doug Gale · 13 comments

%%%Almost everywhere in blender, the code assumes there is only one platform, and blindly uses the first platform. When you have the Intel OpenCL SDK and a non-intel GPU, blender will always crash when showing the "system" tab of user preferences. It was also causing a crash when running in background mode with multiple OpenCL platforms present. This patch fixes that.

The Multi device was utterly broken, it was impossible to try to reuse the device_memory object like it tried to do because named const vars store refs to them. Therefore, each subdevice of a multi device must have a separate device_memory object. This fixes the completely broken Multi device.

The multi device did each memory copy using blocking writes. This meant that it had to wait for each memory copy to proceed sequentially, for each multi device. A new memory copy capability exists (that falls back to synchronous if the target implementation doesn't implement the new *_async extensions): they return an integer, which can later be used to wait for an async operation. You can also implicitly gather the operations and wait for them all later. The multi device uses it to convert all synchronous operations to a pair of concurrent async operations.

Blender was completely overloading the GPU queue, causing severe GUI slowdown to the point of loss of control of the machine. This was being caused by putting far too much work into the OpenCL work queue. A self-tuning throttling mechanism now manages queue depth, greatly improving GUI responsiveness while still keeping the GPU full with work.

I made the device_update function do all asynchronous transfers using the new functionality (it synchronizes at the end of the top level update). This allows nearly all (all?) memory transfers to proceed asynchronously, overlapping subsequent processing.

%%%

%%%Almost everywhere in blender, the code assumes there is only one platform, and blindly uses the first platform. When you have the Intel OpenCL SDK and a non-intel GPU, blender will always crash when showing the "system" tab of user preferences. It was also causing a crash when running in background mode with multiple OpenCL platforms present. This patch fixes that. The Multi device was utterly broken, it was impossible to try to reuse the device_memory object like it tried to do because named const vars store refs to them. Therefore, each subdevice of a multi device must have a separate device_memory object. This fixes the completely broken Multi device. The multi device did each memory copy using blocking writes. This meant that it had to wait for each memory copy to proceed sequentially, for each multi device. A new memory copy capability exists (that falls back to synchronous if the target implementation doesn't implement the new *_async extensions): they return an integer, which can later be used to wait for an async operation. You can also implicitly gather the operations and wait for them all later. The multi device uses it to convert all synchronous operations to a pair of concurrent async operations. Blender was completely overloading the GPU queue, causing severe GUI slowdown to the point of loss of control of the machine. This was being caused by putting far too much work into the OpenCL work queue. A self-tuning throttling mechanism now manages queue depth, greatly improving GUI responsiveness while still keeping the GPU full with work. I made the device_update function do all asynchronous transfers using the new functionality (it synchronizes at the end of the top level update). This allows nearly all (all?) memory transfers to proceed asynchronously, overlapping subsequent processing. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%Please disregard doug65536_opencl_patch.diff. I accidentally uploaded an old diff I had lying around. Use doug65536_opencl_patch2_IGNORE_OTHER_ONE.diff%%%

%%%Please disregard doug65536_opencl_patch.diff. I accidentally uploaded an old diff I had lying around. Use doug65536_opencl_patch2_IGNORE_OTHER_ONE.diff%%%
Sergey Sharybin self-assigned this 2015-04-03 12:51:22 +02:00

Most of the compilation error fixes and multi device are likely to be solved now anyway. There's still some interesting parts about async API usage, before doing that i think it makes sense to finish kernel split first, which is happening in D1200.

Assigning to self, so the work is not getting totally lost from the radars.

Most of the compilation error fixes and multi device are likely to be solved now anyway. There's still some interesting parts about async API usage, before doing that i think it makes sense to finish kernel split first, which is happening in [D1200](https://archive.blender.org/developer/D1200). Assigning to self, so the work is not getting totally lost from the radars.

Added subscriber: @tyoc213

Added subscriber: @tyoc213
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

poke

poke
Member

Has this gotten lost in the radar?

Has this gotten lost in the radar?

@Blendify, it's not lost but since split kernel work changed priorities. I would also ask to leave priority triaging reports to developers, especially if it was explicitly set by a developer.

@Blendify, it's not lost but since split kernel work changed priorities. I would also ask to leave priority triaging reports to developers, especially if it was explicitly set by a developer.
Member

Added subscriber: @MaiLavelle

Added subscriber: @MaiLavelle
Member

@MaiLavelle can this be closed?

@MaiLavelle can this be closed?

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'

Hi, thanks for your patch.

We are undergoing a Tracker Curfew where we are automatically closing old patches.

If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.

Hi, thanks for your patch. We are undergoing a [Tracker Curfew ](https://code.blender.org/?p=3861) where we are automatically closing old patches. If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#31836
No description provided.