public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: powerpc & unaligned block moves with fp registers
       [not found] <200111111507.HAA13665@kankakee.wrs.com>
@ 2001-11-01  5:24 ` degger
  2001-11-01  5:34 ` David Edelsohn
  1 sibling, 0 replies; 11+ messages in thread
From: degger @ 2001-11-01  5:24 UTC (permalink / raw)
  To: mrs; +Cc: gcc

On 11 Nov, mike stump wrote:

> And next, tell us what the performance would be if 98.3% of all
> dynamic loads were aligned just right, and the remainder were not in a
> typical large application, and the same stat for a smallish
> application?

This cries for some heuristics which decides that some structure is
likely to be accessed more often and thus possible more critical
to performance due to many accesses.
 
> If the size decrease improves the instruction cache, and most of the
> dynamic cases run fast anyway, would it not be possible for the code
> to be actually slow if we followed your recommendation, even in the
> non -Os case?  If not, why not?

This is not an easy decision and for sure one I wouldn't want to enforce
globally for the whole compiler. Also the amount of effect depends very
much on the complete system; the CPU, the amount of memory and cache and
even the operation mode of the CPU. Maybe it would be possible to
implement some feedback optimisation that doesn't just instrument the
iteration count of some codeblock but also the effect on the current
CPU including the cachemisses. Of course is not a good general approach
but would be a start to tell the compiler "optimize the software for a
machine close or equal to this one".
 
> Also, what is the typical non-aligned hit rate in a large suit of
> benchmarks?  1.7%, lower, higher?

No idea, I'll leave that up to the benchmark guys.
 
> Anyway...  I ask all there questions, to try and help ensure that as
> we make changes in this area, that we don't just make them blindly (in
> the absence of real benchmarking data).

Yes, this looks like a sane idea and I appreciate your efforts to keep 
me away from dreaming of an ideal world. :)

--
Servus,
       Daniel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
       [not found] <200111111507.HAA13665@kankakee.wrs.com>
  2001-11-01  5:24 ` powerpc & unaligned block moves with fp registers degger
@ 2001-11-01  5:34 ` David Edelsohn
  1 sibling, 0 replies; 11+ messages in thread
From: David Edelsohn @ 2001-11-01  5:34 UTC (permalink / raw)
  To: mike stump; +Cc: degger, gcc

>>>>> mike stump writes:

mike> Anyway...  I ask all there questions, to try and help ensure that as
mike> we make changes in this area, that we don't just make them blindly (in
mike> the absence of real benchmarking data).

	FYI, IBM performs these types of benchmarks on its compilers and I
am applying those deduced heuristics to the PowerPC backend of GCC.
However, those heuristics only are effective if the common part of the
backend uses machine description hooks instead of applying its own,
generic heuristics.

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
@ 2003-11-01 19:53 Robert Dewar
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Dewar @ 2003-11-01 19:53 UTC (permalink / raw)
  To: dalej, dewar; +Cc: dj, dje, gcc, mrs

> I would have to be shown that there is existing code that expects 
> volatile
> accesses to misaligned doubles to be atomic.

I would certaqinly agre that this expectation is highly dubious.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
@ 2003-11-01 19:52 Robert Dewar
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Dewar @ 2003-11-01 19:52 UTC (permalink / raw)
  To: dalej, dewar; +Cc: dj, dje, gcc, mrs

> I agree with this, actually, but the group seems to be moving more in 
> the
> direction of not supporting anything nonstandard (strict aliasing, which
> broke lots of existing code including gcc itself, springs to mind).


A couple of points here.

First the standard is a means to an end, not an end in itself. The end is to 
provide a useful compiler. A compiler that meets the standard but is not
useful is a dubious artifact. So arguing from the standard is always a
tricky business. Certainly we don't want to do seriously inefficient
things to accomodate "bad" code, but we have to be careful to make sure
that we are talking about serious inefficiency.

Compiler writers always tend to be too optimistic about the benefits of
particular optimizations.

For example, strict aliasing, just how important is this. As compiler
writers, we would tend to believe it was critical, but do we really have
data that supports this. The only measurement we did in Ada was on the
compiler itself. GNAT runs 1% slower if compiled with no strict aliasing.
Since strict aliasing results in a number of unexpected behaviors in
Ada code (all cases where the standard does not require the expected 
behavior, but this does not chnage the expectations :-)

Richard reacts that the compiler is non-typical (our discussion was about
whether strict aliasing should be the default in GNAT). Fine, I am willing
to believe that is the case, but still it would be nice to have some real
customer programs that show the supposed huge benefits of strict aliasing!


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
  2003-11-01 12:21 Robert Dewar
@ 2003-11-01 19:47 ` Dale Johannesen
  0 siblings, 0 replies; 11+ messages in thread
From: Dale Johannesen @ 2003-11-01 19:47 UTC (permalink / raw)
  To: Robert Dewar; +Cc: Dale Johannesen, mrs, dj, dje, gcc

On Saturday, November 1, 2003, at 04:21  AM, Robert Dewar wrote:

>> We should be very careful to not remove `working' and reasonable
>> semantics that are widely implemented and depended on by existing 
>> code,
>> just because some standard can be read in such a way that suggest that
>> something might not be mandated to work.

I agree with this, actually, but the group seems to be moving more in 
the
direction of not supporting anything nonstandard (strict aliasing, which
broke lots of existing code including gcc itself, springs to mind).

> I would think that many C programs assume that access to a volatile 
> variable
> is in fact atomic if the machine can easily generate instructions to 
> make
> it so, given that standard C lacks a mechanism for specifying atomic 
> access,
> so I would agree with Mike that you want to be careful here on making 
> changes.

