Blender gives weird ouput when baking (4096*4096) resolution on GPU #41222

Closed
opened 2014-07-28 12:37:48 +02:00 by RadiationG0D · 37 comments
RadiationG0D commented 2014-07-28 12:37:48 +02:00 (Migrated from localhost:3001)

System Information
Desktop PC:
Win 7 Home Premium
CPU: AMD FX-4170 (Quad, 4.20 GHz)
GPU: (Asus) GTX 560 Ti DirectCUII Top

Laptop:
Win 7 Professional
CPU: Intel Core i7 3520m (2,9GHz)
GPU: Nvidia Quadro K2000m

Blender Version
Broken: 2.71 9337574

Short description of error
Blender gives weird ouput when baking uv-map on GPU at a resolution of 4096*4096. CPU works normal but takes a lot more time than GPU would've.
Higher resolutions are not tested as of now.

Output can be seen here

Exact steps for others to reproduce the error
Bake the cube in the blend file with GPU on a resolution of 4096*4096

brokenuvcube.blend

**System Information** Desktop PC: Win 7 Home Premium CPU: AMD FX-4170 (Quad, 4.20 GHz) GPU: (Asus) GTX 560 Ti DirectCUII Top Laptop: Win 7 Professional CPU: Intel Core i7 3520m (2,9GHz) GPU: Nvidia Quadro K2000m **Blender Version** Broken: 2.71 9337574 **Short description of error** Blender gives weird ouput when baking uv-map on GPU at a resolution of 4096*4096. CPU works normal but takes a lot more time than GPU would've. Higher resolutions are **not** tested as of now. Output can be seen [here](http://i.stack.imgur.com/nqIOJ.jpg) **Exact steps for others to reproduce the error** Bake the cube in the blend file with GPU on a resolution of 4096*4096 [brokenuvcube.blend](https://archive.blender.org/developer/F99994/brokenuvcube.blend)
RadiationG0D commented 2014-07-28 12:37:49 +02:00 (Migrated from localhost:3001)
Author

Changed status to: 'Open'

Changed status to: 'Open'
RadiationG0D commented 2014-07-28 12:37:49 +02:00 (Migrated from localhost:3001)
Author

Added subscriber: @RadiationG0D

Added subscriber: @RadiationG0D
RadiationG0D commented 2014-07-28 12:50:37 +02:00 (Migrated from localhost:3001)
Author

The bake was attempted with cycles

The bake was attempted with cycles
Dalai Felinto was assigned by Sergey Sharybin 2014-07-28 14:00:47 +02:00

Added subscriber: @Sergey

Added subscriber: @Sergey

For some reason i can't reproduce the issue here on linux, but form the code side it's really bad idea to multiply image width by height and store it in int, size_t is to be used in this cases.

I've started moving to size_t there http://www.pasteall.org/53120/diff but the issue is -- we can't pass it via API. So afraid the only way is to pass width,height to the baker and multiply them in the baker.

For some reason i can't reproduce the issue here on linux, but form the code side it's really bad idea to multiply image width by height and store it in int, size_t is to be used in this cases. I've started moving to size_t there http://www.pasteall.org/53120/diff but the issue is -- we can't pass it via API. So afraid the only way is to pass width,height to the baker and multiply them in the baker.

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

