public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: "Richard Biener" <richard.guenther@gmail.com>,
	"GCC Patches" <gcc-patches@gcc.gnu.org>,
	"Martin Liška" <mliska@suse.cz>
Subject: Re: [PATCH] middle-end: Skip initialization of opaque type register variables [PR103127]
Date: Tue, 30 Nov 2021 17:51:39 +0000	[thread overview]
Message-ID: <D82F4736-B206-4DF2-A865-6227F41E193A@oracle.com> (raw)
In-Reply-To: <9baa0bc5-700e-1c35-bb6a-2dd50f701f8e@linux.ibm.com>



> On Nov 30, 2021, at 9:14 AM, Peter Bergner <bergner@linux.ibm.com> wrote:
> 
> On 11/30/21 2:37 AM, Richard Biener wrote:
>> On Mon, Nov 29, 2021 at 11:56 PM Qing Zhao <qing.zhao@oracle.com> wrote:
>> I think that's inconsistent indeed.  Peter, what are "opaque"
>> registers?  rs6000-modes.def suggests
>> that there's __vector_pair and __vector_quad, what's the GIMPLE types
>> for those?  It seems they
>> are either SSA names or expanded to pseudo registers but there's no
>> constants for them.
> 
> The __vector_pair and __vector_quad types are target specific types
> for use with our Matrix-Math-Assist (MMA) unit and they are only
> usable with our associated MMA built-in functions.  What they hold
> is really dependent on which MMA built-ins you use on them.
> You can think of them a generic (and large) vector type where the
> subtype is undefined...or defined by which built-in function you
> happen to be using.
> 
> We do not have any constants defined for them.  How we initialize them
> is either by loading values from memory into them or by zeroing them
> out using the xxsetaccz instruction (only for __vector_quads).

So, looks like that the variable with OPAQUE_TYPE cannot be all explicitly initialized even at source code level. 

The only way to initialize such variable (only __vector_quad, not for __vector_pairs) at source code level is through call to __builtin_mma_xxsetaccz as:

void
foo (__vector_quad *dst)
{
  __vector_quad acc;
  __builtin_mma_xxsetaccz(&acc);
  *dst = acc;
}

Is this the correct understanding?

Is there way to initialize such variable to other values than zero at source code level?

Qing

> 
> 
> 
> 
>> Can they be initialized?  I see they can be copied at least.
> 
> __vector_quads can be zero initialized using the __builtin_mma_xxsetaccz()
> built-in function.  We don't have a method (or use case) for zero initializing
> __vector_pairs.


> 
> 
> 
>> If such "things" cannot be initialized they should indeed be exempt
>> from auto-init.  The
>> documentation suggests that they act as bit-bucked but even bit-buckets should
>> be initializable, thus why exactly does CONST0_RTX not exist for them?
> 
> We used to have CONST0_RTX defined (but nothing else), but we had problems
> with the compiler CSEing the initialization for multiple __vector_quads and
> then copying the values around.  We'd end up with one xxsetaccz instruction
> and copies out of that accumulator register into the other accumulator
> registers.  Copies are VERY expensive, while xxsetaccz's are cheap, so we
> don't want that.  That said, I think a fix I put in to disable fwprop on
> these types may have been the culprit for that problem, so maybe we could
> add the CONST0_RTX back?  I'd have to verify that.  If so, then we'd at least
> be able to support -ftrivial-auto-var-init=zero.  The =pattern version
> would be more problematical...unless the value for pattern was loaded from
> memory.
> 
> Peter
> 
> 


  reply	other threads:[~2021-11-30 17:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 21:56 Peter Bergner
2021-11-29 22:56 ` Qing Zhao
2021-11-30  8:37   ` Richard Biener
2021-11-30 15:14     ` Peter Bergner
2021-11-30 17:51       ` Qing Zhao [this message]
2021-11-30 18:08         ` Peter Bergner
2021-11-30 19:50           ` Qing Zhao
2021-11-30 20:07             ` Peter Bergner
2021-11-30 20:44               ` Qing Zhao
2021-11-30 22:35                 ` Peter Bergner
2021-12-01  9:01                   ` Richard Biener
2021-12-01 15:06                     ` Qing Zhao
2021-12-01 16:08                       ` Peter Bergner
2021-12-01 17:42                     ` Peter Bergner
2021-12-01 19:07                       ` Richard Biener
2021-12-01 19:29                         ` Peter Bergner
2021-11-30 17:59     ` Qing Zhao

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=D82F4736-B206-4DF2-A865-6227F41E193A@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).