Cycles differences between CPU and GPU in this World nodes #53348

Closed
opened 2017-11-19 14:51:08 +01:00 by YAFU · 13 comments

System Information
Kubuntu 14.04 - GTX 960

Blender Version
Broken: 2.79 official, master

Short description of error
First of all, I'm not good with nodes. This may be due to a bug, or a bad configuration of nodes on my part. If it is the latter, sorry for inconveniences.
There are differences between GPU or CPU. In 2.79 release CPU render some circular stripes, still result different from GPU. From Master CPU does not render any texture.

Exact steps for others to reproduce the error

World_cpu_gpu_differences.blend
Open scene. Render with CPU or GPU (or combined from master)

**System Information** Kubuntu 14.04 - GTX 960 **Blender Version** Broken: 2.79 official, master **Short description of error** First of all, I'm not good with nodes. This may be due to a bug, or a bad configuration of nodes on my part. If it is the latter, sorry for inconveniences. There are differences between GPU or CPU. In 2.79 release CPU render some circular stripes, still result different from GPU. From Master CPU does not render any texture. **Exact steps for others to reproduce the error** [World_cpu_gpu_differences.blend](https://archive.blender.org/developer/F1159561/World_cpu_gpu_differences.blend) Open scene. Render with CPU or GPU (or combined from master)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @YAFU

Added subscriber: @YAFU

Added subscriber: @Sergey

Added subscriber: @Sergey
Sergey Sharybin self-assigned this 2017-11-22 17:57:08 +01:00

Root of the issue is coming from precision issue on GPU. The thing here is that gradient texture always gives black color is such configuration, which effectively causes division by zero. Now, even though we use safe division (as in, we check whether denominator is zero or not), this does not help on GPU. Root of this issue goes to --fast-math we use for CUDA. Disabling fast math solves this issue, but gives about 15% of slowdown.

Can try using some more granular flags, but this requires some time.

Root of the issue is coming from precision issue on GPU. The thing here is that gradient texture always gives black color is such configuration, which effectively causes division by zero. Now, even though we use safe division (as in, we check whether denominator is zero or not), this does not help on GPU. Root of this issue goes to `--fast-math` we use for CUDA. Disabling fast math solves this issue, but gives about 15% of slowdown. Can try using some more granular flags, but this requires some time.
Sergey Sharybin removed their assignment 2017-11-23 10:25:15 +01:00
Brecht Van Lommel was assigned by Sergey Sharybin 2017-11-23 10:25:15 +01:00

Added subscriber: @brecht

Added subscriber: @brecht

@brecht. didn't manage to find combination of flags which will solve the artifacts without introducing speed regression. More and more tempting to declare "just avoid numerical issues in shaders". But maybe you want to have a try here? (maybe disable fast divisions and use approx intrinsic when it's needed?)

@brecht. didn't manage to find combination of flags which will solve the artifacts without introducing speed regression. More and more tempting to declare "just avoid numerical issues in shaders". But maybe you want to have a try here? (maybe disable fast divisions and use approx intrinsic when it's needed?)
Author

Hi.
I was just trying to get a quick background for the BA weekend challenge. I'm not even sure if those nodes are being used well here, and neither is it common to use it in World nodes. If you ask me, I prefer speed :) . But I have no idea, perhaps the problem that jumped here could affect other cases, and since we have GPU + CPU combined render, differences are more sensitive.
The nodes in Material render similar on GPU and CPU:
World_cpu_gpu_differences_1.blend

Hi. I was just trying to get a quick background for the BA weekend challenge. I'm not even sure if those nodes are being used well here, and neither is it common to use it in World nodes. If you ask me, I prefer speed :) . But I have no idea, perhaps the problem that jumped here could affect other cases, and since we have GPU + CPU combined render, differences are more sensitive. The nodes in Material render similar on GPU and CPU: [World_cpu_gpu_differences_1.blend](https://archive.blender.org/developer/F1178974/World_cpu_gpu_differences_1.blend)

This issue was referenced by blender/cycles@dbe9eec374

This issue was referenced by blender/cycles@dbe9eec374916d07a3389068891d2fffb2921823

This issue was referenced by e50ed90e4d

This issue was referenced by e50ed90e4dff3a01fd5e3211f3571a34e1d6855d

In the gradient texture we end up computing 1 - length(unit_length_vector) which is supposed to be exactly zero, but of course in practice float precision means it's not. I'll bias it a little bit now to make it exactly zero. We have tweaks like that in other places too, like the checker texture. It helps to make things a bit more robust also when rendering with only the CPU or GPU.

In general I think we want to keep the fast math enabled, even if it risks issues like this.

In the gradient texture we end up computing `1 - length(unit_length_vector)` which is supposed to be exactly zero, but of course in practice float precision means it's not. I'll bias it a little bit now to make it exactly zero. We have tweaks like that in other places too, like the checker texture. It helps to make things a bit more robust also when rendering with only the CPU or GPU. In general I think we want to keep the fast math enabled, even if it risks issues like this.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @Roken

Added subscriber: @Roken

poolproblem.blend This exhibits the same problem. The experimental GPUCPU render really highlights it.

[poolproblem.blend](https://archive.blender.org/developer/F1264212/poolproblem.blend) This exhibits the same problem. The experimental GPUCPU render really highlights it.
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#53348
No description provided.