Hi all,
using more than a single (mipmap) level in a call to glTexStorage3D() to allocate storage for a 2D texture array causes my application to use a huge amount of system memory. For example, after creating a texture with a resoultion of 64x64 texels and 2048 layers, using GL_RGBA8 and 7 levels for a full mipmap chain, my application's RAM usage goes up to nearly 1.7GB, which I believe is about 25x the theoretical size of the texture! This is the call I use is:
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 7, GL_RGBA8, 64, 64, 2048);
I have attached the source code of a minimal application that reproduces the issue. I'm using a RX480 and driver version 17.7.1 (on Windows 10).
A few observations I have made so far:
- using only 1 level but the same resolution and layer count hardly uses any RAM at all (certainly less than a 1/7 at the very least)
- RAM usage doesn't seem to further increase with increasing texture size (tested from 64x64 to 256x256 using different internal formats)
- trying to create anything larger than 256x256x2048 and 7 levels crashes my application
- a call to glTexStorage3D with GL_TEXTURE_3D (still using 7 mipmap levels and the same resolution) hardly uses any RAM at all
- running the code on an NVIDIA GeForce 970 or 840m doesn't cause this huge RAM usage
So am I provoking this behaviour somehow, or is there something weird going in the driver? In my current research work I need to create up to a few hundred texture arrays so I'm running out of RAM fast at the moment. Any help or hints are greatly appreciated!
Cheers,
Thank you for the report and the repro you have attached. Before I patch this through, can you clarify which system and what driver version are you currently running? Thanks.
Thank you for your reply. I have pasted my system information from the Radeon Settings menu below. Please let me know if I can be of any other help. I have also updated my driver since my original report, but the issue still remains.
System overview:
Radeon Software Version - 17.7.2
Radeon Software Edition - Crimson ReLive
Graphics Chipset - Radeon (TM) RX 480 Graphics
Memory Size - 8192 MB
Memory Type - GDDR5
Core Clock - 1303 MHz
Windows Version - Windows 10 (64 bit)
System Memory - 8 GB
CPU Type - AMD Phenom(tm) II X6 1045T Processor
Software:
Radeon Settings Version - 2017.0720.1902.32426
Driver Packaging Version - 17.30.1041-170720a-316467C-CrimsonReLive
Provider - Advanced Micro Devices, Inc.
2D Driver Version - 8.1.1.1614
Direct3D® Version - 9.14.10.01292
OpenGL® Version - 6.14.10.13491
OpenCL™ Version - 22.19.662.4
AMD Mantle Version - 9.1.10.0220
AMD Mantle API Version - 102400
AMD Audio Driver Version - 10.0.1.1
Vulkan™ Driver Version - 1.6.0
Vulkan™ API Version - 1.0.51
Hardware:
Graphics Card Manufacturer - Powered by AMD
Graphics Chipset - Radeon (TM) RX 480 Graphics
Device ID - 67DF
Vendor ID - 1002
SubSystem ID - 3413
SubSystem Vendor ID - 1462
Revision ID - C7
Bus Type - PCI Express 3.0
Current Bus Settings - PCI Express 2.0 x16
BIOS Version - 015.050.000.000
BIOS Part Number - 113-V34111-F1
BIOS Date - 2016/11/28 20:38
Memory Size - 8192 MB
Memory Type - GDDR5
Memory Clock - 2000 MHz
Core Clock - 1303 MHz
Total Memory Bandwidth - 256 GByte/s
Memory Bit Rate - 8.00 Gbps
2D Driver File Path - /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0000
Thanks, pinged the team about this issue. Will let you know as soon as I hear back.
Hi invor, did you see this issue on recent driver?
Hi xhuang, thanks for reaching out again. I actually don't see this issue with the current driver anymore! I doubled checked using both my actual application and the minimal exampled that I supplied and both are now running with the expected RAM usage.
So big thanks to the team for actually fixing this
Hello, thank you for your reporting which helps us to improve our products. BTW, are you using Radeon (TM) RX 480 Graphics to verify this problem or other AMD card? Just make sure this fix works for all the cards we're supporting now.
Hi, sorry for not following up on your question. I must have gotten distraced by something urgent and forgot to answer. In August last year, when the bug seemed to be fixed, I was in fact still using the Radeon RX480. I'm now using a Radeon Vega 56 and the bug resurfaced (see spaceengineer's posts below).
2019, bug is still here. Same GPU (RX 580), drivers are updated today. Compiled invor's demo app, and 32-bit build crashes at texture array size of 256*256*2048, because ran out of 2GB memory limit (if linked with /LARGEADDRESSAWARE:NO flag). If app is linked with /LARGEADDRESSAWARE, glTexStorage3D() allocating additional 2868 MB of virtual memory, and not released it even after glDeleteTextures().
System:
Radeon Software Version - 19.4.1
Radeon Software Edition - Adrenalin 2019
Graphics Chipset - Radeon RX 580 Series
Memory Size - 8192 MB
Memory Type - GDDR5
Core Clock - 1355 MHz
Windows Version - Windows 10 (64 bit)
System Memory - 24 GB
CPU Type - Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Software:
Radeon Settings Version - 2019.0326.2353.42986
Driver Packaging Version - 18.50.31.01-190326a-340998C-RadeonSoftwareAdrenalin2019
Provider - Advanced Micro Devices, Inc.
2D Driver Version - 8.1.1.1634
Direct3D® Version - 9.14.10.01377
OpenGL® Version - 25.20.15000.13547
OpenCL™ Version - 10.0.2766.5
AMD Mantle Version - 9.1.10.0295
AMD Mantle API Version - 102400
AMD Audio Driver Version - 10.0.1.7
Vulkan™ Driver Version - 2.0.78
Vulkan™ API Version - 1.1.101
Hardware:
Graphics Card Manufacturer - Powered by AMD
Graphics Chipset - Radeon RX 580 Series
Device ID - 67DF
Vendor ID - 1002
SubSystem ID - 2378
SubSystem Vendor ID - 148C
Revision ID - E7
Bus Type - PCI Express 3.0
Current Bus Settings - PCI Express 3.0 x8
BIOS Version - 015.050.002.001
BIOS Part Number - 113-C9403100_101
BIOS Date - 2017/11/23 01:53
Memory Size - 8192 MB
Memory Type - GDDR5
Memory Clock - 2000 MHz
Core Clock - 1355 MHz
Total Memory Bandwidth - 256 GByte/s
Memory Bit Rate - 8.00 Gbps
2D Driver File Path - /REGISTRY/MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0001
OpenGL® API Version - Not Available
OpenCL™ API Version - 2.0
Bump
This is still actual. I uploaded a build to google drive, please check it: OpenGL_test.7z - Google Drive
Build Debug x86 configuration. See comments in the code.
I can confirm that this bug is still here (or back again?). Tested both spaceengineer's example project built in Debug x86, and one of my own larger apps (built in x64 Debug/Release). I have upgraded my RX480 to a Vega 56 since then, so it would seem this bug is not limited to Polaris.
System:
Radeon Software Version - 19.4.1
Radeon Software Edition - Adrenalin 2019
Graphics Chipset - Radeon RX Vega
High Bandwidth Cache Size - 8176 MB
High Bandwidth Cache Type - HBM2
Core Clock - 1590 MHz
Windows Version - Windows 10 (64 bit)
System Memory - 16 GB
CPU Type - AMD Ryzen 5 1600X Six-Core Processor
Software:
Radeon Settings Version - 2019.0326.2353.42986
View Release Notes - https://www.amd.com/en/support/kb/release-notes/rn-rad-win-19-4-1
Driver Packaging Version - 18.50.31.01-190326a-340998C-RadeonSoftwareAdrenalin2019
Provider - Advanced Micro Devices, Inc.
2D Driver Version - 8.1.1.1634
Direct3D® Version - 9.14.10.01377
OpenGL® Version - 25.20.15000.13547
OpenCL™ Version - 10.0.2766.5
AMD Audio Driver Version - 10.0.1.7
Vulkan™ Driver Version - 2.0.78
Vulkan™ API Version - 1.1.101
Hardware:
Graphics Card Manufacturer - Powered by AMD
Graphics Chipset - Radeon RX Vega
Device ID - 687F
Vendor ID - 1002
SubSystem ID - E376
SubSystem Vendor ID - 1DA2
Revision ID - C3
Bus Type - PCI Express 3.0
Current Bus Settings - PCI Express 3.0 x16
BIOS Version - 016.001.001.000
BIOS Part Number - 113-376XL-UO2
BIOS Date - 2018/03/15 04:39
High Bandwidth Cache Size - 8176 MB
High Bandwidth Cache Type - HBM2
High Bandwidth Cache Clock - 800 MHz
Core Clock - 1590 MHz
High Bandwidth Cache Bandwidth - 409 GByte/s
Memory Bit Rate - 1.60 Gbps
2D Driver File Path - /REGISTRY/MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0000
OpenGL® API Version - 4.6
OpenCL™ API Version - 2.0
invor, I am so sorry this issue is not fixed as soon as possible. If all the things go well, the fix will be released in the next driver. Thanks for your patience!
Latest driver, memory leak is still here.
win10-64bit-radeon-software-adrenalin-2019-edition-19.4.3-apr22.exe
Hi spaceengineer, the fix has been divided into several parts (about 4 parts), and the code is reviewing (50%), thanks for your patience!
Hi spaceengineer, this issue has been fixed. Thanks for your reprot!