Issues CreateCommittedResource greater than 4GB

Started by
13 comments, last by Sobe118 5 years, 10 months ago

I am rendering a large number of objects for a simulation. Each object has instance data and the size of the instance data * number of objects is greater than 4GB. 

CreateCommittedResource is giving me: E_OUTOFMEMORY Ran out of memory. 

My PC has 128GB (only 8% ish used prior to testing this), I am running the DirectX app as x64. <Creating a CPU sided resource so GPU ram doesn't matter here, but using Titan X cards if that's a question>

Simplified code test that recreates the issue (inserted the code into Microsofts D3D12HelloWorld): 


unsigned long long int siz = pow(2, 32) + 1024;

D3D12_FEATURE_DATA_D3D12_OPTIONS options; //MaxGPUVirtualAddressBitsPerResource = 40
m_device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options));

HRESULT oops = m_device->CreateCommittedResource(
	&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
	D3D12_HEAP_FLAG_NONE,
	&CD3DX12_RESOURCE_DESC::Buffer(siz),
	D3D12_RESOURCE_STATE_GENERIC_READ,
	nullptr,
	IID_PPV_ARGS(&m_vertexBuffer));

if (oops != S_OK)
{
	printf("Uh Oh");
}

I tried enabling "above 4G" in the bios, which didn't do anything. I also tested using malloc to allocate a > 4G array, that worked in the app without issue. 

Are there more options or build setup that needs to be done? (Using Visual Studio 2015)

*Other approaches to solving this are welcome too. I thought about splitting up the set of items to render into a couple of sets with a size < 4G each but would rather have one set of objects. 

Thank you.

Advertisement

I believe that the graphics memory manager currently has a limit on any individual allocation being less than (4GB - 64KB), regardless of whether it's coming from system memory or video memory.

Try using multiple heaps and mapping them into a reserved resource to get something larger than 4GB.

I tried searching "graphics memory manager" and couldn't find any listed limits. 

On this page, I found the "Max Primitive Count" (The simplest primitive is a collection of points in a 3D coordinate system). So that limitation might be connected to buffers/resources?
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).aspx

Thanks for the tip.

Try querying D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT.

Hello Hodgman, 

When checking D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT

 MaxGPUVirtualAddressBitsPerResource = 40
 MaxGPUVirtualAddressBitsPerProcess = 40

I'm attempting to allocate about 5-12GB so 40 bits would be enough for that. 

------------

I will probably use a multiple heap or related method as a workaround later. But still interested if there is a way to allocate >4 GB.

6 hours ago, Sobe118 said:

Creating a CPU sided resource so GPU ram doesn't matter here

I think it does, since it will be uploaded to VRAM when you set it as resource?

But maybe you could just split your workload?

.:vinterberg:.

Vinterberg, eventually it would matter but I don't think it would for this specific error from CreateCommittedResource. 
It gives an error when allocating a size greater than 2^32, so I have been testing with just a little over that value. Which is still several GB less than the current GPU card I am using. Also, I am watching my GPU with nvidia-smi so I can see live memory usage. 

Did you try creating the resource using GPU just to try?  I'm not sure about this, I'm just guessing but doesn't an upload heap have to be able to be mapped to GPU address space?  If so maybe theres a limitation as to how much can be mapped at a time.

11 hours ago, SoldierOfLight said:

I believe that the graphics memory manager currently has a limit on any individual allocation being less than (4GB - 64KB), regardless of whether it's coming from system memory or video memory.

I was wondering what exactly the graphics memory manager is and where its 'located'? (runtime, usermode driver...?)   Is it what evicts and loads commited resources into VRAM?

-potential energy is easily made kinetic-

The video memory manager I mentioned lives in DxgMms1.sys or DxgMms2.sys. It's responsible for allocating and managing memory, yes.

I doubt that the 4GB limit is well-documented anywhere, considering that up until recently it wasn't a limitation that anybody could really run into.

33 minutes ago, SoldierOfLight said:

The video memory manager I mentioned lives in DxgMms1.sys or DxgMms2.sys.

Is that considered the runtime or something else?

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement