Cycles: Improve error reporting of large textures on HIP #118239
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#118239
Loading…
Reference in New Issue
No description provided.
Delete Branch "Alaska/blender:better-hip-texture-warning"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
HIP fails to allocate textures, typically when they are too large.
This commit lets the user know what might be causing the issue
rather than providing a confusing internal error message.
Thank you to Brecht for helping out with this.
This is a desired feature as mentioned in #91571
This pull request handles the better error reporting. I am unsure how to handle the automatic resizing, and it's out of the scope of this pull request and not worth discussing here.
@ -651,1 +651,4 @@
/* hipDeviceAttributeMaxTexture2D... reports a supported texture size 1 larger than what's
* actually supported. */
int max_width = get_device_default_attribute(hipDeviceAttributeMaxTexture2DWidth, 16384) - 1;
Did you find this out just by testing, is it documented somewhere, .. ?
I think it's not ideal to just subtract one:
I found it out by testing. I'm not sure if it's documented somewhere.
The issue of being off by one has been around for a while (atleast 3 years). In this comment, it is pointed out that HIP has a texture size limit of 16384, yet when the user tried a texture of size 16384, they still had errors. This is my experience as well.
In that comment, it says that width 16384 failed while 8192 worked. So it's off by one in the power, where it's 2^13 = 8192 instead of 2^14 = 16384. Not 16383 instead of 16384.
What I suspect is that it's like OpenGL, and there isn't actually a single maximum because it depends on the precision, channels and dimensions. It might support a 1 channel byte image at that resolution, but not a 4 channel float image.
I think a better solution here would be to check for errors returned by
hipTexObjectCreate
,hipDrvMemcpy2DUnaligned
,hipDrvMemcpy3D
andhipArray3DCreate
. Maybe they already tell us that the resolution is not supported, or maybe it's a more vague error where we can hint to the user what the possible cause is.That way we don't stop a texture from being created when it is supported.
Looking at some API docs, it doesn't seem like we get much about the error from these functions. Take for example, hipTexObjectCreate. It either returns
hipSuccess = 0 (Texture creation was success)
orhipErrorInvalidVale = 1 (One of the values is unacceptable)
Some of the other functions (E.G.
hipDrvMemcpy2DUnaligned
,hipDrvMemcpy3D
) can return different values, but nothing particularly useful other than success, or some sort of error due to an invalid value.At the moment I've added an error message for
hipTexObjectCreate
. I just wanted to check with you if this is the kind of thing you wanted before I continued on with the other parts. Are there any changes you would like to wording? Possibly include reports on the resolution being used or the limits?It seems many different texture types are handled in
tex_alloc
. 1D, 2D, and 3D. I just wanted to check, where do all these shapes come from? This is just so I create scenes that have errors and test them.Cycles: Improve error reporting of large textures on HIPto WIP: Cycles: Improve error reporting of large textures on HIPI don't think 1D textures are used currently, but if we do use them I think it would be fine to just call them "texture" still. For 3D you could use "volume texture".
@ -857,2 +857,3 @@
hip_assert(hipTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL));
/* Returns 0 if successful. Returns other values depending on the error. */
if (hipTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL)) {
This type of change looks fine. Would prefer != 0 for clarity, and
string_printf
is not needed if it's just a plain string.I would suggest for the message.
81138cecfa
tofe8e27ad17
At the moment I only have an error message for
hipTexObjectCreate
because in my testing, this is the only place that reports errors when the texture is too large.We could try to implement a more descriptive error message with a code change like this:
c4ef916438
What are your thoughts?
WIP: Cycles: Improve error reporting of large textures on HIPto Cycles: Improve error reporting of large textures on HIPI prefer to keep it simple and not do that, especially since the information is unreliable.
In which case, this pull request is ready for the final review/merging.