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


Groups > comp.arch > #32749 > unrolled thread

CISC to RISC dual aspect code idea

Started byQuadibloc <jsavard@ecn.ab.ca>
First post2016-01-14 08:28 -0800
Last post2016-01-15 04:32 -0800
Articles 9 — 5 participants

Back to article view | Back to comp.arch


Contents

  CISC to RISC dual aspect code idea Quadibloc <jsavard@ecn.ab.ca> - 2016-01-14 08:28 -0800
    Re: CISC to RISC dual aspect code idea Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2016-01-14 09:25 -0800
      Re: CISC to RISC dual aspect code idea Quadibloc <jsavard@ecn.ab.ca> - 2016-01-14 09:38 -0800
    Re: CISC to RISC dual aspect code idea Walter Banks <walter@bytecraft.com> - 2016-01-14 13:36 -0500
      Re: CISC to RISC dual aspect code idea Quadibloc <jsavard@ecn.ab.ca> - 2016-01-14 18:53 -0800
        Re: CISC to RISC dual aspect code idea Walter Banks <walter@bytecraft.com> - 2016-01-15 12:15 -0500
    Re: CISC to RISC dual aspect code idea MitchAlsup <MitchAlsup@aol.com> - 2016-01-14 15:01 -0800
      Re: CISC to RISC dual aspect code idea Quadibloc <jsavard@ecn.ab.ca> - 2016-01-14 19:06 -0800
        Re: CISC to RISC dual aspect code idea Bruce Hoult <bruce.hoult@gmail.com> - 2016-01-15 04:32 -0800

#32749 — CISC to RISC dual aspect code idea

FromQuadibloc <jsavard@ecn.ab.ca>
Date2016-01-14 08:28 -0800
SubjectCISC to RISC dual aspect code idea
Message-ID<ee9b3630-9bdc-4444-baed-2faf4b1acd80@googlegroups.com>
In a thread 'Making Fat Binaries Work for You', I suggested that a computer 
might provide similar CISC and RISC instruction sets, where the program would 
exist in its entirety in CISC form, but where some segments would have an 
alternate RISC version that did the same thing.

The idea was that RISC reduces latency by having more registers - so when 
several threads are running, registers would be conserved by using the CISC 
form, and throughput is maintained by multithreading.

The objection was raised that debugging might be made more complicated.

Then, in the thread 'Fat Binaries Without the Extra Weight', I noted that with 
some restrictions, I was able to come up with a way to have code that could be 
executed in a semi-DSP fashion or a plain RISC fashion. But the base version 
had to be RISC and not CISC, as I needed more registers to play with to make 
the idea workable.

Now I've come up with a third idea in this vein, but I suspect it's not 
original with me.

Given that it's really only the loops in a program that need to be optimized 
(in most cases), I now have something that spans the CISC to RISC area of the 
spectrum. But it involves severe restrictions, and thus is not useful for all 
programs.

Basically:

Write the program in CISC form.

Where one has an innermost loop that doesn't call any subroutines, and where 
the loop is ruled solely by a counter, with no other termination conditions...

and each iteration of the loop is independent of all other iterations,

then, if the loop is delimited by instructions: 

LOOP N

and

REPEAT

where the code between them is repeated with the LOOP N instruction putting the 
numbers from 0 to N-1 in, say, register 7 of a register bank from 0 to 7...

the processor could, if more registers are available, copy the data in the 
registers to other register sets, except for putting a different count value in 
register 7 of each set.

Aside from the restrictions excluding the innermost loops of many types of 
program, another problem is that for independent iterations to do something 
useful, they'll have to reference memory. Since each iteration is 
self-contained, there's a big stall after the initial read instructions that 
can't be filled with anything useful.

So this clearly needs some work.

John Savard

[toc] | [next] | [standalone]


#32757

FromStephen Fuld <SFuld@alumni.cmu.edu.invalid>
Date2016-01-14 09:25 -0800
Message-ID<n78lhn$f6d$1@dont-email.me>
In reply to#32749
On 1/14/2016 8:28 AM, Quadibloc wrote:

snip

> Given that it's really only the loops in a program that need to be optimized
> (in most cases), I now have something that spans the CISC to RISC area of the
> spectrum. But it involves severe restrictions, and thus is not useful for all
> programs.
>
> Basically:
>
> Write the program in CISC form.
>
> Where one has an innermost loop that doesn't call any subroutines, and where
> the loop is ruled solely by a counter, with no other termination conditions...
>
> and each iteration of the loop is independent of all other iterations,
>
> then, if the loop is delimited by instructions:
>
> LOOP N
>
> and
>
> REPEAT
>
> where the code between them is repeated with the LOOP N instruction putting the
> numbers from 0 to N-1 in, say, register 7 of a register bank from 0 to 7...
>
> the processor could, if more registers are available, copy the data in the
> registers to other register sets, except for putting a different count value in
> register 7 of each set.

