Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v2 1/2] lib/intel_compute: Prepare tgllp compute functions to be dg1 ready
Date: Tue, 14 Nov 2023 12:12:09 +0100	[thread overview]
Message-ID: <ZVNWCdKQqaI3k2Ln@fdugast-desk.home> (raw)
In-Reply-To: <20231114104151.67085-2-zbigniew.kempczynski@intel.com>

On Tue, Nov 14, 2023 at 11:41:50AM +0100, Zbigniew Kempczyński wrote:
> Preparing dynamic, surface and indirect data states is similar between
> platforms so let's rename it to "xe" prefix. It might be confusing
> at first glance do to "xe" prefix clash between platform and new
> driver but it is closed (static) in this compilation unit.
> Preparing indirect data was rewritten to generate input for kernels.
> 
> v2: avoid name confusion with "xe_" prefix (Francois)

The commit message is no longer valid. Please update it to reflect v2
and with that:

	Reviewed-by: Francois Dugast <francois.dugast@intel.com>

> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Francois Dugast <francois.dugast@intel.com>
> ---
>  lib/intel_compute.c | 115 ++++++++++++++------------------------------
>  1 file changed, 35 insertions(+), 80 deletions(-)
> 
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c
> index 7f1ea90e72..772c22fa37 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -203,120 +203,75 @@ static void bo_execenv_exec(struct bo_execenv *execenv, uint64_t start_addr)
>   */
>  
>  /**
> - * tgllp_create_indirect_data:
> + * create_indirect_data:
>   * @addr_bo_buffer_batch: pointer to batch buffer
>   * @addr_input: input buffer gpu offset
>   * @addr_output: output buffer gpu offset
>   *
>   * Prepares indirect data for compute pipeline.
>   */
> -static void tgllp_create_indirect_data(uint32_t *addr_bo_buffer_batch,
> -				       uint64_t addr_input,
> -				       uint64_t addr_output)
> +static void create_indirect_data(uint32_t *addr_bo_buffer_batch,
> +				 uint64_t addr_input,
> +				 uint64_t addr_output,
> +				 uint32_t end_value)
>  {
> -	int b = 0;
> +	uint32_t val = 0;
> +	int b = 0, curr = 0;
>  
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000200;
> +
>  	addr_bo_buffer_batch[b++] = 0x00000001;
>  	addr_bo_buffer_batch[b++] = 0x00000001;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> +
>  	addr_bo_buffer_batch[b++] = addr_input & 0xffffffff;
>  	addr_bo_buffer_batch[b++] = addr_input >> 32;
>  	addr_bo_buffer_batch[b++] = addr_output & 0xffffffff;
>  	addr_bo_buffer_batch[b++] = addr_output >> 32;
> +
>  	addr_bo_buffer_batch[b++] = 0x00000400;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> +
>  	addr_bo_buffer_batch[b++] = 0x00000200;
>  	addr_bo_buffer_batch[b++] = 0x00000001;
>  	addr_bo_buffer_batch[b++] = 0x00000001;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> +
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00010000;
> -	addr_bo_buffer_batch[b++] = 0x00030002;
> -	addr_bo_buffer_batch[b++] = 0x00050004;
> -	addr_bo_buffer_batch[b++] = 0x00070006;
> -	addr_bo_buffer_batch[b++] = 0x00090008;
> -	addr_bo_buffer_batch[b++] = 0x000B000A;
> -	addr_bo_buffer_batch[b++] = 0x000D000C;
> -	addr_bo_buffer_batch[b++] = 0x000F000E;
> -	addr_bo_buffer_batch[b++] = 0x00110010;
> -	addr_bo_buffer_batch[b++] = 0x00130012;
> -	addr_bo_buffer_batch[b++] = 0x00150014;
> -	addr_bo_buffer_batch[b++] = 0x00170016;
> -	addr_bo_buffer_batch[b++] = 0x00190018;
> -	addr_bo_buffer_batch[b++] = 0x001B001A;
> -	addr_bo_buffer_batch[b++] = 0x001D001C;
> -	addr_bo_buffer_batch[b++] = 0x001F001E;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x00210020;
> -	addr_bo_buffer_batch[b++] = 0x00230022;
> -	addr_bo_buffer_batch[b++] = 0x00250024;
> -	addr_bo_buffer_batch[b++] = 0x00270026;
> -	addr_bo_buffer_batch[b++] = 0x00290028;
> -	addr_bo_buffer_batch[b++] = 0x002B002A;
> -	addr_bo_buffer_batch[b++] = 0x002D002C;
> -	addr_bo_buffer_batch[b++] = 0x002F002E;
> -	addr_bo_buffer_batch[b++] = 0x00310030;
> -	addr_bo_buffer_batch[b++] = 0x00330032;
> -	addr_bo_buffer_batch[b++] = 0x00350034;
> -	addr_bo_buffer_batch[b++] = 0x00370036;
> -	addr_bo_buffer_batch[b++] = 0x00390038;
> -	addr_bo_buffer_batch[b++] = 0x003B003A;
> -	addr_bo_buffer_batch[b++] = 0x003D003C;
> -	addr_bo_buffer_batch[b++] = 0x003F003E;
> +
> +	/*
> +	 * Runtime prepares 32 16-bit incremented values packed to single dword.
> +	 * Then it lefts 32 dword gap filled with zeroes. Pattern looks the
> +	 * same for tgl and dg1 (apart of number of values).
> +	 */
> +	while (val < end_value) {
> +		addr_bo_buffer_batch[b++] = val | ((val + 1) << 16);
> +		val += 2;
> +		if (++curr % 16 == 0)
> +			b += 32;
> +	}
>  }
>  
>  /**
> - * tgllp_create_surface_state:
> + * create_surface_state:
>   * @addr_bo_buffer_batch: pointer to batch buffer
>   * @addr_input: input buffer gpu offset
>   * @addr_output: output buffer gpu offset
>   *
>   * Prepares surface state for compute pipeline.
>   */
> -static void tgllp_create_surface_state(uint32_t *addr_bo_buffer_batch,
> -				       uint64_t addr_input,
> -				       uint64_t addr_output)
> +static void create_surface_state(uint32_t *addr_bo_buffer_batch,
> +				 uint64_t addr_input,
> +				 uint64_t addr_output)
>  {
>  	int b = 0;
>  
> @@ -387,14 +342,14 @@ static void tgllp_create_surface_state(uint32_t *addr_bo_buffer_batch,
>  }
>  
>  /**
> - * tgllp_create_dynamic_state:
> + * create_dynamic_state:
>   * @addr_bo_buffer_batch: pointer to batch buffer
>   * @offset_kernel: gpu offset of the shader
>   *
>   * Prepares dynamic state for compute pipeline.
>   */
> -static void tgllp_create_dynamic_state(uint32_t *addr_bo_buffer_batch,
> -				       uint64_t offset_kernel)
> +static void create_dynamic_state(uint32_t *addr_bo_buffer_batch,
> +				 uint64_t offset_kernel)
>  {
>  	int b = 0;
>  
> @@ -582,9 +537,9 @@ static void tgl_compute_exec(int fd, const unsigned char *kernel,
>  	bo_execenv_bind(&execenv, bo_dict, TGL_BO_DICT_ENTRIES);
>  
>  	memcpy(bo_dict[0].data, kernel, size);
> -	tgllp_create_dynamic_state(bo_dict[1].data, OFFSET_KERNEL);
> -	tgllp_create_surface_state(bo_dict[2].data, ADDR_INPUT, ADDR_OUTPUT);
> -	tgllp_create_indirect_data(bo_dict[3].data, ADDR_INPUT, ADDR_OUTPUT);
> +	create_dynamic_state(bo_dict[1].data, OFFSET_KERNEL);
> +	create_surface_state(bo_dict[2].data, ADDR_INPUT, ADDR_OUTPUT);
> +	create_indirect_data(bo_dict[3].data, ADDR_INPUT, ADDR_OUTPUT, 0x40);
>  
>  	dinput = (float *)bo_dict[4].data;
>  	srand(time(NULL));
> @@ -852,7 +807,7 @@ static void xehp_compute_exec(int fd, const unsigned char *kernel,
>  	bo_execenv_bind(&execenv, bo_dict, XEHP_BO_DICT_ENTRIES);
>  
>  	memcpy(bo_dict[0].data, kernel, size);
> -	tgllp_create_dynamic_state(bo_dict[1].data, OFFSET_KERNEL);
> +	create_dynamic_state(bo_dict[1].data, OFFSET_KERNEL);
>  	xehp_create_surface_state(bo_dict[2].data, ADDR_INPUT, ADDR_OUTPUT);
>  	xehp_create_indirect_data(bo_dict[3].data, ADDR_INPUT, ADDR_OUTPUT);
>  	xehp_create_surface_state(bo_dict[7].data, ADDR_INPUT, ADDR_OUTPUT);
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-11-14 11:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 10:41 [igt-dev] [PATCH i-g-t v2 0/2] Add dg1 compute pipeline Zbigniew Kempczyński
2023-11-14 10:41 ` [igt-dev] [PATCH i-g-t v2 1/2] lib/intel_compute: Prepare tgllp compute functions to be dg1 ready Zbigniew Kempczyński
2023-11-14 11:12   ` Francois Dugast [this message]
2023-11-14 10:41 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_compute: Add dg1 compute implementation for i915 Zbigniew Kempczyński
2023-11-14 11:17   ` Francois Dugast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZVNWCdKQqaI3k2Ln@fdugast-desk.home \
    --to=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox