Skip to contentSkip to conversation

sh_mem_bases: amdkfd vs amdgpu

QUESTION [email protected] 2 participants 2 messages May 18, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

There is an interesting feature divergence between amdgpu and amdkfd concerning the shared/private apertures. I restricted my analysis to gfx9, it may differ with other gfx.

In amdgpu, the pair of aperture start addresses is defined the following way (in gmc_v9_0.c):

* shared_aperture_start = 0x2000000000000000ULL
* private_aperture_start = 0x1000000000000000ULL

In amdkfd, the pair is reversed (cf kfd_flat_memory.c and kfd_device_queue_manager_v9.c):

* lds_base (ie shared_aperture_start) = (0x1UL) << 48
* scratch_base (ie private_aperture_start) = (0x2UL) << 48

Is there any reason why those two definitions diverge ?

Thanks,

RD

#2 lore raw

Am 2022-05-17 um 20:32 schrieb [email protected]:

Quoted 6 lines

Hi,

There is an interesting feature divergence between amdgpu and amdkfd concerning the shared/private apertures. I restricted my analysis to gfx9, it may differ with other gfx.

In amdgpu, the pair of aperture start addresses is defined the following way (in gmc_v9_0.c):

Quoted 7 lines

* shared_aperture_start = 0x2000000000000000ULL
* private_aperture_start = 0x1000000000000000ULL

In amdkfd, the pair is reversed (cf kfd_flat_memory.c and kfd_device_queue_manager_v9.c):

* lds_base (ie shared_aperture_start) = (0x1UL) << 48
* scratch_base (ie private_aperture_start) = (0x2UL) << 48

It's more than just reversed. If I counted 0s correctly, the aperture start addresses in gmc_v9_0.c expressed the same way would be

shared_aperture_start = 0x2ULL << 60;
private_aperture_start = 0x1ULL << 60;

Quoted 2 lines

Is there any reason why those two definitions diverge ?

I don't think there is any deliberate reason for them to diverge. But there is also no reason for them to be the same. The sh_mem_bases register is per-VMID, which means these settings can be different for every address space. The address spaces for graphics and compute are defined independently of each other, and there was no reason to coordinate these settings.

Regards,
  Felix

Quoted 4 lines

Thanks,

RD