Skip to content

Commit b83fadf

Browse files
YourselfX547
authored andcommitted
Fix DMA buffer allocation to respect contiguous flag
Remove debug code that forced all DMA allocations to be physically contiguous. This was causing large memory allocations to fail with NV_ERR_NO_MEMORY (0x51) because finding large contiguous physical memory blocks is difficult, especially on systems with fragmented memory. The fix allows non-contiguous DMA buffers when the caller does not require contiguous memory, enabling large model loading in llama.cpp and other applications that need significant GPU memory. Tested with Llama 3.1 8B (4.5GB) model which previously failed to load.
1 parent 0093e7f commit b83fadf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nvidia_gsp/nvidia/os-haiku.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ NV_STATUS NV_API_CALL nv_alloc_pages(
418418
alloc->area.SetTo(create_area(
419419
"DMA Buffer",
420420
&address, B_ANY_KERNEL_ADDRESS, (uint64)page_count * B_PAGE_SIZE,
421-
(true || contiguous) ? B_CONTIGUOUS : B_FULL_LOCK,
421+
contiguous ? B_CONTIGUOUS : B_FULL_LOCK,
422422
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA
423423
));
424424

0 commit comments

Comments
 (0)