This sounds like something compilers can do today.



-- 
  - Stephen Fuld
(e-mail address disguised to prevent spam)

[toc] | [prev] | [next] | [standalone]


#32758

FromQuadibloc <jsavard@ecn.ab.ca>
Date2016-01-14 09:38 -0800
Message-ID<d5a2026e-a988-47e2-a493-6c72804d724f@googlegroups.com>
In reply to#32757
On Thursday, January 14, 2016 at 10:25:48 AM UTC-7, Stephen Fuld wrote:

> This sounds like something compilers can do today.

Compilers do unroll loops today. But this is about a loop that gets 
unrolled by the processor _if_ resources are available so that 
unrolling will help.

John Savard

[toc] | [prev] | [next] | [standalone]


#32761

FromWalter Banks <walter@bytecraft.com>
Date2016-01-14 13:36 -0500
Message-ID<n78ps9$5tc$1@gioia.aioe.org>
In reply to#32749
On 14/01/2016 11:28 AM, Quadibloc wrote:
> In a thread 'Making Fat Binaries Work for You', I suggested that a computer
> might provide similar CISC and RISC instruction sets, where the program would
> exist in its entirety in CISC form, but where some segments would have an
> alternate RISC version that did the same thing.
>
> The idea was that RISC reduces latency by having more registers - so when
> several threads are running, registers would be conserved by using the CISC
> form, and throughput is maintained by multithreading.
>
> The objection was raised that debugging might be made more complicated.
>
> Then, in the thread 'Fat Binaries Without the Extra Weight', I noted that with
> some restrictions, I was able to come up with a way to have code that could be
> executed in a semi-DSP fashion or a plain RISC fashion. But the base version
> had to be RISC and not CISC, as I needed more registers to play with to make
> the idea workable.
>
> Now I've come up with a third idea in this vein, but I suspect it's not
> original with me.
>
> Given that it's really only the loops in a program that need to be optimized
> (in most cases), I now have something that spans the CISC to RISC area of the
> spectrum. But it involves severe restrictions, and thus is not useful for all
> programs.
>
> Basically:
>
> Write the program in CISC form.
>
> Where one has an innermost loop that doesn't call any subroutines, and where
> the loop is ruled solely by a counter, with no other termination conditions...
>
> and each iteration of the loop is independent of all other iterations,
>
> then, if the loop is delimited by instructions:
>
> LOOP N
>
> and
>
> REPEAT
>
> where the code between them is repeated with the LOOP N instruction putting the
> numbers from 0 to N-1 in, say, register 7 of a register bank from 0 to 7...
>
> the processor could, if more registers are available, copy the data in the
> registers to other register sets, except for putting a different count value in
> register 7 of each set.
>
> Aside from the restrictions excluding the innermost loops of many types of
> program, another problem is that for independent iterations to do something
> useful, they'll have to reference memory. Since each iteration is
> self-contained, there's a big stall after the initial read instructions that
> can't be filled with anything useful.
>

Fundamentally a workable idea but has some problems. The most 
significant is who in the long run is responsible for resource 
management the compiler or the execution unit. The compiler in most 
ISA's would still need to know that this is happening.

Compiling for a risc target is often about generating the kind of code 
you are describing.

There is the issue of generally wanting to do at compile time what ever 
is possible. Increasingly code is being compiled to internal 
representation and a simple compiler implemented as a loader performs 
targeting and location specific details. What your are describing might 
be able to done in that step in some cases.

Another approach that we have done (implemented in one processor ISA) 
was to give the processor a macro capability. This allows very complex 
instructions. This approach did not find as much use as I expected. Even 
though I wrote the code generator our C compiler for this processor I 
found that there are not many sequences that could be broken out and 
turned int very complex instructions.

w..

[toc] | [prev] | [next] | [standalone]


#32779

FromQuadibloc <jsavard@ecn.ab.ca>
Date2016-01-14 18:53 -0800
Message-ID<a45cd2a4-2291-4e2c-a033-7c0c2d300caf@googlegroups.com>
In reply to#32761
On Thursday, January 14, 2016 at 11:37:02 AM UTC-7, Walter Banks wrote:
> The most 
> significant is who in the long run is responsible for resource 
> management the compiler or the execution unit. The compiler in most 
> ISA's would still need to know that this is happening.

Hmm. When I think of resource allocation, I think of the _operating system_. 
The compiler knows that it is preparing code that can be executed in one of two 
ways depending on how busy the machine is at a given time - but it gives the 
same answer either way.

