Jump to content
  • Advertisement
Sobe118

DX12 Issues CreateCommittedResource greater than 4GB

Recommended Posts

Posted (edited)

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.

Edited by Sobe118
Added detail

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Posted (edited)

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.

Edited by Sobe118

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!