Regression: Tiled rendering is not applied to texture baking in 3.x onwards, causing crash on large bakes #100626

Open
opened 2022-08-25 09:54:09 +02:00 by Nathan Hayes · 6 comments

System Information
Operating system: Win10
Graphics card: AMD Radeon R9 280x
System RAM: 32gb

Blender Version
Broken: 3.2.2, branch: master, commit date: 2022-08-02 18:15, hash: bcfdb14560, type: release
(also tested Daily 3.2.2 and beta 3.3)

Worked: 2.8x, 2.9x, 2.9 LTS

Short description of error
Previously tile based rendering was applied when using the bake to texture feature, allowing baking to very large canvases. As of version 3.x tiled rendering no longer applies when baking textures and crashes on large canvases. In my case I can no longer bake to a texture larger than 2^14 (16384x16384).

Exact steps for others to reproduce the error

  • Open attached file or
    • From a new blend file, delete default cube,
    • switch renderer to Cycles (CPU).
    • Create a plane,
    • switch to UV and create a very large texture (in my case anything larger than 16384x16384, my previously and still working in 2.9x size is 19310x) with float precision and no alpha.
    • Create a new material,
    • remove the principled Shader,
    • connect the color output of a noise texture to the material output Surface,
    • add an Image Texture node and select the previously created canvas. In my case I disable bounces (set all to zero) and set samples to 1, Filtering to Box filtering.
    • Switch bake type to Emit.
  • Hit bake and blender crashes trying to allocate the memory for the render target canvas. Setting Tiled rendering to other sizes does not work either.

Notes:
I'm prebaking complex noise channels as it dramatically reduces render time on the final texture bake.
You may need to create an excessively large target canvas if you have a lot of ram.
When stopping a bake half way through on 2.9x and lower version you can see tile based rendering has taken effect and the sizes declared are used.
When stopping a texture bake on 3.x versions you can see that it is filling the entire canvas at once and not using tile based rendering, no matter what the tile size is set to.
bake_crash.blend

**System Information** Operating system: Win10 Graphics card: AMD Radeon R9 280x System RAM: 32gb **Blender Version** Broken: 3.2.2, branch: master, commit date: 2022-08-02 18:15, hash: bcfdb14560e7, type: release (also tested Daily 3.2.2 and beta 3.3) Worked: 2.8x, 2.9x, 2.9 LTS **Short description of error** Previously tile based rendering was applied when using the bake to texture feature, allowing baking to very large canvases. As of version 3.x tiled rendering no longer applies when baking textures and crashes on large canvases. In my case I can no longer bake to a texture larger than 2^14 (16384x16384). **Exact steps for others to reproduce the error** - Open attached file or - From a new blend file, delete default cube, - switch renderer to Cycles (CPU). - Create a plane, - switch to UV and create a very large texture (in my case anything larger than 16384x16384, my previously and still working in 2.9x size is 19310x) with float precision and no alpha. - Create a new material, - remove the principled Shader, - connect the color output of a noise texture to the material output Surface, - add an Image Texture node and select the previously created canvas. In my case I disable bounces (set all to zero) and set samples to 1, Filtering to Box filtering. - Switch bake type to Emit. - Hit bake and blender crashes trying to allocate the memory for the render target canvas. Setting Tiled rendering to other sizes does not work either. Notes: I'm prebaking complex noise channels as it dramatically reduces render time on the final texture bake. You may need to create an excessively large target canvas if you have a lot of ram. When stopping a bake half way through on 2.9x and lower version you can see tile based rendering has taken effect and the sizes declared are used. When stopping a texture bake on 3.x versions you can see that it is filling the entire canvas at once and not using tile based rendering, no matter what the tile size is set to. [bake_crash.blend](https://archive.blender.org/developer/F13417418/bake_crash.blend)
Author

Added subscriber: @N.Hayes

Added subscriber: @N.Hayes

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I can confirm the crash. It looks like the allocator doesn't support something with size 16106127360.

 	ucrtbase.dll!00007ffbf3f4dd7e()	Unknown
 	ucrtbase.dll!00007ffbf3f4d499()	Unknown
 	vcruntime140_1.dll!00007ffb7dfe1aab()	Unknown
 	vcruntime140_1.dll!00007ffb7dfe2317()	Unknown
 	vcruntime140_1.dll!00007ffb7dfe4119()	Unknown
 	ntdll.dll!00007ffbf6208b1f()	Unknown
 	ntdll.dll!00007ffbf6195b9a()	Unknown
 	ntdll.dll!00007ffbf6207b2e()	Unknown
 	KernelBase.dll!00007ffbf3a2474c()	Unknown
 	vcruntime140.dll!00007ffb7b8d66c0()	Unknown