@Sergey at the moment we can bake an object with multiple materials/target images at once, which means there is no real width and height. We can get some fictional values, but often we will end up with width being 1 or 2. So the problem will likely still be there (assuming that's the issue). (that would work for the case reported here though).

See D688 - in particular calculate_buffer_dimension() in object_bake_api.c
(@RadiationG0D can you see if this patch fix the issue for you)?

Another option is to not pass num_pixels, and tweak rna_BakePixel_next_get() to return NULL, so in Cycles we populate the baking data dynamically until we get a NULL from bp->next (in populate_bake_data).

Or ... to find a way to pass size_t to python. Isn't 'k' enough for that?
https://docs.python.org/3/c-api/arg.html

@ThomasDinges can you reproduce this issue in your CUDA-friendly machine?

@Sergey at the moment we can bake an object with multiple materials/target images at once, which means there is no real width and height. We can get some fictional values, but often we will end up with width being 1 or 2. So the problem will likely still be there (assuming that's the issue). (that would work for the case reported here though). See [D688](https://archive.blender.org/developer/D688) - in particular calculate_buffer_dimension() in object_bake_api.c (@RadiationG0D can you see if this patch fix the issue for you)? Another option is to not pass num_pixels, and tweak rna_BakePixel_next_get() to return NULL, so in Cycles we populate the baking data dynamically until we get a NULL from bp->next (in populate_bake_data). Or ... to find a way to pass size_t to python. Isn't 'k' enough for that? https://docs.python.org/3/c-api/arg.html @ThomasDinges can you reproduce this issue in your CUDA-friendly machine?
RadiationG0D commented 2014-07-28 21:20:20 +02:00 (Migrated from localhost:3001)
Author

Added subscriber: @dfelinto

Added subscriber: @dfelinto
RadiationG0D commented 2014-07-28 21:20:20 +02:00 (Migrated from localhost:3001)
Author

@dfelinto - I'm afraid I don't know how to test the patch..? I was directed here from blender.stackexchange.com and though intrested in programming and such, I'm not sure what you would like me to do. I suppose it would not be enough to download the latest blender from blender.org?

@dfelinto - I'm afraid I don't know how to test the patch..? I was directed here from blender.stackexchange.com and though intrested in programming and such, I'm not sure what you would like me to do. I suppose it would not be enough to download the latest blender from blender.org?
Author

This issue was referenced by 1607bcebc65fd5296f9f695e76580a1ae7ade9a2

This issue was referenced by 1607bcebc65fd5296f9f695e76580a1ae7ade9a2

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 1607bcebc6.

Closed by commit 1607bcebc6.

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

closed by 'mistake' while pushing the test to build bot. re-opening now.

@RadiationG0D can you try downloading a build from here [ link ]? This has the patch applied to it.

(note, the build may be overridden any soon, so please download it as soon as you can).

closed by 'mistake' while pushing the test to build bot. re-opening now. @RadiationG0D can you try downloading a build from here [ [link ](https://builder.blender.org/download/testbuild-blender-2.71-1607bce-win64.zip) ]? This has the patch applied to it. (note, the build may be overridden any soon, so please download it as soon as you can).

For comparison you can test the above build against a more recent one, such as [ link ].

For comparison you can test the above build against a more recent one, such as [ [link ](https://builder.blender.org/download/blender-2.71-34937f6-win64.zip) ].
RadiationG0D commented 2014-07-28 22:31:35 +02:00 (Migrated from localhost:3001)
Author

The ouptut is better, but far from good. Also, the progressbar seemed to show progress now which it has not before :)

Same .blend:
Output:
4096.png

The ouptut is better, but far from good. Also, the progressbar seemed to show progress now which it has not before :) Same .blend: Output: ![4096.png](https://archive.blender.org/developer/F100062/4096.png)

Also, the progressbar seemed to show progress now which it has not before :)

This is unrelated, it's one of the new features for the upcoming Blender 2.72.

How about the other pass types? I think you are hitting some memory limit in your system, though I don't think it's relate to the patch. Did you try the other build too? (the more recent one from master).

> Also, the progressbar seemed to show progress now which it has not before :) This is unrelated, it's one of the new features for the upcoming Blender 2.72. How about the other pass types? I think you are hitting some memory limit in your system, though I don't think it's relate to the patch. Did you try the other build too? (the more recent one from master).
RadiationG0D commented 2014-07-28 22:39:38 +02:00 (Migrated from localhost:3001)
Author

Other pass types, like bake types?
I've set up cache at 4096MB at maximum though my gpu has only 1GB I think. (System has 8GB RAM otherwise)
I will try the other build now...

Other pass types, like bake types? I've set up cache at 4096MB at maximum though my gpu has only 1GB I think. (System has 8GB RAM otherwise) I will try the other build now...

Added subscriber: @zeauro

Added subscriber: @zeauro

No problem to bake 4096 on ubuntu 14.04 with CUDA 6 Nvidia driver 340.24 with Titan Black

No problem to bake 4096 on ubuntu 14.04 with CUDA 6 Nvidia driver 340.24 with Titan Black
RadiationG0D commented 2014-07-28 22:46:10 +02:00 (Migrated from localhost:3001)
Author

The second link gives similar output.

The second link gives similar output.

Added subscriber: @mib2berlin

Added subscriber: @mib2berlin

Hi, bake work with my GTX 760 4 GB but not with my GTX 560Ti 448 1.28 GB.
Result with GTX 560Ti 448:

http://www.pasteall.org/pic/show.php?id=74660

Opensuse 13.1/64
Intel i5 3770K
GTX 760 4 GB (Display)
GTX 560Ti 1.28 GB 448 Cores
Driver 340.24

Cheers, mib

Hi, bake work with my GTX 760 4 GB but not with my GTX 560Ti 448 1.28 GB. Result with GTX 560Ti 448: http://www.pasteall.org/pic/show.php?id=74660 Opensuse 13.1/64 Intel i5 3770K GTX 760 4 GB (Display) GTX 560Ti 1.28 GB 448 Cores Driver 340.24 Cheers, mib

I can easily bake 4K x 4K texture on my gt520m with 1gig ram, but that's on linux, will test win7 later a bit. It looks like some particular setup issue or something up to the particular kernel (can't redo the issue forcing sm_20 for usage tho).

So some questions just to be sure:

  • Can you consistently reproduce the issue o both desktop and laptop?
  • Did you try installing latest video drivers and CUDA toolkit?
  • Am i right lower resolution rendering works just fine to you?

Will also check gtx560ti this evening from home, maybe that'd give some clues as well.

I can easily bake 4K x 4K texture on my gt520m with 1gig ram, but that's on linux, will test win7 later a bit. It looks like some particular setup issue or something up to the particular kernel (can't redo the issue forcing sm_20 for usage tho). So some questions just to be sure: - Can you consistently reproduce the issue o both desktop and laptop? - Did you try installing latest video drivers and CUDA toolkit? - Am i right lower resolution rendering works just fine to you? Will also check gtx560ti this evening from home, maybe that'd give some clues as well.
RadiationG0D commented 2014-07-29 13:59:50 +02:00 (Migrated from localhost:3001)
Author

I can consistently reproduce the problem on the GTX but the quadro seems to be working fine today.

I'm currently running driver v. 337.88 on my GTX 560 Ti (latest). The laptop drivers are probably not the latest but I'm not sure since the update mechanism for Quadro is a bit diffrent.

I have not tried the CUDA toolkit, but I've never heard of it before though..

Lower resolution solves the problem, yes.

I can consistently reproduce the problem on the GTX but the quadro seems to be working fine today. I'm currently running driver v. 337.88 on my GTX 560 Ti (latest). The laptop drivers are *probably* not the latest but I'm not sure since the update mechanism for Quadro is a bit diffrent. I have not tried the CUDA toolkit, but I've never heard of it before though.. Lower resolution solves the problem, yes.

Hi, try again with own file and can reproduce error on GTX 560Ti 448.
Just for info, the GTX 560Ti 448 is a cut back GTX 570 and a sm_20 card.
Regular GTX 560Ti is a sm_21 card.

Cheers, mib

Hi, try again with own file and can reproduce error on GTX 560Ti 448. Just for info, the GTX 560Ti 448 is a cut back GTX 570 and a sm_20 card. Regular GTX 560Ti is a sm_21 card. Cheers, mib

@Sergey the problem is that we copy a big chunk of memory and pass that to CUDA. See D690 (it bakes a chunk of 3k * 3k at a time). This works fine in mi2berlin's GPUs.

That said I think the fix should be in device_cuda.cpp::task_add(). It would make more sense to me if for baking CUDA could split the task according to the memory size. So, to do the equivalent of D690 but internally, in the device code.

[about size_t I agree that we should change that, but let's keep that discussion in the patch - D688 - since I don't think it's entirely related to this issue]

@Sergey the problem is that we copy a big chunk of memory and pass that to CUDA. See [D690](https://archive.blender.org/developer/D690) (it bakes a chunk of 3k * 3k at a time). This works fine in mi2berlin's GPUs. That said I think the fix should be in device_cuda.cpp::task_add(). It would make more sense to me if for baking CUDA could split the task according to the memory size. So, to do the equivalent of [D690](https://archive.blender.org/developer/D690) but internally, in the device code. [about size_t I agree that we should change that, but let's keep that discussion in the patch - [D688](https://archive.blender.org/developer/D688) - since I don't think it's entirely related to this issue]
Author

This issue was referenced by a48b372b04

This issue was referenced by a48b372b04421b00644a0660bfdf42229b5ffceb

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit a48b372b04.

Closed by commit a48b372b04.

Hi, make another tests with buildbot with commit a48b372b04 from dfelinto and got same weird output with GTX 560Ti 448 1.28 GB and 4096x4096 pixel.
3072x3072 is working.
Testing my own build with change device_cuda.cpp to 512 * 512 or 256 * 256 give same error.

Testfile brokenuvcube.blend and own file.

Opensuse 13.1/64
Intel i5 3770K
GTX 760 4 GB (Display)
GTX 560Ti 1.28 GB 448 Cores
Driver 340.24

4097.jpeg

Cheers, mib

Hi, make another tests with buildbot with commit a48b372b04 from dfelinto and got same weird output with GTX 560Ti 448 1.28 GB and 4096x4096 pixel. 3072x3072 is working. Testing my own build with change device_cuda.cpp to 512 * 512 or 256 * 256 give same error. Testfile brokenuvcube.blend and own file. Opensuse 13.1/64 Intel i5 3770K GTX 760 4 GB (Display) GTX 560Ti 1.28 GB 448 Cores Driver 340.24 ![4097.jpeg](https://archive.blender.org/developer/F101583/4097.jpeg) Cheers, mib

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

Worked for me yesterday, will check with buildbot.

Worked for me yesterday, will check with buildbot.
Author

This issue was referenced by 983cbafd18

This issue was referenced by 983cbafd1877f8dbaae60b064a14e27b5b640f18
Author

This issue was referenced by 2c5b6859d9

This issue was referenced by 2c5b6859d91f086f3f7205f0cc15244882ca7ace

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 2c5b6859d9.

Closed by commit 2c5b6859d9.
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#41222
No description provided.