Regression: LightTree failing with large number of emitters #106876

Closed
opened 2023-04-13 01:42:45 +02:00 by Mark Bolstad · 8 comments

System Information
Operating system: MacOS 13.3.1
Graphics card: AMD Radeon Vega 20

Blender Version
Broken: latest git version
Worked: 3.5.1
Most likely broken by 17c8e0d309

Short description of error
With a large number of emitters cycles crashes in LightManager::device_update_tree. From what I can see, the left and right index stacks are hard-coded to 32 ints, and the stack_id variable eventually reaches 35

Exact steps for others to reproduce the error
I'd love to send you the blend file, but the test case is 1.3GB. Let me know if you want it. But to reproduce:

  1. Download the San Miguel test scene with materials (https://casual-effects.com/g3d/data10/research/model/San_Miguel/San_Miguel.zip)
  2. Open the .obj and globally replace all of the material definitions to use the same material (in my scene, I globally replaced with "usemtl material_036". It doesn't matter what, you just need to have all the objects have the same material.
  3. Import into a new blender scene
  4. Add a default sun and camera, set renderer to cycles
  5. Put a breakpoint in LightManager::device_update_tree, render (inline), and look at kintegrator->num_distribution. It should be 1.
  6. Edit the unified material and set the emission color to white. Re-render. num_distribution will now be ~10million and the code with crash with a segfault and stack_id > 32.

*I'm writing a converter for cycles that takes MaterialX as input and exports OSL shaders. I'm doing something stupid that makes cycles think that every object is an emitter, and tripped this bug.

**System Information** Operating system: MacOS 13.3.1 Graphics card: AMD Radeon Vega 20 **Blender Version** Broken: latest git version Worked: 3.5.1 Most likely broken by 17c8e0d309 **Short description of error** With a large number of emitters cycles crashes in LightManager::device_update_tree. From what I can see, the left and right index stacks are hard-coded to 32 ints, and the stack_id variable eventually reaches 35 **Exact steps for others to reproduce the error** I'd love to send you the blend file, but the test case is 1.3GB. Let me know if you want it. But to reproduce: 1. Download the San Miguel test scene with materials (https://casual-effects.com/g3d/data10/research/model/San_Miguel/San_Miguel.zip) 2. Open the .obj and globally replace all of the material definitions to use the same material (in my scene, I globally replaced with "usemtl material_036". It doesn't matter what, you just need to have all the objects have the same material. 3. Import into a new blender scene 4. Add a default sun and camera, set renderer to cycles 5. Put a breakpoint in LightManager::device_update_tree, render (inline), and look at kintegrator->num_distribution. It should be 1. 6. Edit the unified material and set the emission color to white. Re-render. num_distribution will now be ~10million and the code with crash with a segfault and stack_id > 32. *I'm writing a converter for cycles that takes MaterialX as input and exports OSL shaders. I'm doing something stupid that makes cycles think that every object is an emitter, and tripped this bug.
Mark Bolstad added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-13 01:42:45 +02:00
Iliya Katushenock added the
Interest
Render & Cycles
label 2023-04-13 08:04:53 +02:00

In step 5 kintegrator->num_distribution was 2 in my case.
In step 6, I got stack overflow, so in either way, this looks like a bug.

In step 5 `kintegrator->num_distribution` was 2 in my case. In step 6, I got stack overflow, so in either way, this looks like a bug.
Richard Antalik changed title from LightTree failing with large number of emitters to Regression: LightTree failing with large number of emitters 2023-04-14 06:28:48 +02:00

Broken between 84b66c5a9c and bb2dc141f2, will bisect

Broken between 84b66c5a9c47 and bb2dc141f22f, will bisect

I was able to bisect to point between db762d5508 and 17c8e0d309, but there was another issue that resulted in crash in different place

17c8e0d309 looks like is first bad commit. CC @weizhen @brecht

I was able to bisect to point between db762d55087 and 17c8e0d309a, but there was another issue that resulted in crash in different place 17c8e0d309a looks like is first bad commit. CC @weizhen @brecht
Member

Hi, I don't think 17c8e0d309 caused the issue. The light tree uses a bit trail with int type, which limits the tree depth to a maximum of 32, so it is expected that it will fail when dealing with a large number of emitters. I vaguely recall that there is an assert somewhere but I was unable to locate it.
However, #106683 proposes to build a separate subtree for each unique mesh, that would probably bypass this issue by splitting the tree in smaller parts. We could revisit this report after that pull request is merged and see if it resolves the issue.

Hi, I don't think 17c8e0d309 caused the issue. The light tree uses a bit trail with `int` type, which limits the tree depth to a maximum of 32, so it is expected that it will fail when dealing with a large number of emitters. I vaguely recall that there is an assert somewhere but I was unable to locate it. However, #106683 proposes to build a separate subtree for each unique mesh, that would probably bypass this issue by splitting the tree in smaller parts. We could revisit this report after that pull request is merged and see if it resolves the issue.

There are only 4-ish commits between mentioned revisions, only 17c8e0d309 is cycles related.
I can check #106683 to see if it resolves the issue

There are only 4-ish commits between mentioned revisions, only 17c8e0d309 is cycles related. I can check #106683 to see if it resolves the issue

@weizhen I can confirm, that #106683 does resolve this issue.

@weizhen I can confirm, that #106683 does resolve this issue.
Member

@iss the pull request is merged as bfd1836861, can you check if we can close the issue now?

@iss the pull request is merged as bfd1836861, can you check if we can close the issue now?

This can be closed indeed.

This can be closed indeed.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-04-17 16:32:46 +02:00
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
4 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#106876
No description provided.