[PATCH i-g-t 2/3] lib/amdgpu: add gfx12 to amd_dispatch test

vitaly prosyak vprosyak at amd.com
Fri Jun 21 03:05:52 UTC 2024


Looks good to me.

Reviewed-by: Vitaly Prosyak <vitaly.prosyak at amd.com>

On 2024-06-20 22:50, Jesse Zhang wrote:
> Enable gfx12 amd_dispatch test
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
> ---
>  lib/amdgpu/amd_dispatch.c         | 16 ++++++++--
>  lib/amdgpu/amd_dispatch_helpers.c |  2 +-
>  lib/amdgpu/amd_shaders.c          | 52 +++++++++++++++++++++++++++++++
>  3 files changed, 67 insertions(+), 3 deletions(-)
>
> diff --git a/lib/amdgpu/amd_dispatch.c b/lib/amdgpu/amd_dispatch.c
> index 040381a11..b739ce64d 100644
> --- a/lib/amdgpu/amd_dispatch.c
> +++ b/lib/amdgpu/amd_dispatch.c
> @@ -87,6 +87,8 @@ amdgpu_memset_dispatch_test(amdgpu_device_handle device_handle,
>  		base_cmd->emit(base_cmd, 0x1104bfac);
>  	else if (version == 11)
>  		base_cmd->emit(base_cmd, 0x1003dfac);
> +	else if (version == 12)
> +		base_cmd->emit(base_cmd, 0x1203dfac);
>  
>  	/* Sets a range of pixel shader constants */
>  	base_cmd->emit(base_cmd, PACKET3_COMPUTE(PKT3_SET_SH_REG, 4));
> @@ -239,6 +241,8 @@ amdgpu_memcpy_dispatch_test(amdgpu_device_handle device_handle,
>  		base_cmd->emit(base_cmd, 0x1104bfac);
>  	else if (version == 11)
>  		base_cmd->emit(base_cmd, 0x1003dfac);
> +	else if (version == 12)
> +		base_cmd->emit(base_cmd, 0x1203dfac);
>  
>  	/* Writes the UAV constant data to the SGPRs. */
>  	base_cmd->emit(base_cmd, PACKET3_COMPUTE(PKT3_SET_SH_REG, 4));
> @@ -252,6 +256,8 @@ amdgpu_memcpy_dispatch_test(amdgpu_device_handle device_handle,
>  		base_cmd->emit(base_cmd, 0x1104bfac);
>  	else if (version == 11)
>  		base_cmd->emit(base_cmd, 0x1003dfac);
> +	else if (version == 12)
> +		base_cmd->emit(base_cmd, 0x1203dfac);
>  
>  	/* clear mmCOMPUTE_RESOURCE_LIMITS */
>  	base_cmd->emit(base_cmd, PACKET3_COMPUTE(PKT3_SET_SH_REG, 1));
> @@ -410,6 +416,8 @@ amdgpu_memcpy_dispatch_hang_slow_test(amdgpu_device_handle device_handle,
>  		base_cmd->emit(base_cmd, 0x1104bfac);
>  	else if (version == 11)
>  		base_cmd->emit(base_cmd, 0x1003dfac);
> +	else if (version == 12)
> +		base_cmd->emit(base_cmd, 0x1203dfac);
>  
>  
>  	/* Writes the UAV constant data to the SGPRs. */
> @@ -422,6 +430,10 @@ amdgpu_memcpy_dispatch_hang_slow_test(amdgpu_device_handle device_handle,
>  		base_cmd->emit(base_cmd, 0x74fac);
>  	else if (version == 10)
>  		base_cmd->emit(base_cmd, 0x1104bfac);
> +	else if (version == 11)
> +		base_cmd->emit(base_cmd, 0x1003dfac);
> +	else if (version == 12)
> +		base_cmd->emit(base_cmd, 0x1203dfac);
>  
>  
>  	/* clear mmCOMPUTE_RESOURCE_LIMITS */
> @@ -509,7 +521,7 @@ amdgpu_dispatch_hang_slow_helper(amdgpu_device_handle device_handle,
>  		igt_info("SKIP ... as there's no ring for ip %d\n", ip_type);
>  
>  	version = info.hw_ip_version_major;
> -	if (version != 9 && version != 10 && version != 11) {
> +	if (version != 9 && version != 10 && version != 11 && version != 12) {
>  		igt_info("SKIP ... unsupported gfx version %d\n", version);
>  		return;
>  	}
> @@ -536,7 +548,7 @@ void amdgpu_gfx_dispatch_test(amdgpu_device_handle device_handle, uint32_t ip_ty
>  		igt_info("SKIP ... as there's no graphics ring\n");
>  
>  	version = info.hw_ip_version_major;
> -	if (version != 9 && version != 10 && version != 11) {
> +	if (version != 9 && version != 10 && version != 11 && version != 12) {
>  		igt_info("SKIP ... unsupported gfx version %d\n", version);
>  		return;
>  	}
> diff --git a/lib/amdgpu/amd_dispatch_helpers.c b/lib/amdgpu/amd_dispatch_helpers.c
> index 11ce8284a..1c7413922 100644
> --- a/lib/amdgpu/amd_dispatch_helpers.c
> +++ b/lib/amdgpu/amd_dispatch_helpers.c
> @@ -138,7 +138,7 @@ int amdgpu_dispatch_write2hw(struct amdgpu_cmd_base * base, uint64_t shader_addr
>  	base->emit(base, shader_addr >> 8);
>  	base->emit(base, shader_addr >> 40);
>  	/* write sh regs */
> -	if (version == 11) {
> +	if ((version == 11) || (version == 12)) {
>  		for (j = 0; j < bufferclear_cs_shader_registers_num_gfx11; j++) {
>  			base->emit(base, PACKET3_COMPUTE(PKT3_SET_SH_REG, 1));
>  			/* - Gfx11ShRegBase */
> diff --git a/lib/amdgpu/amd_shaders.c b/lib/amdgpu/amd_shaders.c
> index cbea12827..fad6dbced 100644
> --- a/lib/amdgpu/amd_shaders.c
> +++ b/lib/amdgpu/amd_shaders.c
> @@ -314,6 +314,29 @@ int  amdgpu_dispatch_load_cs_shader(uint8_t *ptr, int cs_type, uint32_t version)
>  		0xBF9F0000, 0xBF9F0000, 0xBF9F0000
>  	};
>  
> +	static const uint32_t bufferclear_cs_shader_gfx12[] =
> +	{
> +		0xB0802009, 0xBF930006, 0x360000FF, 0x000003FF,
> +		0x7E020205, 0x7E040206, 0x7E060207, 0xBF870004,
> +		0xD6460004, 0x04010C75, 0x7E000204, 0xC401C07C,
> +		0x80000000, 0x00000004, 0xBFB60003, 0xBFB00000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000
> +	};
>  	/**
>  	 * shader main
>  	 * asic(GFX11)
> @@ -352,6 +375,29 @@ int  amdgpu_dispatch_load_cs_shader(uint8_t *ptr, int cs_type, uint32_t version)
>  		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
>  		0xBF9F0000, 0xBF9F0000
>  	};
> +	static const uint32_t buffercopy_cs_shader_gfx12[] =
> +	{
> +		0xB0802009, 0xBF930011, 0x360000FF, 0x000003FF,
> +		0xBF870001, 0xD6460002, 0x04010C75, 0xC400C07C,
> +		0x80000003, 0x00000002, 0xBFC00000, 0xC401C07C,
> +		0x80000803, 0x00000002, 0xBFB60003, 0xBFB00000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000,
> +		0xBF9F0000, 0xBF9F0000, 0xBF9F0000, 0xBF9F0000
> +	};
>  
>  	uint32_t shader_size;
>  	const uint32_t *shader;
> @@ -367,6 +413,9 @@ int  amdgpu_dispatch_load_cs_shader(uint8_t *ptr, int cs_type, uint32_t version)
>  			} else if (version == 11) {
>  				shader = bufferclear_cs_shader_gfx11;
>  				shader_size = sizeof(bufferclear_cs_shader_gfx11);
> +			} else if (version == 12) {
> +				shader = bufferclear_cs_shader_gfx12;
> +				shader_size = sizeof(bufferclear_cs_shader_gfx12);
>  			}
>  			break;
>  		case CS_BUFFERCOPY:
> @@ -379,6 +428,9 @@ int  amdgpu_dispatch_load_cs_shader(uint8_t *ptr, int cs_type, uint32_t version)
>  			} else if (version == 11) {
>  				shader = buffercopy_cs_shader_gfx11;
>  				shader_size = sizeof(buffercopy_cs_shader_gfx11);
> +			} else if (version == 12) {
> +				shader = buffercopy_cs_shader_gfx12;
> +				shader_size = sizeof(buffercopy_cs_shader_gfx12);
>  			}
>  			break;
>  		case CS_HANG:


More information about the igt-dev mailing list