Fix hsaKmtQueryPointerInfo for scratch memory
Change-Id: I35a0f1a81f8b0ac6e99c2e1572829eb32d3bc95b
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
[ROCm/ROCR-Runtime commit: 00250f7686]
Этот коммит содержится в:
@@ -656,6 +656,23 @@ static manageable_aperture_t *fmm_get_aperture(HsaApertureInfo info)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static manageable_aperture_t *fmm_is_scratch_aperture(const void *address)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < gpu_mem_count; i++) {
|
||||
if (gpu_mem[i].gpu_id == NON_VALID_GPU_ID)
|
||||
continue;
|
||||
|
||||
if ((address >= gpu_mem[i].scratch_physical.base) &&
|
||||
(address <= gpu_mem[i].scratch_physical.limit))
|
||||
return &gpu_mem[i].scratch_physical;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static manageable_aperture_t *fmm_find_aperture(const void *address,
|
||||
HsaApertureInfo *info)
|
||||
{
|
||||
@@ -666,8 +683,12 @@ static manageable_aperture_t *fmm_find_aperture(const void *address,
|
||||
if (is_dgpu) {
|
||||
if (address >= svm.dgpu_aperture.base &&
|
||||
address <= svm.dgpu_aperture.limit) {
|
||||
aperture = &svm.dgpu_aperture;
|
||||
_info.type = HSA_APERTURE_DGPU;
|
||||
|
||||
aperture = fmm_is_scratch_aperture(address);
|
||||
if (!aperture) {
|
||||
aperture = &svm.dgpu_aperture;
|
||||
_info.type = HSA_APERTURE_DGPU;
|
||||
}
|
||||
} else if (address >= svm.dgpu_alt_aperture.base &&
|
||||
address <= svm.dgpu_alt_aperture.limit) {
|
||||
aperture = &svm.dgpu_alt_aperture;
|
||||
@@ -753,27 +774,6 @@ err_object_allocation_failed:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool fmm_is_inside_some_aperture(void *address)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < gpu_mem_count; i++) {
|
||||
if (gpu_mem[i].gpu_id == NON_VALID_GPU_ID)
|
||||
continue;
|
||||
if ((address >= gpu_mem[i].lds_aperture.base) &&
|
||||
(address <= gpu_mem[i].lds_aperture.limit))
|
||||
return true;
|
||||
if ((address >= gpu_mem[i].gpuvm_aperture.base) &&
|
||||
(address <= gpu_mem[i].gpuvm_aperture.limit))
|
||||
return true;
|
||||
if ((address >= gpu_mem[i].scratch_aperture.base) &&
|
||||
(address <= gpu_mem[i].scratch_aperture.limit))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PRINT_APERTURE
|
||||
static void aperture_print(aperture_t *app)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,6 @@ void *fmm_allocate_doorbell(uint32_t gpu_id, uint64_t MemorySizeInBytes, uint64_
|
||||
void *fmm_allocate_host(uint32_t node_id, uint64_t MemorySizeInBytes,
|
||||
HsaMemFlags flags);
|
||||
void fmm_print(uint32_t node);
|
||||
bool fmm_is_inside_some_aperture(void *address);
|
||||
void fmm_release(void *address);
|
||||
int fmm_map_to_gpu(void *address, uint64_t size, uint64_t *gpuvm_address);
|
||||
int fmm_unmap_from_gpu(void *address);
|
||||
|
||||
Ссылка в новой задаче
Block a user