Align large buffers to BigK or huge-page boundary

This should allow us to take advantage of BigK fragments and huge pages
and improve TLB efficiency for VRAM allocations. Huge pages only work
with 4-level page tables (gfx900 and up). BigK fragments work on older
GPUs.

Change-Id: I02e1fbf74de554e16fdaf44e44d03b47df45c3b0
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tento commit je obsažen v:
Felix Kuehling
2017-06-29 14:33:08 -04:00
rodič dc2c52be78
revize c7bd7733e5
2 změnil soubory, kde provedl 17 přidání a 2 odebrání
+11 -2
Zobrazit soubor
@@ -539,11 +539,20 @@ static void *aperture_allocate_area_aligned(manageable_aperture_t *app,
vm_area_t *cur, *next;
void *start;
MemorySizeInBytes = vm_align_area_size(app, MemorySizeInBytes);
if (align < app->align)
align = app->align;
/* Huge-page and Big-K TLB optimizations require proper alignment */
if (MemorySizeInBytes >= GPU_HUGE_PAGE_SIZE) {
if (align < GPU_HUGE_PAGE_SIZE)
align = GPU_HUGE_PAGE_SIZE;
} else if (MemorySizeInBytes >= GPU_BIGK_PAGE_SIZE) {
if (align < GPU_BIGK_PAGE_SIZE)
align = GPU_BIGK_PAGE_SIZE;
}
MemorySizeInBytes = vm_align_area_size(app, MemorySizeInBytes);
/* Find a big enough "hole" in the address space */
cur = NULL;
next = app->vm_ranges;
+6
Zobrazit soubor
@@ -55,6 +55,12 @@ extern int PAGE_SHIFT;
/* VI HW bug requires this virtual address alignment */
#define TONGA_PAGE_SIZE 0x8000
/* 64KB BigK fragment size for TLB efficiency */
#define GPU_BIGK_PAGE_SIZE (1 << 16)
/* 2MB huge page size for 4-level page tables on Vega10 and later GPUs */
#define GPU_HUGE_PAGE_SIZE (2 << 20)
#define CHECK_PAGE_MULTIPLE(x) \
do { if ((uint64_t)PORT_VPTR_TO_UINT64(x) % PAGE_SIZE) return HSAKMT_STATUS_INVALID_PARAMETER; } while(0)