I would have to be shown that there is existing code that expects 
volatile
accesses to misaligned doubles to be atomic.  This doesn't even work in
many environments.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
@ 2003-11-01 12:21 Robert Dewar
  2003-11-01 19:47 ` Dale Johannesen
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Dewar @ 2003-11-01 12:21 UTC (permalink / raw)
  To: dalej, mrs; +Cc: dj, dje, gcc

> We should be very careful to not remove `working' and reasonable 
> semantics that are widely implemented and depended on by existing code, 
> just because some standard can be read in such a way that suggest that 
> something might not be mandated to work.

I would think that many C programs assume that access to a volatile variable
is in fact atomic if the machine can easily generate instructions to make
it so, given that standard C lacks a mechanism for specifying atomic access,
so I would agree with Mike that you want to be careful here on making changes.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
       [not found] <E38331EE-0BF3-11D8-A9BB-000393D76DAA@apple.com>
@ 2003-11-01  7:02 ` Mike Stump
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Stump @ 2003-11-01  7:02 UTC (permalink / raw)
  To: Dale Johannesen; +Cc: David Edelsohn, dj, gcc

On Friday, October 31, 2003, at 02:45  PM, Dale Johannesen wrote:
> On Friday, October 31, 2003, at 07:47  AM, David Edelsohn wrote:
>> 1. Do we *ever* want to use fp regs for unaligned mem-mem moves?  Is
>>    there any 32-bit PPC chip where an unaligned 64-bit fp move is
>>    faster than two (maybe unaligned, maybe mot) 32-bit moves?
>>
>> 	What about volatile?
>
> I don't believe 'volatile' requires atomic accesses.  You can have 
> objects of
> volatile-qualified struct types, and can copy them.

We should be very careful to not remove `working' and reasonable 
semantics that are widely implemented and depended on by existing code, 
just because some standard can be read in such a way that suggest that 
something might not be mandated to work.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
@ 2003-10-31 19:26 David Edelsohn
  0 siblings, 0 replies; 11+ messages in thread
From: David Edelsohn @ 2003-10-31 19:26 UTC (permalink / raw)
  To: dj; +Cc: gcc

1. Do we *ever* want to use fp regs for unaligned mem-mem moves?  Is
   there any 32-bit PPC chip where an unaligned 64-bit fp move is
   faster than two (maybe unaligned, maybe mot) 32-bit moves?

	What about volatile?

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
  2001-11-01  5:26   ` David Edelsohn
@ 2001-11-01  8:46     ` degger
  0 siblings, 0 replies; 11+ messages in thread
From: degger @ 2001-11-01  8:46 UTC (permalink / raw)
  To: dje; +Cc: gcc

On 11 Nov, David Edelsohn wrote:

>> Depends on the CPU, The latest PPCs for example combine
>> accesses under most conditions, however having several
>> accesses instead of a single one will lead to higher I-Cache
>> pressure. I would prefer aligning the complete structure on a
>> natural boundary and extract single components by masking
>> them.

> 	Aligning the structure on particular boundaries violates the
> existing PowerPC ABIs.  Next...

So the linker is not free to choose where to put the structures in
memory? Dang, I haven't thought about this I have to admit. At least we
could issue a warning telling the developper to reconsider the structure
entries to get a better alignment.

--
Servus,
       Daniel 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
  2001-11-01  5:25 ` degger
@ 2001-11-01  5:26   ` David Edelsohn
  2001-11-01  8:46     ` degger
  0 siblings, 1 reply; 11+ messages in thread
From: David Edelsohn @ 2001-11-01  5:26 UTC (permalink / raw)
  To: degger; +Cc: dewar, gcc

>>>>> degger  writes:

Daniel> Depends on the CPU, The latest PPCs for example combine accesses under
Daniel> most conditions, however having several accesses instead of a single one
Daniel> will lead to higher I-Cache pressure. I would prefer aligning the
Daniel> complete structure on a natural boundary and extract single components
Daniel> by masking them.

	Aligning the structure on particular boundaries violates the
existing PowerPC ABIs.  Next...

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: powerpc & unaligned block moves with fp registers
       [not found] <20011111025300.E46B9F28BE@nile.gnat.com>
@ 2001-11-01  5:25 ` degger
  2001-11-01  5:26   ` David Edelsohn
  0 siblings, 1 reply; 11+ messages in thread
From: degger @ 2001-11-01  5:25 UTC (permalink / raw)
  To: dewar; +Cc: gcc

On 10 Nov, dewar@gnat.com wrote:

> Sure, of course, no one disputes that. The real issue is to find out
> whether unaligned accesses are better/same/worse as multiple accesses
> with combining of resuls.

Depends on the CPU, The latest PPCs for example combine accesses under
most conditions, however having several accesses instead of a single one
will lead to higher I-Cache pressure. I would prefer aligning the
complete structure on a natural boundary and extract single components
by masking them.

--
Servus,
       Daniel 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-11-01 19:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200111111507.HAA13665@kankakee.wrs.com>
2001-11-01  5:24 ` powerpc & unaligned block moves with fp registers degger
2001-11-01  5:34 ` David Edelsohn
2003-11-01 19:53 Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2003-11-01 19:52 Robert Dewar
2003-11-01 12:21 Robert Dewar
2003-11-01 19:47 ` Dale Johannesen
     [not found] <E38331EE-0BF3-11D8-A9BB-000393D76DAA@apple.com>
2003-11-01  7:02 ` Mike Stump
2003-10-31 19:26 David Edelsohn
     [not found] <20011111025300.E46B9F28BE@nile.gnat.com>
2001-11-01  5:25 ` degger
2001-11-01  5:26   ` David Edelsohn
2001-11-01  8:46     ` degger

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).