So the compiler's job, as I see it, is simply to try to use this construct 
whenever possible.

John Savard

[toc] | [prev] | [next] | [standalone]


#32792

FromWalter Banks <walter@bytecraft.com>
Date2016-01-15 12:15 -0500
Message-ID<n7b9fe$6ms$1@gioia.aioe.org>
In reply to#32779
On 14/01/2016 9:53 PM, Quadibloc wrote:
> On Thursday, January 14, 2016 at 11:37:02 AM UTC-7, Walter Banks
> wrote:
>> The most significant is who in the long run is responsible for
>> resource management the compiler or the execution unit. The
>> compiler in most ISA's would still need to know that this is
>> happening.
>
> Hmm. When I think of resource allocation, I think of the _operating
> system_. The compiler knows that it is preparing code that can be
> executed in one of two ways depending on how busy the machine is at a
> given time - but it gives the same answer either way.
>
> So the compiler's job, as I see it, is simply to try to use this
> construct whenever possible.

The context of resource management I was using was processor resources
from a compiler perspective. Why it may be more complex than "Use this
construct whenever possible" is the compiler has a bigger picture of the
application (although it is a static view).  The implications are your
proposed construct may or may not be appropriate at any point in the
code after the bigger picture accounts all of the considerations.

A quick read through the original post suggested to me that the impact
may be optimizing data flow through the registers. Not surprisingly the
mill might be able to deal with this type of problem rather well.

w..


[toc] | [prev] | [next] | [standalone]


#32772

FromMitchAlsup <MitchAlsup@aol.com>
Date2016-01-14 15:01 -0800
Message-ID<e0a072b6-49bc-40af-81b3-a9d5f1a58e49@googlegroups.com>
In reply to#32749
On Thursday, January 14, 2016 at 10:28:06 AM UTC-6, Quadibloc wrote:
<snip>
> the processor could, if more registers are available, copy the data in the 
> registers to other register sets, except for putting a different count value in 
> register 7 of each set.
> 
> Aside from the restrictions excluding the innermost loops of many types of 
> program, another problem is that for independent iterations to do something 
> useful, they'll have to reference memory. Since each iteration is 
> self-contained, there's a big stall after the initial read instructions that 
> can't be filled with anything useful.

This is related to Andy Glew's microthreading concepts.

[toc] | [prev] | [next] | [standalone]


#32780

FromQuadibloc <jsavard@ecn.ab.ca>
Date2016-01-14 19:06 -0800
Message-ID<7de2bcda-d035-4ee1-85a3-de1826432ab6@googlegroups.com>
In reply to#32772
On Thursday, January 14, 2016 at 4:01:15 PM UTC-7, MitchAlsup wrote:

> This is related to Andy Glew's microthreading concepts.

I found what _might_ be a reference to them in a post on this group. If that 
was a reference, the whole idea of why I found CISC worthwhile would be related 
to that... "the large number of registers [of RISC] would become burdensome if 
microthreading became more common", and writing the code in CISC form is at 
least partly to facilitate that (although the main intent is so that many 
applications running, and an operating system with lots of processes going, can 
avoid bringing the system to a crawl by making each thread potentially very 
light on system resources).

So, while the one idea I had that seemed like it might work that occupied the 
RISC-to-DSP space is in direct competition to the Mill, I'm regarding finding 
some way to straddle the CISC-to-RISC space as more valuable.

John Savard

[toc] | [prev] | [next] | [standalone]


#32787

FromBruce Hoult <bruce.hoult@gmail.com>
Date2016-01-15 04:32 -0800
Message-ID<91ec24db-d5e9-469f-87e1-21dbb87bfa26@googlegroups.com>
In reply to#32780
On Friday, January 15, 2016 at 6:06:25 AM UTC+3, Quadibloc wrote:
> On Thursday, January 14, 2016 at 4:01:15 PM UTC-7, MitchAlsup wrote:
> 
> > This is related to Andy Glew's microthreading concepts.
> 
> I found what _might_ be a reference to them in a post on this group. If that 
> was a reference, the whole idea of why I found CISC worthwhile would be related 
> to that... "the large number of registers [of RISC] would become burdensome if 
> microthreading became more common", and writing the code in CISC form is at 
> least partly to facilitate that (although the main intent is so that many 
> applications running, and an operating system with lots of processes going, can 
> avoid bringing the system to a crawl by making each thread potentially very 
> light on system resources).
> 
> So, while the one idea I had that seemed like it might work that occupied the 
> RISC-to-DSP space is in direct competition to the Mill, I'm regarding finding 
> some way to straddle the CISC-to-RISC space as more valuable.

Saving and reloading the 128 or 256 bytes of registers in a typical RISC is nothing compared to flushing the caches.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.arch


csiph-web