From: "Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>
To: <John.C.Harrison@Intel.com>, <Intel-GFX@Lists.FreeDesktop.Org>
Cc: Michal Mrozek <michal.mrozek@intel.com>, DRI-Devel@Lists.FreeDesktop.Org
Subject: Re: [Intel-gfx] [PATCH v5 4/4] drm/i915: Improve long running compute w/a for GuC submission
Date: Mon, 17 Oct 2022 17:09:19 -0700 [thread overview]
Message-ID: <6d2829ec-a4c3-38f7-d719-a72bb84fb65f@intel.com> (raw)
In-Reply-To: <20221006213813.1563435-5-John.C.Harrison@Intel.com>
On 10/6/2022 2:38 PM, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> A workaround was added to the driver to allow compute workloads to run
> 'forever' by disabling pre-emption on the RCS engine for Gen12.
> It is not totally unbound as the heartbeat will kick in eventually
> and cause a reset of the hung engine.
>
> However, this does not work well in GuC submission mode. In GuC mode,
> the pre-emption timeout is how GuC detects hung contexts and triggers
> a per engine reset. Thus, disabling the timeout means also losing all
> per engine reset ability. A full GT reset will still occur when the
> heartbeat finally expires, but that is a much more destructive and
> undesirable mechanism.
>
> The purpose of the workaround is actually to give compute tasks longer
> to reach a pre-emption point after a pre-emption request has been
> issued. This is necessary because Gen12 does not support mid-thread
> pre-emption and compute tasks can have long running threads.
>
> So, rather than disabling the timeout completely, just set it to a
> 'long' value.
>
> v2: Review feedback from Tvrtko - must hard code the 'long' value
> instead of determining it algorithmically. So make it an extra CONFIG
> definition. Also, remove the execlist centric comment from the
> existing pre-emption timeout CONFIG option given that it applies to
> more than just execlists.
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> (v1)
r-b stands.
Daniele
> Acked-by: Michal Mrozek <michal.mrozek@intel.com>
> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/Kconfig.profile | 26 +++++++++++++++++++----
> drivers/gpu/drm/i915/gt/intel_engine_cs.c | 9 ++++++--
> 2 files changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig.profile b/drivers/gpu/drm/i915/Kconfig.profile
> index 39328567c2007..7cc38d25ee5c8 100644
> --- a/drivers/gpu/drm/i915/Kconfig.profile
> +++ b/drivers/gpu/drm/i915/Kconfig.profile
> @@ -57,10 +57,28 @@ config DRM_I915_PREEMPT_TIMEOUT
> default 640 # milliseconds
> help
> How long to wait (in milliseconds) for a preemption event to occur
> - when submitting a new context via execlists. If the current context
> - does not hit an arbitration point and yield to HW before the timer
> - expires, the HW will be reset to allow the more important context
> - to execute.
> + when submitting a new context. If the current context does not hit
> + an arbitration point and yield to HW before the timer expires, the
> + HW will be reset to allow the more important context to execute.
> +
> + This is adjustable via
> + /sys/class/drm/card?/engine/*/preempt_timeout_ms
> +
> + May be 0 to disable the timeout.
> +
> + The compiled in default may get overridden at driver probe time on
> + certain platforms and certain engines which will be reflected in the
> + sysfs control.
> +
> +config DRM_I915_PREEMPT_TIMEOUT_COMPUTE
> + int "Preempt timeout for compute engines (ms, jiffy granularity)"
> + default 7500 # milliseconds
> + help
> + How long to wait (in milliseconds) for a preemption event to occur
> + when submitting a new context to a compute capable engine. If the
> + current context does not hit an arbitration point and yield to HW
> + before the timer expires, the HW will be reset to allow the more
> + important context to execute.
>
> This is adjustable via
> /sys/class/drm/card?/engine/*/preempt_timeout_ms
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index fcbccd8d244e9..c1257723d1949 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -508,9 +508,14 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id,
> engine->props.timeslice_duration_ms =
> CONFIG_DRM_I915_TIMESLICE_DURATION;
>
> - /* Override to uninterruptible for OpenCL workloads. */
> + /*
> + * Mid-thread pre-emption is not available in Gen12. Unfortunately,
> + * some compute workloads run quite long threads. That means they get
> + * reset due to not pre-empting in a timely manner. So, bump the
> + * pre-emption timeout value to be much higher for compute engines.
> + */
> if (GRAPHICS_VER(i915) == 12 && (engine->flags & I915_ENGINE_HAS_RCS_REG_STATE))
> - engine->props.preempt_timeout_ms = 0;
> + engine->props.preempt_timeout_ms = CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE;
>
> /* Cap properties according to any system limits */
> #define CLAMP_PROP(field) \
next prev parent reply other threads:[~2022-10-18 0:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 21:38 [Intel-gfx] [PATCH v5 0/4] Improve anti-pre-emption w/a for compute workloads John.C.Harrison
2022-10-06 21:38 ` [Intel-gfx] [PATCH v5 1/4] drm/i915/guc: Limit scheduling properties to avoid overflow John.C.Harrison
2022-10-18 0:06 ` Ceraolo Spurio, Daniele
2022-10-06 21:38 ` [Intel-gfx] [PATCH v5 2/4] drm/i915: Fix compute pre-emption w/a to apply to compute engines John.C.Harrison
2022-10-06 21:38 ` [Intel-gfx] [PATCH v5 3/4] drm/i915: Make the heartbeat play nice with long pre-emption timeouts John.C.Harrison
2022-10-07 8:44 ` Tvrtko Ursulin
2022-10-06 21:38 ` [Intel-gfx] [PATCH v5 4/4] drm/i915: Improve long running compute w/a for GuC submission John.C.Harrison
2022-10-18 0:09 ` Ceraolo Spurio, Daniele [this message]
2022-10-06 21:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Improve anti-pre-emption w/a for compute workloads (rev8) Patchwork
2022-10-06 21:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-06 22:20 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-10-10 19:44 ` John Harrison
2022-10-12 13:54 ` Tvrtko Ursulin
2022-10-12 15:34 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Improve anti-pre-emption w/a for compute workloads (rev9) Patchwork
2022-10-12 15:34 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-12 15:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-12 23:55 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=6d2829ec-a4c3-38f7-d719-a72bb84fb65f@intel.com \
--to=daniele.ceraolospurio@intel.com \
--cc=DRI-Devel@Lists.FreeDesktop.Org \
--cc=Intel-GFX@Lists.FreeDesktop.Org \
--cc=John.C.Harrison@Intel.com \
--cc=michal.mrozek@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