[gambit-list] New bignum macros in gambit.h
Bradley Lucier
lucier at math.purdue.edu
Fri Jan 6 14:56:17 EST 2006
Marc:
I tired of wondering whether fixing the bignum macros in gambit.h
would speed up bignum calculations substantially, so I changed them,
and the answer is, No, not really. I get about 2% speedup on some
operations, less on others, on a 2GHz G5 running Mac OS X 10.4.3,
with CC='gcc -mcpu=970 -m64'
So I investigated why this was happening. It turns out that I
already had changed the macros for F64VECTOR{REF,SET} to use the
information that the bottom bits of a fixnum are zero, so the fft in
bignum multiplication didn't benefit much from the change. (Loading
and unloading 8-bit values from the bignum didn't benefit from this
information about fixnums.)
Gambit needs a better GVM register allocator. You know that---there
is way too much screwing around moving values one and off the stack
at basic block boundaries, the stack is used for local variables in a
basic block, etc. You had code in the compiler to deal with at least
the latter problem, perhaps you want to break it out again and look
at it more closely.
_num.o is a bit smaller with the new macros:
[lindv2:~/programs/gambc40b16-new] lucier% ll lib/_num.o
-rw-r--r-- 1 lucier lucier 589036 Jan 6 12:32 lib/_num.o
[lindv2:~/programs/gambc40b16] lucier% ll lib/_num.o
-rw-r--r-- 1 lucier lucier 589260 Jan 6 10:48 lib/_num.o
The new macros are a *lot* cleaner, however, and the speedups are
fairly consistent, so I'm including my changed gambit.h in this e-
mail. I tested it with my set of bignum operations in gambit-
trace2.scm, which I'm also including, together with the results.
The new macros assume that ___{S,U}32 and ___{S,U}16 types exist.
Perhaps you'd like to say a few words why you jump through all the
hoops you do to allow Gambit to run on machines that don't have these
types. (I don't know of any current machines like that.)
BTW, some of the bignum a-digit macros were used in ways that I
wasn't familiar with; you must have added some new macros that used
the BIGA* macros in new ways. I didn't want to screw with the new
use of those macros, so I renamed the old macros to ___MARCBIGA* and
left them. Perhaps you'd like to look at those.
Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambit.h
Type: application/octet-stream
Size: 273852 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20060106/16f02704/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: results-new
Type: application/octet-stream
Size: 6040 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20060106/16f02704/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: results
Type: application/octet-stream
Size: 5906 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20060106/16f02704/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambit-trace2.scm
Type: application/octet-stream
Size: 7189 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20060106/16f02704/attachment-0003.obj>
More information about the Gambit-list
mailing list