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


Groups > comp.lang.forth > #59597

Re: ANN: matmul package available

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: ANN: matmul package available
Date 2017-05-20 13:23 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017May20.152340@mips.complang.tuwien.ac.at> (permalink)
References <2017May19.124347@mips.complang.tuwien.ac.at> <7d88df2f-8072-4def-8c00-563de8df3be5@googlegroups.com> <2017May19.161605@mips.complang.tuwien.ac.at> <f31c4f64-1c12-4318-a8a8-16522b40b990@googlegroups.com>

Show all headers | View raw


pahihu <pahihu@gmail.com> writes:
>This is about 15% faster using gforth-fast on Intel.
>
>pahihu
>
>: faxpy-nostride ( ra f_x f_y ucount -- )
>    \ vy=ra*vx+vy
>    dup >r 3 and ?dup IF
>        0 do
>            swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+
>        loop
>        swap
>    THEN
>    r> 2 rshift 0 ?do
>        swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+
>        swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+
>        swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+
>        swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+
>    loop
>    2drop fdrop ;

Interesting:

cycles insts
2220M  7730M  fdup over f@ f* dup f@ f+ dup f! float+ swap float+ swap
1989M  7730M  swap fdup dup f@ f* float+ swap dup f@ f+ dup f! float+ 
1988M  7730M  fdup swap dup f@ f* float+ swap dup f@ f+ dup f! float+ 

So the number of instructions is the same, but your variant performs
better (and 3.89 instructions per cycle is pretty close to the speed
of light on this CPU).  Do you have an explanation for that, or was
this based on just trying different variants?

However, VFX and SwiftForth are slightly slower with variants 2 and 3,
and given that the default for Gforth does not use this code, I'll
stick with variant 1 for the matmul package.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2017: http://www.euroforth.org/ef17/

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


Thread

ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-19 10:43 +0000
  Re: ANN: matmul package available krishna.myneni@ccreweb.org - 2017-05-19 05:20 -0700
    Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-19 14:16 +0000
      Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-19 08:28 -0700
        Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-20 05:25 -0700
        Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 13:23 +0000
          Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-20 08:43 -0700
            Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 16:02 +0000
              Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-20 11:36 -0700
                Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-21 07:52 +0000
                Re: ANN: matmul package available mhx@iae.nl - 2017-05-21 03:28 -0700
                Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-21 05:32 -0700
                Re: ANN: matmul package available mhx@iae.nl - 2017-05-21 05:52 -0700
                Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-21 07:54 -0700
                Re: ANN: matmul package available mhx@iae.nl - 2017-05-21 08:32 -0700
                Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-21 11:24 -0700
                Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-21 13:52 +0000
                Re: ANN: matmul package available mhx@iae.nl - 2017-05-21 08:47 -0700
                Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-22 09:50 +0000
                Re: ANN: matmul package available pahihu <pahihu@gmail.com> - 2017-05-22 07:14 -0700
                Re: ANN: matmul package available mhx@iae.nl - 2017-05-22 07:39 -0700
                Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-23 10:06 +0000
  Re: ANN: matmul package available albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-19 17:00 +0200
    Re: ANN: matmul package available anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 13:59 +0000

csiph-web