Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Francois Dugast <francois.dugast@intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 10/11] lib/intel_compute: Use constants for thread groups and local work size
Date: Thu, 13 Mar 2025 16:09:09 +0100	[thread overview]
Message-ID: <3547dc61d585e4a01eb3692635a4e874e96d5256.camel@linux.intel.com> (raw)
In-Reply-To: <20250311152321.16497-11-francois.dugast@intel.com>

On Tue, 2025-03-11 at 16:21 +0100, Francois Dugast wrote:
> Define new constants and use them to build the pipeline instead of
> magic values. This also helps homogenize the code to enforce a
> similar execution across GPUs. Having them grouped together in the
> file makes it easier to experiment with different values, as they
> depend on each other but where previously distributed.
> 
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
>  lib/intel_compute.c | 34 ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c
> index f5b3a88f0..068d64b24 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -55,6 +55,16 @@
>  
>  #define
> USER_FENCE_VALUE			0xdeadbeefdeadbeefull
>  
> +#define THREADS_PER_GROUP		32
> +#define THREAD_GROUP_X			MAX(1, SIZE_DATA /
> (ENQUEUED_LOCAL_SIZE_X * \
> +							   
> ENQUEUED_LOCAL_SIZE_Y * \
> +							   
> ENQUEUED_LOCAL_SIZE_Z))
> +#define THREAD_GROUP_Y			1
> +#define THREAD_GROUP_Z			1
> +#define ENQUEUED_LOCAL_SIZE_X		1024
> +#define ENQUEUED_LOCAL_SIZE_Y		1
> +#define ENQUEUED_LOCAL_SIZE_Z		1

Nit: Perhaps define these before THREAD_GROUP macros to make it
clearer.
Anyway, 
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

