GPU: Add platform parameter for GPU architecture #112566

Merged
Clément Foucault merged 6 commits from Jason-Fielder/blender:GPUPlatformArchitectureParam into main 2023-09-28 12:50:05 +02:00
Member

Authored by Apple: Michael Parkin-White

Authored by Apple: Michael Parkin-White
Jason Fielder added 1 commit 2023-09-19 12:11:04 +02:00
8b5c9e5077 GPU: Add platform parameter for GPU architecture
Authored by Apple: Michael Parkin-White
Jason Fielder requested review from Jeroen Bakker 2023-09-19 12:11:34 +02:00
Jason Fielder requested review from Clément Foucault 2023-09-19 12:11:43 +02:00
Jeroen Bakker reviewed 2023-09-19 12:41:57 +02:00
@ -56,2 +56,4 @@
} eGPUSupportLevel;
typedef enum eGPUArchitectureType {
GPU_ARCHITECTURE_IMR = 0,
Member

These terms are not clear.
If I look further in the code it is unified memory or not.

Think eGPUMemoryModel would be more appropriate as an GPU architecture is typically used to refer to a processor type or series. Possible values might be
GPU_MEMORY_MODEL_INTEGRATED
GPU_MEMORY_MODEL_DEDICATED
GPU_MEMORY_MODEL_UNIFIED

These terms are not clear. If I look further in the code it is unified memory or not. Think eGPUMemoryModel would be more appropriate as an GPU architecture is typically used to refer to a processor type or series. Possible values might be GPU_MEMORY_MODEL_INTEGRATED GPU_MEMORY_MODEL_DEDICATED GPU_MEMORY_MODEL_UNIFIED

I think it is more about the way how the chip is build to render. So it has nothing to do with the memory model. Some intel chip might have some dedicated memory but still work as tile renderer.

I think it is more about the way how the chip is build to render. So it has nothing to do with the memory model. Some intel chip might have some dedicated memory but still work as tile renderer.
First-time contributor

The memory model would also likely be a valid capability to expose, but would cover different use-cases.

Currently, the use-case for architecture type would be to determine which implementation of virtual shadow map updating to use as per: #111283 (Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon).

Granted, the memory model could be used to achieve the same switch, but the implementation of the technique is mostly depending on the architecture style of the GPU, as Clement outlined.

It could still theoretically be possible to have either type of architecture with any other type of memory model.

This architecture check may also be relevant for other APIs in future, especially also for windows machines running with Qualcomm Snapdragon GPUs. (Qualcomm is also a little iffy as technically these GPUs can also run in immediate mode, depending on the bits-per-pixel and workload being rendered)

Perhaps it's a technicality atm, as atm, there is a correlation between tile-based architectures and system-on-chip Unified memory architecture, so I guess it depends which parameter best represents this.

I see two options:

  1. Add both capabilities
  2. Use eGPUMemoryModel with the assumption that a unified memory implies a tile-based renderer, which can use tile-shaders and on-tile per-pixel storage.
The memory model would also likely be a valid capability to expose, but would cover different use-cases. Currently, the use-case for architecture type would be to determine which implementation of virtual shadow map updating to use as per: https://projects.blender.org/blender/blender/pulls/111283 (Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon). Granted, the memory model could be used to achieve the same switch, but the implementation of the technique is mostly depending on the architecture style of the GPU, as Clement outlined. It could still theoretically be possible to have either type of architecture with any other type of memory model. This architecture check may also be relevant for other APIs in future, especially also for windows machines running with Qualcomm Snapdragon GPUs. (Qualcomm is also a little iffy as technically these GPUs can also run in immediate mode, depending on the bits-per-pixel and workload being rendered) Perhaps it's a technicality atm, as atm, there is a correlation between tile-based architectures and system-on-chip Unified memory architecture, so I guess it depends which parameter best represents this. I see two options: 1) Add both capabilities 2) Use eGPUMemoryModel with the assumption that a unified memory implies a tile-based renderer, which can use tile-shaders and on-tile per-pixel storage.
Member

In that case it makes more sense to have a GPU capability setting where we can check if it uses tiled rendering. As this is still an internal property think it is enough to use a bool.
GPU_tiled_renderer_support() or something similar.

In that case it makes more sense to have a GPU capability setting where we can check if it uses tiled rendering. As this is still an internal property think it is enough to use a bool. `GPU_tiled_renderer_support()` or something similar.
Member

Can you elaborate a bit on the usage/use case you have in mind. We might be able to start with just a GPU_capability for the memory model which each backend can set.

Can you elaborate a bit on the usage/use case you have in mind. We might be able to start with just a GPU_capability for the memory model which each backend can set.
Jeroen Bakker requested changes 2023-09-26 13:04:08 +02:00
Jeroen Bakker left a comment
Member

I did some reading on this topic. GPU architecture seems to be the correct term according to wikipedia and blogs. https://www.rastergrid.com/blog/gpu-tech/2021/07/gpu-architecture-types-explained/

I am fine with adding this to GPG as it currently is.

I would suggest to add defined to the shader codes. As that could be used to enable/disable the depth bias.
#define GPU_ARCHITECTURE_TBDR
#define GPU_ARCHITECTURE_IMR

Perhaps just add a comment what TBDR and IMR means (Tile-based deferred rendering. and Immediate mode rendering.
The rest seems fine. And sorry for the confusion due to lacking information on my side.

I did some reading on this topic. GPU architecture seems to be the correct term according to wikipedia and blogs. https://www.rastergrid.com/blog/gpu-tech/2021/07/gpu-architecture-types-explained/ I am fine with adding this to GPG as it currently is. I would suggest to add defined to the shader codes. As that could be used to enable/disable the depth bias. `#define GPU_ARCHITECTURE_TBDR` `#define GPU_ARCHITECTURE_IMR` Perhaps just add a comment what TBDR and IMR means (`Tile-based deferred rendering.` and `Immediate mode rendering`. The rest seems fine. And sorry for the confusion due to lacking information on my side.
First-time contributor

I did some reading on this topic. GPU architecture seems to be the correct term according to wikipedia and blogs. https://www.rastergrid.com/blog/gpu-tech/2021/07/gpu-architecture-types-explained/

I am fine with adding this to GPG as it currently is.

I would suggest to add defined to the shader codes. As that could be used to enable/disable the depth bias.
#define GPU_ARCHITECTURE_TBDR
#define GPU_ARCHITECTURE_IMR

Perhaps just add a comment what TBDR and IMR means (Tile-based deferred rendering. and Immediate mode rendering.
The rest seems fine. And sorry for the confusion due to lacking information on my side.

No problem! Thanks for all of the feedback, so in conclusion, best to revert to the original method (I realise I updated my patch locally to the GPU_tiled_renderer_support , but believe I must have forgotten to push the patch -- possibly pushed it to the shadow branch instead of this one).

Good idea on adding the changes to the shader definitions as well, can look at getting that sorted.

> I did some reading on this topic. GPU architecture seems to be the correct term according to wikipedia and blogs. https://www.rastergrid.com/blog/gpu-tech/2021/07/gpu-architecture-types-explained/ > > I am fine with adding this to GPG as it currently is. > > I would suggest to add defined to the shader codes. As that could be used to enable/disable the depth bias. > `#define GPU_ARCHITECTURE_TBDR` > `#define GPU_ARCHITECTURE_IMR` > > Perhaps just add a comment what TBDR and IMR means (`Tile-based deferred rendering.` and `Immediate mode rendering`. > The rest seems fine. And sorry for the confusion due to lacking information on my side. > No problem! Thanks for all of the feedback, so in conclusion, best to revert to the original method (I realise I updated my patch locally to the `GPU_tiled_renderer_support` , but believe I must have forgotten to push the patch -- possibly pushed it to the shadow branch instead of this one). Good idea on adding the changes to the shader definitions as well, can look at getting that sorted.
Jason Fielder added 3 commits 2023-09-27 22:27:35 +02:00
Clément Foucault approved these changes 2023-09-27 22:34:42 +02:00
@ -55,6 +55,11 @@ typedef enum eGPUSupportLevel {
GPU_SUPPORT_LEVEL_UNSUPPORTED,
} eGPUSupportLevel;
typedef enum eGPUArchitectureType {

do not use e prefix. This is from an older codestyle no longer in place.

do not use `e` prefix. This is from an older codestyle no longer in place.
First-time contributor

Ah gotcha! Will update thanks, had originally just aimed to be consistent with the other Enums declared in this file.

Ah gotcha! Will update thanks, had originally just aimed to be consistent with the other Enums declared in this file.
Jason Fielder added 2 commits 2023-09-28 11:51:59 +02:00
Jeroen Bakker approved these changes 2023-09-28 11:58:52 +02:00
Member

@blender-bot build

@blender-bot build
Clément Foucault merged commit e64db67fa5 into main 2023-09-28 12:50:05 +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#112566
No description provided.