Article View: comp.lang.forth
Article #35Re: Pairwise dot product
From: Anton Ertl
Date: Thu, 08 Oct 2026 21:37
Date: Thu, 08 Oct 2026 21:37
36 lines
2593 bytes
2593 bytes
peter <peter.noreply@tin.it> writes:
>I tested this on lxf64 running on a ryzen 9950x
>
>I got
> cycles instructions
>pairwise 789,294,432 3,628,952,994
>naive 2,510,536,091 6,512,423,204
Nice!
>First run with naive I got 35,476,814,233 cycles and 54,012,383,854 instr.
>I saw that you checked for F*+ . I have that as a library call, obviously
>clang does not use a fma instruction for it but instead compiles a call
>to a libray function.
I expect that with the right flags (maybe -march=x86-64-v3 will work)
it will use an fma instruction. Because these instructions were only
added in ~2010, they are not generated normally; and because C's fma()
guarantees that rounding only happens at the end (not between the f*
and the f+), it has to do an expensive library function if there is no
fma instruction available.
>I would guess that lxf is limited by the use of the x87 fpus small stack
>But I need to confirm that
For the version I used in benchmarking, I saw lots of code for the
data stack stuff, so either the FP stuff or working with ]] ... [[
seems to throw the usually perfect code generation of lxf for
straight-line code off track.
- 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: https://forth-standard.org/
EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
Technical Details
Message-ID:
<2026Oct8.233725@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<2026Oct8.175513@mips.complang.tuwien.ac.at> <20261008232336.0000698f@tin.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Pairwise dot product Date: Thu, 08 Oct 2026 21:37:25 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 36 Message-ID: <2026Oct8.233725@mips.complang.tuwien.ac.at> References: <2026Oct8.175513@mips.complang.tuwien.ac.at> <20261008232336.0000698f@tin.it> Injection-Date: Thu, 08 Oct 2026 21:48:49 +0000 (UTC) Injection-Info: dont-email.me; logging-data="257990"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PbbmSH6AQnpWEREtj5r+H"; posting-host="4440b373708cb595d29900b8ff51a766" Cancel-Lock: sha1:7df4QaGuNh+mhqG/Gs7spUrR1+Y= sha256:mY6UaMWnQMH58eiQL1Lj5oqIbtOBZt3qf18NZcWkMJ8= sha1:e+xIjhSfZhnuS5MEZ0TUfrC6ZbQ= sha256:Umklrc4vwBS0MiGuC8esM1Nca9wl0C6an5ZMfgHDkEQ= X-newsreader: xrn 10.11