> +
>  /*
>   * TGP  - ThreadGroup Preemption
>   * WMTP - Walker Mid Thread Preemption
> @@ -781,9 +791,9 @@ static void xehp_create_indirect_data(uint32_t
> *addr_bo_buffer_batch,
>  	addr_bo_buffer_batch[b++] = addr_output & 0xffffffff;
>  	addr_bo_buffer_batch[b++] = addr_output >> 32;
>  	addr_bo_buffer_batch[b++] = loop_count;
> -	addr_bo_buffer_batch[b++] = 0x00000400; // Enqueued local
> size X
> -	addr_bo_buffer_batch[b++] = 0x00000001; // Enqueued local
> size Y
> -	addr_bo_buffer_batch[b++] = 0x00000001; // Enqueued local
> size Z
> +	addr_bo_buffer_batch[b++] = ENQUEUED_LOCAL_SIZE_X;
> +	addr_bo_buffer_batch[b++] = ENQUEUED_LOCAL_SIZE_Y;
> +	addr_bo_buffer_batch[b++] = ENQUEUED_LOCAL_SIZE_Z;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> @@ -1164,7 +1174,7 @@ static void xehpc_compute_exec_compute(uint32_t
> *addr_bo_buffer_batch,
>  	addr_bo_buffer_batch[b++] = 0x00180000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x0c000020;
> +	addr_bo_buffer_batch[b++] = 0x0c000000 | THREADS_PER_GROUP;
>  
>  	addr_bo_buffer_batch[b++] = 0x00000008;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> @@ -1332,10 +1342,10 @@ static void
> xelpg_compute_exec_compute(uint32_t *addr_bo_buffer_batch,
>  	addr_bo_buffer_batch[b++] = 0xbe040000;
>  	addr_bo_buffer_batch[b++] = 0xffffffff;
>  	addr_bo_buffer_batch[b++] = 0x000003ff;
> -	addr_bo_buffer_batch[b++] = 0x00000001;
> +	addr_bo_buffer_batch[b++] = THREAD_GROUP_X;
>  
> -	addr_bo_buffer_batch[b++] = 0x00000001;
> -	addr_bo_buffer_batch[b++] = 0x00000001;
> +	addr_bo_buffer_batch[b++] = THREAD_GROUP_Y;
> +	addr_bo_buffer_batch[b++] = THREAD_GROUP_Z;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> @@ -1350,7 +1360,7 @@ static void xelpg_compute_exec_compute(uint32_t
> *addr_bo_buffer_batch,
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00001080;
> -	addr_bo_buffer_batch[b++] = 0x0c000020;
> +	addr_bo_buffer_batch[b++] = 0x0c000000 | THREADS_PER_GROUP;
>  
>  	addr_bo_buffer_batch[b++] = 0x00000008;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> @@ -1470,10 +1480,10 @@ static void
> xe2lpg_compute_exec_compute(uint32_t *addr_bo_buffer_batch,
>  		 */
>  		addr_bo_buffer_batch[b++] = 0x00200000; // Thread
> Group ID X Dimension
>  	else
> -		addr_bo_buffer_batch[b++] = 0x00000002;
> +		addr_bo_buffer_batch[b++] = THREAD_GROUP_X;
>  
> -	addr_bo_buffer_batch[b++] = 0x00000001; // Thread Group ID Y
> Dimension
> -	addr_bo_buffer_batch[b++] = 0x00000001; // Thread Group ID Z
> Dimension
> +	addr_bo_buffer_batch[b++] = THREAD_GROUP_Y;
> +	addr_bo_buffer_batch[b++] = THREAD_GROUP_Z;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> @@ -1494,7 +1504,7 @@ static void
> xe2lpg_compute_exec_compute(uint32_t *addr_bo_buffer_batch,
>  
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
> -	addr_bo_buffer_batch[b++] = 0x0c000020;
> +	addr_bo_buffer_batch[b++] = 0x0c000000 | THREADS_PER_GROUP;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00000000;
>  	addr_bo_buffer_batch[b++] = 0x00001047;


  reply	other threads:[~2025-03-13 15:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 15:21 [PATCH i-g-t 00/11] Prepare lib/intel_compute for SVM/system allocator, part 2 Francois Dugast
2025-03-11 15:21 ` [PATCH i-g-t 01/11] lib/intel_compute: Use common constant for surface state size Francois Dugast
2025-03-13 14:28   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 02/11] lib/intel_compute: Use common constant for dynamic " Francois Dugast
2025-03-13 14:30   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 03/11] lib/intel_compute: Use common constant for indirect object size Francois Dugast
2025-03-13 15:35   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 04/11] lib/intel_compute: Use common constant for binding table size Francois Dugast
2025-03-13 14:31   ` Thomas Hellström
2025-03-13 14:34   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 05/11] lib/intel_compute: Use common constant for general state size Francois Dugast
2025-03-13 14:35   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 06/11] lib/intel_compute: Use constant for binding table address Francois Dugast
2025-03-13 14:41   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 07/11] lib/intel_compute: Compact memory map Francois Dugast
2025-03-13 14:44   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 08/11] lib/intel_compute: Relocate input and output objects Francois Dugast
2025-03-13 14:45   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 09/11] lib/intel_compute: Fix enqueued local size in xehp Francois Dugast
2025-03-13 14:48   ` Thomas Hellström
2025-03-11 15:21 ` [PATCH i-g-t 10/11] lib/intel_compute: Use constants for thread groups and local work size Francois Dugast
2025-03-13 15:09   ` Thomas Hellström [this message]
2025-03-11 15:21 ` [PATCH i-g-t 11/11] lib/intel_compute: Make array size a dynamic parameter Francois Dugast
2025-03-13 15:33   ` Thomas Hellström
2025-03-12  2:44 ` ✗ Xe.CI.BAT: failure for Prepare lib/intel_compute for SVM/system allocator, part 2 Patchwork
2025-03-12  3:08 ` ✓ i915.CI.BAT: success " Patchwork
2025-03-12 14:16 ` ✓ i915.CI.Full: " Patchwork
2025-03-12 18:21 ` ✗ Xe.CI.Full: failure " Patchwork

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=3547dc61d585e4a01eb3692635a4e874e96d5256.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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