All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH 1/6] drm/xe/migrate: allow larger chunk sizes for identity VRAM clears
Date: Fri, 30 Oct 2026 16:20:27 +0100	[thread overview]
Message-ID: <e713f0f1f13c10dd99b8296399f09ec62b040e43.camel@linux.intel.com> (raw)
In-Reply-To: <20261030-migrate-bb-optimise-v1-1-b8d01649cfe9@intel.com>

On Fri, 2026-10-30 at 11:49 +0000, Matthew Auld wrote:
> xe_migrate_clear() currently clamps every clear pass to 8M. On
> platforms
> with Xe2 blitter instructions and no separate CCS copy emission, VRAM
> clears use the identity map without dynamic PTE updates and execute
> on
> the dedicated migration engine, so clamping each pass to 8M splits
> a 1G+ clear into 100+ jobs. 1G VRAM pages look quite normal in real
> workloads like llama.py with even a small model.
> 
> It looks like the 8M limit comes from wanting a ~1ms preemption
> granularity, and dates back to i915. But consider:
> 
> 1. Xe has kernel reserved BCS engine just for migrations on newer hw,
>    so no need to duke it out with userspace jobs. Further, we now
> also
>    dropped the GPU VM_BIND path, so there is now only a single
> migration
>    queue, so the ~1ms preemption granularity is maybe not a big deal
>    anymore.
> 
> 2. It does not take ~1ms to clear 8M (single MEM_SET) of VRAM through
>    the identity map. Currently we just lump everything in the same
>    bucket, even though we have VRAM clearing with identity, VRAM
>    clearing with PTE emit, and then copying between VRAM and system
>    memory, which will have different characteristics and performance.
>    Applying the same 8M limit everywhere seems overly cautious.
> 
> With that be more optimistic and bump the fast path VRAM clearing
> through identity map to 128M per single MEM_SET instruction. This
> still
> only takes up to around < ~2ms, or < ~1ms if boosted. For very large
> clears, this massively lowers the number of GPU jobs, reducing
> pressure
> on the bb pool and as a bonus gives slightly lower CPU/GPU overhead.
> 
> Assisted-by: LLM
> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9644
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

> ---
>  drivers/gpu/drm/xe/xe_migrate.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> b/drivers/gpu/drm/xe/xe_migrate.c
> index 70408fa0a606..1a216fb12d2b 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -246,6 +246,7 @@ struct xe_migrate {
>  
>  #define MAX_PREEMPTDISABLE_TRANSFER SZ_8M /* Around 1ms. */
>  #define MAX_CCS_LIMITED_TRANSFER SZ_4M /* XE_PAGE_SIZE *
> (FIELD_MAX(XE2_CCS_SIZE_MASK) + 1) */
> +#define MAX_IDENTITY_CLEAR_TRANSFER SZ_128M
>  #define NUM_PT_SLOTS 48
>  #define LEVEL0_PAGE_TABLE_ENCODE_SIZE SZ_2M
>  #define MAX_NUM_PTE 512
> @@ -1964,6 +1965,11 @@ struct dma_fence *xe_migrate_clear(struct
> xe_migrate *m,
>  		u32 avail_pts = max_mem_transfer_per_pass(xe) /
> LEVEL0_PAGE_TABLE_ENCODE_SIZE;
>  
>  		clear_L0 = xe_migrate_res_sizes(m, &src_it);
> +		if (clear_vram && !xe_migrate_needs_ccs_emit(xe) &&
> +		    gt->info.has_xe2_blt_instructions &&
> +		    xe_migrate_allow_identity(clear_L0, &src_it))
> +			clear_L0 = min_t(u64,
> MAX_IDENTITY_CLEAR_TRANSFER,
> +					 src_it.size);
>  
>  		/* Calculate final sizes and batch size.. */
>  		pte_flags = clear_vram ? PTE_UPDATE_FLAG_IS_VRAM :
> 0;

  reply	other threads:[~2026-10-30 15:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 11:49 [PATCH 0/6] Interruptible bb wait + related bits Matthew Auld
2026-10-30 11:49 ` [PATCH 1/6] drm/xe/migrate: allow larger chunk sizes for identity VRAM clears Matthew Auld
2026-10-30 15:20   ` Thomas Hellström [this message]
2026-10-30 11:49 ` [PATCH 2/6] drm/xe/bb: drop per-batch prefetch padding Matthew Auld
2026-10-30 15:21   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 3/6] drm/xe/sa: remove unused shadow BO and two-step bb helpers Matthew Auld
2026-10-30 15:23   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 4/6] drm/xe/sa: allow callers to specify interruptible suballocator waits Matthew Auld
2026-10-30 15:25   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 5/6] drm/xe/migrate: plumb interruptible wait flag to clear and copy Matthew Auld
2026-10-30 15:28   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 6/6] drm/xe/migrate: avoid interruptible waits once passes are in flight Matthew Auld
2026-10-30 15:32   ` Thomas Hellström
2026-10-30 12:33 ` ✓ CI.KUnit: success for Interruptible bb wait + related bits Patchwork
2026-10-30 13:16 ` ✓ Xe.CI.BAT: " 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=e713f0f1f13c10dd99b8296399f09ec62b040e43.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.