From: Dave Gordon <david.s.gordon@intel.com>
To: "Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Cache elsp submit register
Date: Wed, 30 Mar 2016 16:05:50 +0100 [thread overview]
Message-ID: <56FBEB4E.4010206@intel.com> (raw)
In-Reply-To: <56F18335.5030308@linux.intel.com>
On 22/03/16 17:39, Tvrtko Ursulin wrote:
>
> On 22/03/16 17:29, Ville Syrjälä wrote:
>> On Tue, Mar 22, 2016 at 05:16:52PM +0000, Tvrtko Ursulin wrote:
>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>> Since we write four times to the same register, caching
>>> the mmio register saves a tiny amount of generated code.
>>
>> The compiler can't figure this out on its own?
>
> Nope, at least gcc 4.84 I am running here can't. :(
>
> And this only solves one part of the things it can't figure out in that
> code. It still recalculates one part, can't remember which one is which
> now without revisiting the generated assembly. It used to be for times
> in a row: load register, add 0x230, displace 0x78, store[0-4]. This only
> solves the add 0x230 redundancy. But working around that would possibly
> be a bit too low level.
>
> Regards,
> Tvrtko
Compiler's probably assuming aliasing.
RING_ELSP(engine) is actually (engine->mmio_base+0x230).
I915_WRITE_FW(reg, val) is actually __raw_i915_write32(dev_priv,
(reg__), (val__)) which ultimately translates to a store to some address.
The compiler can't be sure that this store isn't actually to
(engine->mmio_base), so it refetches it and adds the 0x230 again. Saving
the (struct-valued) result of the RING_ELSP() macro means the compiler
knows it isn't aliased, so can reuse it four times.
We could try adding __restrict to various key pointers, starting with
dev_priv and all pointers-to-engines?
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2016-03-30 15:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 17:16 [PATCH 1/2] drm/i915: Cache elsp submit register Tvrtko Ursulin
2016-03-22 17:13 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] " Patchwork
2016-03-22 17:16 ` [PATCH 2/2] drm/i915: Shrink i915_gem_request_add_to_client Tvrtko Ursulin
2016-03-22 17:59 ` Chris Wilson
2016-03-23 10:10 ` Tvrtko Ursulin
2016-03-22 17:29 ` [PATCH 1/2] drm/i915: Cache elsp submit register Ville Syrjälä
2016-03-22 17:39 ` Tvrtko Ursulin
2016-03-30 15:05 ` Dave Gordon [this message]
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=56FBEB4E.4010206@intel.com \
--to=david.s.gordon@intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=ville.syrjala@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;
as well as URLs for NNTP newsgroup(s).