libhsakmt: Add alignment for memory allocations

New API to support optional alignment parameter for memory allocations.
The alignment should be larger than or equal to page size and a power
of 2.

Change-Id: Ic3fec43b3c4281f74dd33a57ab4143dcf76e1186
Signed-off-by: Chris Freehill <cfreehil@amd.com>
This commit is contained in:
David Yat Sin
2024-05-16 16:32:23 +00:00
committed by Chris Freehill
parent 1abd02af32
commit a31e84eaef
5 changed files with 63 additions and 21 deletions
+15
View File
@@ -406,6 +406,21 @@ hsaKmtAllocMemory(
void** MemoryAddress //IN/OUT (page-aligned)
);
/**
Allocates a memory buffer with specific alignment that may be accessed by the GPU
If Alignment is 0, the smallest possible alignment will be used
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtAllocMemoryAlign(
HSAuint32 PreferredNode, //IN
HSAuint64 SizeInBytes, //IN (multiple of page size)
HSAuint64 Alignment, //IN (power of 2 and >= page size)
HsaMemFlags MemFlags, //IN
void** MemoryAddress //IN/OUT (page-aligned)
);
/**
Frees a memory buffer
*/