Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust max chunk size to fix error limit check from DX12 for large resources that are CPU accessible. #22680

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ namespace Dml

// No chunks were able to accommodate the allocation - create a new chunk and return that instead

// At least double the capacity of the pool
const size_t newChunkSize = std::max({ m_totalCapacity, c_minChunkSize, sizeInBytes });
// At least double the capacity of the pool, limit to c_maxChunkSize so DX12 does not reject size
const size_t newChunkSize = std::min(std::max({ m_totalCapacity, c_minChunkSize, sizeInBytes }), c_maxChunkSize);;
m_chunks.push_back(CreateChunk(m_device.Get(), newChunkSize));
m_totalCapacity += newChunkSize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
private:
static constexpr size_t c_minChunkSize = 1024 * 1024; // 1MB
static constexpr size_t c_allocationAlignment = 512; // In bytes; as per D3D12 requirement for buffers
static constexpr size_t c_maxChunkSize = 0xFFFF0000; // ~4 GiB limitation for DX12 CPU-visible resource

Check warning on line 35 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/PooledUploadHeap.h

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 At least two spaces is best between code and comments [whitespace/comments] [2] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/PooledUploadHeap.h:35: At least two spaces is best between code and comments [whitespace/comments] [2]

// A suballoction from a chunk
struct Allocation
Expand Down
Loading