public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgcc/108279] Improved speed for float128 routines
Date: Tue, 03 Jan 2023 21:02:09 +0000	[thread overview]
Message-ID: <bug-108279-4-oisHkanNUQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108279-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108279

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 54183
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54183&action=edit
Example patch with Michael S's code just pasted over the libgcc implementation,
for a test

A benchmarks: Just pasting over the code from the github
repo yields an improvement of gfortran's matmul by almost a factor of two,
so significant speedups are possible:

module tick
interface
function rdtsc() bind(C,name="rdtsc")
use iso_c_binding
integer(kind=c_long) :: rdtsc
end function rdtsc
end interface
end module tick

program main
use tick
use iso_c_binding
implicit none
integer, parameter :: wp = selected_real_kind(30)
! integer, parameter :: n=5000, p=4000, m=3666
integer, parameter :: n = 1000, p = 1000, m = 1000
real (kind=wp) :: c(n,p), a(n,m), b(m, p)
character(len=80) :: line
integer(c_long) :: t1, t2, t3
real (kind=wp) :: fl = 2.d0*n*m*p
integer :: i,j

print *,wp

line = '10 10'
call random_number(a)
call random_number(b)
t1 = rdtsc()
t2 = rdtsc()
t3 = t2-t1
print *,t3
t1 = rdtsc()
c = matmul(a,b)
t2 = rdtsc()
print *,1/(fl/(t2-t1-t3)),"Cycles per operation"
read (unit=line,fmt=*) i,j
write (unit=line,fmt=*) c(i,j)
end program main

showed

tkoenig@gcc188:~> ./original
16
32
^C
tkoenig@gcc188:~> time ./original
16
32
90.5696151959999999999999999999999997 Cycles per operation

real 1m2,148s
user 1m2,123s
sys 0m0,008s
tkoenig@gcc188:~> time ./modified
16
32
52.8148391719999999999999999999999957 Cycles per operation

real 0m36,296s
user 0m36,278s
sys 0m0,008s 

where "original" is the current libgcc soft-float implementation, and
"modified" is with the code from the repro.

It does not handle exceptions, so this causes a few regressions, but certainly
shows the potential

  reply	other threads:[~2023-01-03 21:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 20:55 [Bug libgcc/108279] New: " tkoenig at gcc dot gnu.org
2023-01-03 21:02 ` tkoenig at gcc dot gnu.org [this message]
2023-01-04 10:43 ` [Bug libgcc/108279] " jakub at gcc dot gnu.org
2023-01-04 17:14 ` tkoenig at gcc dot gnu.org
2023-01-04 22:19 ` already5chosen at yahoo dot com
2023-01-11 23:06 ` already5chosen at yahoo dot com
2023-01-12 23:24 ` tkoenig at gcc dot gnu.org
2023-01-13  0:34 ` already5chosen at yahoo dot com
2023-01-13  1:29 ` already5chosen at yahoo dot com
2023-01-14  9:21 ` tkoenig at gcc dot gnu.org
2023-01-14 10:22 ` tkoenig at gcc dot gnu.org
2023-01-14 23:52 ` already5chosen at yahoo dot com
2023-01-15  0:20 ` already5chosen at yahoo dot com
2023-01-15 15:13 ` tkoenig at gcc dot gnu.org
2023-01-15 19:17 ` tkoenig at gcc dot gnu.org
2023-01-15 19:28 ` jakub at gcc dot gnu.org
2023-01-15 22:27 ` already5chosen at yahoo dot com
2023-01-16 22:16 ` joseph at codesourcery dot com
2023-01-18 19:02 ` wilco at gcc dot gnu.org
2023-01-18 19:20 ` jakub at gcc dot gnu.org
2023-01-18 19:26 ` jakub at gcc dot gnu.org
2023-01-18 20:10 ` wilco at gcc dot gnu.org
2023-01-18 22:28 ` already5chosen at yahoo dot com
2023-01-18 23:31 ` already5chosen at yahoo dot com
2023-02-10 13:38 ` already5chosen at yahoo dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108279-4-oisHkanNUQ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).