[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [f-cpu] dynamic code reuse (fwd)



I read part of this paper... my main take-aways are as follows:

1) Instructions are often repeated verbatim.  This happens for many reasons
which are often difficult to address in the code or the compiler.

2) Caching previous results of instructions can help by avoiding
re-computing complex instructions unnecessarily.


And a few observations of my own:

1) Devik asserts that these cases are very difficult to optimize for in the
compiler.  The paper agrees with this (as do I).

2) Yann needs to read the paper if he wants to understand why these things
arise, even in good code.  (No offense intended.)  I don't want to embarrass
myself by attempting to summarize it here.

3) I may be wrong here, but I believe there is nothing to be gained from
caching the result of something like a dumb integer operation.  So this is
only worth considering for instructions that require access to resources
that take multiple cycles to execute, or are shared between multiple
execution pipes. [Pardon my ignorance of the f-cpu design]

4) For these complex instructions, cached results can be kept as a natural
extension to the common branch-prediction strategy of keeping branch results
in a cache that is indexed by the lower bits of the PC.  In this case,
adding such a caching mechanism really requires very little additional
complexity.

5) Hopefully #3 and #4 above provide some insight beyond the noise I've been
reading here.  And hopefully someone with a better knowledge of f-cpu can
determine if this approach should have a place here.  Given the severe
gate-count restrictions of low-budget emulation, I personally would be
inclined to shoot down this performance enhancement for the first f-cpu.

raj

[I've been following along for a while, this is my first post.  Thanks for
listening:) ]



-----Original Message-----
From: owner-f-cpu@seul.org [mailto:owner-f-cpu@seul.org] On Behalf Of Yann
Guidon
Sent: Tuesday, December 09, 2003 4:11 PM
To: f-cpu@seul.org
Subject: Re: [f-cpu] dynamic code reuse (fwd)

hello listees,

i'm just back from a trip where i couldn't read my email
so let me just throw some ideas and concepts ...

Martin Vahi wrote:

>  I guess taht the answer from Devik was ment to
>be sent to the list, so I just forward it. By the
>way, thanx for the answer!
>
>Regards,
>     Martin
>
>---------- Forwarded message ----------
>Date: Tue, 9 Dec 2003 14:11:04 +0100 (CET)
>From: devik <devik@cdi.cz>
>To: Martin Vahi <martinv@physic.ut.ee>
>Subject: Re: [f-cpu] dynamic code reuse
>
<snip>

>I have the same opinion as Martin Vahi that compiler good enough
>to spot places where to place such insn should be able to such
>code transformations (like exception aware GCSE) which would
>render such insn almost unuseful.
>  
>
my own opinion is : if an algorithm is flawed or inefficient,
it's silly to throw HW at it, or we all end up with "naughty hacks".

if there is a "cache" for past results, then the whole program should
be reorganised to manage this itself, at least, so it's more efficient
and less intrusive to the rest of the computer system. It's a source 
code-level
issue, not compiler-level nor architectural level. If you ask a computer
to do something silly, don't count on it to do what you "mean"
or the result might be worse.

gotta sleep,

>devik
>
YG

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/