Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #828

Re: Green Compiler ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end
From Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups comp.compilers
Subject Re: Green Compiler ?
Date Wed, 02 Jan 2013 07:29:16 +0100
Organization Compilers Central
Lines 75
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <13-01-005@comp.compilers> (permalink)
References <12-12-010@comp.compilers> <12-12-012@comp.compilers> <12-12-022@comp.compilers> <12-12-028@comp.compilers> <12-12-034@comp.compilers> <12-12-037@comp.compilers> <13-01-002@comp.compilers>
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace leila.iecc.com 1357150805 25369 64.57.183.58 (2 Jan 2013 18:20:05 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Wed, 2 Jan 2013 18:20:05 +0000 (UTC)
Keywords architecture, performance, comment
Posted-Date 02 Jan 2013 13:20:05 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:828

Show key headers only | View raw


George Neuner schrieb:
> On Sun, 30 Dec 2012 08:14:26 +0100, Hans-Peter Diettrich
> <DrDiettrich1@aol.com> wrote:
>
>> Peter Dassow schrieb:
>>> On 28.12.2012 08:35, Hans-Peter Diettrich wrote:
>>>> Please note that most CMOS processor power consumption results from
>>>> switching (stray) capacities, and only a small percentage for leak
>>>> currents. E.g. a register or gate consumes such power whenever a bit is
>>>> changed, and almost nothing when it has reached an stable state.
>
> Smaller transistors have more leakage.

ACK (tunneling effect).

>>> So using extensively registers instead of "conventional" memory (e.g.
>>> DDR-RAM, memory outside a CPU) will save energy (if equal functionality
>>> is given) ?
>> I don't see a relationship here, except that external memory is slow
>> and [in x86] a couple of caches and address translations are involved
>> in reading from RAM.
>
> But associative cache and external memory accesses both are power
> intensive.

Right, but since every reference to external memory costs *time* in
the first place, *every* compiler already optimizes for best register
usage.  There is nothing that can be done *additionally* in a "green"
compiler.  C already has a "register" keyword, as a compiler hint to
hold a local variable in an register.

The actual use of registers depends on the control flow taken
*actually*. When a subroutine is optimized for using all available
registers, it has to save and restore the registers on entry/exit.
When it actually does nothing, due to given conditions, the time and
energy used for pushing/popping the registers is only wasted.

For that reason some (Texas Instruments?) processors implemented a
register stack, decades ago, with its stack pointer adjusted according
to the number of registers used in a subroutine. This stack could be
moved into the CPU nowadays, eliminating the need for saving registers
in external memory. But this optimization reaches a hard limit on
deeply nested calls, with every subroutine using a high number of
registers. In external memory the register-stack size is adjustable to
program needs, just like ordinary stack size is, but a CPU resident
register stack has a fixed depth. Eventually the register stack still
could be kept in RAM, with an dedicated cache equivalent to the L1/L2
caches. Then the caches would automatically push/pop register contents
depending on their actual *use*, not by fixed push/pop *instruction
sequences*. OTOH we already have nested caches, so that the effect of
an additional register cache is questionable. (see Wikipedia "CPU
cache")

The x86 architecture uses another approach (register renaming), with a
high number of shadow registers (compared to only 16 addressable
registers). I'm not sure, though, how a compiler should generate code
for best use of that model...


>> But registers are a very scarce resource, so that frequent loading from
>> memory is hardly avoidable.
>
> My opinions are colored by experience with DSPs, but I have long
> thought that it would be helpful to have a few K-words of non-cache
> scratchpad memory very close (1..2 cycles) to the CPU.

ACK, but see above considerations on the use of such memory, with its
*size* limited by the architecture, and *usage* depending on subroutine
needs and control flow (subroutine nesting, branches taken...).

DoDi
[There were stacks with the top few registers kept in fast memory in
the Burroughs machines in the 1960s.  It was easy to generate code for
them, but since register coloring was invented in the 1970s, modern
code scheduling for normal registers is much more effective.  -John]

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Green Compiler ? Abid <abidmuslim@gmail.com> - 2012-12-20 02:00 -0800
  Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-23 08:18 +0000
    Re: Green Compiler ? Peter Dassow <z80eu@arcor.de> - 2012-12-26 19:31 +0100
      Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-28 03:09 +0000
      Re: Green Compiler ? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-12-28 08:35 +0100
        Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-28 16:14 +0000
        Re: Green Compiler ? Peter Dassow <z80eu@arcor.de> - 2012-12-29 09:35 +0100
          Re: Green Compiler ? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-12-30 08:14 +0100
            Re: Green Compiler ? George Neuner <gneuner2@comcast.net> - 2012-12-31 01:24 -0500
              Re: Green Compiler ? "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2013-01-02 04:09 +0000
                Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-02 18:29 +0000
              Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-02 05:11 +0000
              Re: Green Compiler ? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2013-01-02 07:29 +0100
                Re: Green Compiler ? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-02 19:52 +0000
                Re: Green Compiler ? "Charles Richmond" <numerist@aquaporin4.com> - 2013-01-04 08:59 -0600
  Re: Green Compiler ? "Nils M Holm" <nmh@t3x.org> - 2012-12-23 10:01 +0100
    Re: Green Compiler ? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-12-24 05:16 +0100
    Re: Green Compiler ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-12-27 13:36 +0000
      Re: Green Compiler ? "Nils M Holm" <nmh@t3x.org> - 2012-12-28 09:11 +0100
        Re: Green Compiler ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-12-28 16:57 +0000
        Re: Green Compiler ? George Neuner <gneuner2@comcast.net> - 2012-12-28 12:57 -0500
          Re: Green Compiler ? "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-12-30 09:22 +0100
    Re: Green Compiler ? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-27 21:59 -0600
  Re: Green Compiler ? Walter Banks <walter@bytecraft.com> - 2012-12-28 10:42 -0500

csiph-web