cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

set
Adept II

Huge performance regression in OpenGL with SAM/ReBAR

I see a huge performance regression in my OpenGL programs when enabling SAM/ReBAR to full 16GB for my Radeon RX 6900 XT: texture upload speed drops by 3.5 times! 8k x 8k texture upload time jumps from 40 ms to 140+ ms (over PCI-E 3 x16).

The issue is not present when I set ReBAR in BIOS to 8GB or less and enable it in control panel or when set to 16GB and disabled in control panel.

I can provide minimal source code to reproduce the issue.

OS: Windows 10 fully updated

Driver: Adrenalin 22.11.1

0 Likes
1 Solution

Hi @set ,

Here is an update. The issue has been fixed. Could you please try the latest Adrenalin 23.2.1 and let us know if it resolves this issue?

Thanks.

View solution in original post

0 Likes
8 Replies

Post this thread at AMD Developer's Forum OpenGL/VUlkan Forum from here first to get access to that forum: https://community.amd.com/t5/newcomers-start-here/bd-p/newcomer-forum

Here are the latest thread from OpenGL/Vulkan Forum:

Screenshot 2022-11-20 172102.png

0 Likes
dipak
Big Boss

Hi @set ,

Thank you for reporting it. I have moved this post to the OpenGL forum.

Please provide a minimal test-case that reproduces the issue.

Thanks.

The minimal code that shows the issue:

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#include "stdio.h"

// Texture upload time over PCI-E 3 x16
// Tex size:  old -> with ReBAR to full GPU memory
// 8k x 4k: 20 ms ->  70 ms
// 8k x 8k: 40 ms -> 140+ ms

enum
{
	lWidth = 8192,
	lHeight = 8192,
};

const PIXELFORMATDESCRIPTOR pfd =
{
	sizeof(PIXELFORMATDESCRIPTOR),
	1,
	PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
	PFD_TYPE_RGBA,
	24,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	PFD_MAIN_PLANE,
	0, 0, 0, 0
};

int main(void)
{
	HWND hWnd = CreateWindowExW(0, L"STATIC", NULL, WS_POPUP, 0, 0, 1, 1, NULL, NULL, NULL, NULL);
	HDC hDC = GetDC(hWnd);
	SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
	HGLRC hGLRC = wglCreateContext(hDC);
	wglMakeCurrent(hDC, hGLRC);

	GLuint Texture;
	glGenTextures(1, &Texture);

	void *data = VirtualAlloc(NULL, lWidth*lHeight*4, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
	
	LARGE_INTEGER pfreq, pcount, pcount2;
	QueryPerformanceFrequency(&pfreq);

	for (int i = 0x10; i--;)
	{
		QueryPerformanceCounter(&pcount);

		glBindTexture(GL_TEXTURE_2D, Texture);
		glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB8, lWidth, lHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // also GL_BGRA
		glBindTexture(GL_TEXTURE_2D, 0);
		glFinish();

		QueryPerformanceCounter(&pcount2);
		pcount2.QuadPart -= pcount.QuadPart;
		printf("Time: %lli\n", pcount2.QuadPart*1000/pfreq.QuadPart);
	}
	glDeleteTextures(1, &Texture);
	wglMakeCurrent(NULL, NULL);
	wglDeleteContext(hGLRC);
	ReleaseDC(hWnd, hDC);
	DestroyWindow(hWnd);
	return 0;
}

Thanks for providing the reproducible source code. I will report it to the OpenGL team.

0 Likes

Update:

A ticket has been created to investigate this issue.

0 Likes

Hi @set ,

Here is an update. The issue has been fixed. Could you please try the latest Adrenalin 23.2.1 and let us know if it resolves this issue?

Thanks.

0 Likes

I can't test on initial system right now, but on another similar system I can reproduce similar slowdown with 22.11.2 and after updating to 23.2.1 it's gone.

Thank you!

Thanks for confirming that the issue is no longer reproducible with Adrenalin 23.2.1.