Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: Matthew Auld <matthew.auld@intel.com>,
	Nirmoy Das <nirmoy.das@linux.intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Matt Roper <matthew.d.roper@intel.com>
Subject: Re: [PATCH] drm/xe/bmg: improve cache flushing behaviour
Date: Tue, 3 Sep 2024 15:49:57 +0200	[thread overview]
Message-ID: <6c4a28d3-1c45-40ee-8401-9557e6bbd060@intel.com> (raw)
In-Reply-To: <4bcc669d-7fb9-4daa-a94d-22a785f04b22@intel.com>


On 9/3/2024 1:08 PM, Matthew Auld wrote:
> On 03/09/2024 11:53, Nirmoy Das wrote:
>>
>> On 9/2/2024 5:37 PM, Matthew Auld wrote:
>>> The BSpec seems to suggest that EN_L3_RW_CCS_CACHE_FLUSH must be 
>>> toggled
>>> on for manual global invalidation to take effect
>>
>> I couldn't find this reference, in which bspec is this mentioned ?
>
> BSpec: 71718
>
> For discrete under global invalidation it says: "Device Cache flushed 
> if SCRATCH1LPFC bit[0] is set". 


I was only looking at the register spec.

If I get this correctly, setting SCRATCH1LPFC would flush device 
cache/l2 from the L3 without it I assume global inval isn't useful to 
flush device cache.

Can SCRATCH1LPFC be set/reset dynamically, if so then may be set 
SCRATCH1LPFC  before global inval and reset it back after that ?



> Which is why I originally added this, however this then turns flushing 
> on for all kinds of stuff like pipecontrol which is not what we want. 
> But from playing around with this a bunch on BMG that doesn't look to 
> be true. Also the original WA made no mention of needing to mess with 
> SCRATCH1LPFC.
>
> I'm kind of hoping this helps that compute benchmark with not nuking 
> entire device cache between submissions.


I tried this one and is indeed improves compute test bandwidth.


Regards,

Nirmoy

>
>>
>>
>> Regards,
>>
>> Nirmoy
>>
>>>   and actually flush
>>> device cache, however this also turns on flushing for things like
>>> pipecontrol, which occurs between submissions for compute/render. This
>>> sounds like massive overkill for our needs, where we already have the
>>> manual flushing on the display side with the global invalidation. Some
>>> observations on BMG:
>>>
>>> 1. Disabling l2 caching for host writes and stubbing out the driver
>>>     global invalidation but keeping EN_L3_RW_CCS_CACHE_FLUSH 
>>> enabled, has
>>>     no impact on wb-transient-vs-display IGT, which makes sense 
>>> since the
>>>     pipecontrol is now flushing the device cache after the render copy.
>>>     Without EN_L3_RW_CCS_CACHE_FLUSH the test then fails, which is also
>>>     expected since device cache is now dirty and display engine 
>>> can't see
>>>     the writes.
>>>
>>> 2. Disabling EN_L3_RW_CCS_CACHE_FLUSH, but keeping the driver global
>>>     invalidation also has no impact on wb-transient-vs-display. This
>>>     suggests that the global invalidation still works as expected 
>>> and is
>>>     flushing the device cache without EN_L3_RW_CCS_CACHE_FLUSH 
>>> turned on.
>>>
>>> With that drop EN_L3_RW_CCS_CACHE_FLUSH.
>>>
>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Matt Roper <matthew.d.roper@intel.com>
>>> Cc: Nirmoy Das <nirmoy.das@intel.com>
>>> ---
>>>   drivers/gpu/drm/xe/regs/xe_gt_regs.h | 3 ---
>>>   drivers/gpu/drm/xe/xe_gt.c           | 1 -
>>>   2 files changed, 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/regs/xe_gt_regs.h 
>>> b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
>>> index 0d1a4a9f4e11..88a01970cc5c 100644
>>> --- a/drivers/gpu/drm/xe/regs/xe_gt_regs.h
>>> +++ b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
>>> @@ -387,9 +387,6 @@
>>>   #define XE2_GLOBAL_INVAL            XE_REG(0xb404)
>>> -#define SCRATCH1LPFC                XE_REG(0xb474)
>>> -#define   EN_L3_RW_CCS_CACHE_FLUSH        REG_BIT(0)
>>> -
>>>   #define XE2LPM_L3SQCREG5            XE_REG_MCR(0xb658)
>>>   #define XE2_TDF_CTRL                XE_REG(0xb418)
>>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>>> index f82b3e8ac5c8..313cc4242281 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt.c
>>> @@ -110,7 +110,6 @@ static void xe_gt_enable_host_l2_vram(struct 
>>> xe_gt *gt)
>>>           return;
>>>       if (!xe_gt_is_media_type(gt)) {
>>> -        xe_mmio_write32(gt, SCRATCH1LPFC, EN_L3_RW_CCS_CACHE_FLUSH);
>>>           reg = xe_gt_mcr_unicast_read_any(gt, XE2_GAMREQSTRM_CTRL);
>>>           reg |= CG_DIS_CNTLBUS;
>>>           xe_gt_mcr_multicast_write(gt, XE2_GAMREQSTRM_CTRL, reg);

  reply	other threads:[~2024-09-03 13:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 15:37 [PATCH] drm/xe/bmg: improve cache flushing behaviour Matthew Auld
2024-09-02 17:01 ` ✓ CI.Patch_applied: success for " Patchwork
2024-09-02 17:01 ` ✓ CI.checkpatch: " Patchwork
2024-09-02 17:02 ` ✓ CI.KUnit: " Patchwork
2024-09-02 17:14 ` ✓ CI.Build: " Patchwork
2024-09-02 17:16 ` ✓ CI.Hooks: " Patchwork
2024-09-02 17:18 ` ✓ CI.checksparse: " Patchwork
2024-09-02 17:54 ` ✓ CI.BAT: " Patchwork
2024-09-02 22:29 ` ✗ CI.FULL: failure " Patchwork
2024-09-03 10:53 ` [PATCH] " Nirmoy Das
2024-09-03 11:08   ` Matthew Auld
2024-09-03 13:49     ` Nirmoy Das [this message]
2024-09-03 14:33       ` Matthew Auld

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=6c4a28d3-1c45-40ee-8401-9557e6bbd060@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=nirmoy.das@linux.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