>	blender.exe!ccl::device_memory::host_alloc(unsigned __int64 size) Line 52	C++

 	[Inline Frame] blender.exe!ccl::device_vector<float>::alloc(unsigned __int64 width, unsigned __int64 height, unsigned __int64) Line 381	C++
 	blender.exe!ccl::RenderBuffers::reset(const ccl::BufferParams & params_) Line 281	C++
 	[Inline Frame] blender.exe!ccl::PathTrace::update_allocated_work_buffer_params::__l2::<lambda_1>::operator()(ccl::PathTraceWork *) Line 279	C++
 	blender.exe!ccl::foreach_sliced_buffer_params<`ccl::PathTrace::update_allocated_work_buffer_params'::`2'::<lambda_1>>(const ccl::vector<std::unique_ptr<ccl::PathTraceWork,std::default_delete<ccl::PathTraceWork>>,ccl::GuardedAllocator<std::unique_ptr<ccl::PathTraceWork,std::default_delete<ccl::PathTraceWork>>>> & path_trace_works, const ccl::vector<ccl::WorkBalanceInfo,ccl::GuardedAllocator<ccl::WorkBalanceInfo>> & work_balance_infos, const ccl::BufferParams & buffer_params, const int overscan, const ccl::PathTrace::update_allocated_work_buffer_params::__l2::<lambda_1> & callback) Line 266	C++
 	blender.exe!ccl::PathTrace::update_allocated_work_buffer_params() Line 281	C++
 	blender.exe!ccl::PathTrace::update_work_buffer_params_if_needed(const ccl::RenderWork & render_work) Line 333	C++
 	blender.exe!ccl::PathTrace::init_render_buffers(const ccl::RenderWork & render_work) Line 347	C++
 	blender.exe!ccl::PathTrace::render_pipeline(ccl::RenderWork render_work) Line 186	C++
 	blender.exe!ccl::PathTrace::render(const ccl::RenderWork & render_work) Line 166	C++
 	blender.exe!ccl::Session::run_main_render_loop() Line 194	C++
 	blender.exe!ccl::Session::thread_render() Line 258	C++
 	blender.exe!ccl::Session::thread_run() Line 233	C++
 	[Inline Frame] blender.exe!std::_Func_class<void>::operator()() Line 878	C++
 	blender.exe!ccl::thread::run(void * arg) Line 37	C++
 	[External Code]	

I didn't know that Bake took advantage of "tile based rendering", but if that's the case, it makes sense to crash due to high memory usage.
One guess is that the problem was introduced in 0803119725, but i need to check.

I can confirm the crash. It looks like the allocator doesn't support something with size `16106127360`. ``` ucrtbase.dll!00007ffbf3f4dd7e() Unknown ucrtbase.dll!00007ffbf3f4d499() Unknown vcruntime140_1.dll!00007ffb7dfe1aab() Unknown vcruntime140_1.dll!00007ffb7dfe2317() Unknown vcruntime140_1.dll!00007ffb7dfe4119() Unknown ntdll.dll!00007ffbf6208b1f() Unknown ntdll.dll!00007ffbf6195b9a() Unknown ntdll.dll!00007ffbf6207b2e() Unknown KernelBase.dll!00007ffbf3a2474c() Unknown vcruntime140.dll!00007ffb7b8d66c0() Unknown > blender.exe!ccl::device_memory::host_alloc(unsigned __int64 size) Line 52 C++ [Inline Frame] blender.exe!ccl::device_vector<float>::alloc(unsigned __int64 width, unsigned __int64 height, unsigned __int64) Line 381 C++ blender.exe!ccl::RenderBuffers::reset(const ccl::BufferParams & params_) Line 281 C++ [Inline Frame] blender.exe!ccl::PathTrace::update_allocated_work_buffer_params::__l2::<lambda_1>::operator()(ccl::PathTraceWork *) Line 279 C++ blender.exe!ccl::foreach_sliced_buffer_params<`ccl::PathTrace::update_allocated_work_buffer_params'::`2'::<lambda_1>>(const ccl::vector<std::unique_ptr<ccl::PathTraceWork,std::default_delete<ccl::PathTraceWork>>,ccl::GuardedAllocator<std::unique_ptr<ccl::PathTraceWork,std::default_delete<ccl::PathTraceWork>>>> & path_trace_works, const ccl::vector<ccl::WorkBalanceInfo,ccl::GuardedAllocator<ccl::WorkBalanceInfo>> & work_balance_infos, const ccl::BufferParams & buffer_params, const int overscan, const ccl::PathTrace::update_allocated_work_buffer_params::__l2::<lambda_1> & callback) Line 266 C++ blender.exe!ccl::PathTrace::update_allocated_work_buffer_params() Line 281 C++ blender.exe!ccl::PathTrace::update_work_buffer_params_if_needed(const ccl::RenderWork & render_work) Line 333 C++ blender.exe!ccl::PathTrace::init_render_buffers(const ccl::RenderWork & render_work) Line 347 C++ blender.exe!ccl::PathTrace::render_pipeline(ccl::RenderWork render_work) Line 186 C++ blender.exe!ccl::PathTrace::render(const ccl::RenderWork & render_work) Line 166 C++ blender.exe!ccl::Session::run_main_render_loop() Line 194 C++ blender.exe!ccl::Session::thread_render() Line 258 C++ blender.exe!ccl::Session::thread_run() Line 233 C++ [Inline Frame] blender.exe!std::_Func_class<void>::operator()() Line 878 C++ blender.exe!ccl::thread::run(void * arg) Line 37 C++ [External Code] ``` I didn't know that Bake took advantage of "tile based rendering", but if that's the case, it makes sense to crash due to high memory usage. One guess is that the problem was introduced in 0803119725, but i need to check.
Philipp Oeser changed title from Tiled rendering is not applied to texture baking in 3.x onwards, causing crash on large bakes to Regression: Tiled rendering is not applied to texture baking in 3.x onwards, causing crash on large bakes 2022-09-03 12:29:38 +02:00

Added subscriber: @brecht

Added subscriber: @brecht

Memory was reduced significantly with support for tiled rendering, even if there is more room for optimization. Will reduce priority here since it's not a show stopper anymore.

Memory was reduced significantly with support for tiled rendering, even if there is more room for optimization. Will reduce priority here since it's not a show stopper anymore.
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:04:09 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 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#100626
No description provided.