public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128
@ 2022-04-28 19:37 zsojka at seznam dot cz
2022-04-28 21:53 ` [Bug target/105428] " joseph at codesourcery dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2022-04-28 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105428
Bug ID: 105428
Summary: compilation never (?) finishes with __builtin_casinl()
and __builtin_csqrtl() with -O -mlong-double-128
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: compile-time-hog, memory-hog
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 52900
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52900&action=edit
reduced testcase
Compiler output:
$ /repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc -O
-mlong-double-128 testcase.c -wrapper gdb,--args
...
^C
Program received signal SIGINT, Interrupt.
0x00007ffff7d91d00 in __memset_avx2_unaligned_erms () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff7d91d00 in __memset_avx2_unaligned_erms () from /lib64/libc.so.6
#1 0x0000000000d5f1d0 in memset (__len=<optimized out>, __ch=0,
__dest=0x7fe9e27b8018) at /usr/include/bits/string_fortified.h:59
#2 mpfr_add1 (a=a@entry=0x7fffffffc780, b=0x7fffffffc7c0, c=<optimized out>,
rnd_mode=MPFR_RNDA) at /repo/gcc-trunk/mpfr/src/add1.c:151
#3 0x0000000000d5e70d in mpfr_add (a=a@entry=0x7fffffffc780,
b=b@entry=0x7fffffffc7c0, c=c@entry=0x7fffffffc9b0,
rnd_mode=rnd_mode@entry=MPFR_RNDA) at /repo/gcc-trunk/mpfr/src/add.c:120
#4 0x0000000002764e5c in mpc_sqr (rop=rop@entry=0x7fffffffc880,
op=op@entry=0x7fffffffc990, rnd=rnd@entry=0) at
/repo/gcc-trunk/mpc/src/sqr.c:269
#5 0x000000000275b1eb in mpc_asin (rop=rop@entry=0x7fffffffc990,
op=op@entry=0x7fffffffc990, rnd=rnd@entry=0) at
/repo/gcc-trunk/mpc/src/asin.c:420
#6 0x000000000107147e in do_mpc_arg1 (format=0x28c2260 <ieee_quad_format>,
arg_imag=0x7ffff7b6ae20, arg_real=0x7ffff7b6ae40, func=0x275b0b0 <mpc_asin>,
result_imag=0x7fffffffcb20,
result_real=0x7fffffffcad0) at /repo/gcc-trunk/gcc/fold-const-call.cc:346
#7 do_mpc_arg1 (result_real=0x7fffffffcad0, result_imag=0x7fffffffcb20,
func=0x275b0b0 <mpc_asin>, arg_real=0x7ffff7b6ae40, arg_imag=0x7ffff7b6ae20,
format=0x28c2260 <ieee_quad_format>)
at /repo/gcc-trunk/gcc/fold-const-call.cc:326
#8 0x0000000001073246 in fold_const_call_cc (format=<optimized out>,
arg_imag=<optimized out>, arg_real=<optimized out>, fn=CFN_BUILT_IN_CASINL,
result_imag=0x7fffffffcb20,
result_real=0x7fffffffcad0) at /repo/gcc-trunk/gcc/fold-const-call.cc:1151
#9 fold_const_call_1 (fn=<optimized out>, type=0x7ffff7a3ff18, arg=<optimized
out>) at /repo/gcc-trunk/gcc/fold-const-call.cc:1252
#10 0x00000000018facc6 in gimple_resimplify1 (seq=0x0, res_op=0x7fffffffcd00,
valueize=0x1516d10 <valueize_op_1(tree)>) at
/repo/gcc-trunk/gcc/gimple-match-head.cc:215
#11 0x0000000001934571 in gimple_simplify (stmt=stmt@entry=0x7ffff7b853f0,
res_op=res_op@entry=0x7fffffffcd00, seq=seq@entry=0x0,
valueize=valueize@entry=0x1516d10 <valueize_op_1(tree)>,
top_valueize=top_valueize@entry=0x1516e00 <valueize_op(tree)>) at
/repo/gcc-trunk/gcc/gimple-match-head.cc:1113
#12 0x00000000010ad95a in gimple_fold_stmt_to_constant_1
(stmt=stmt@entry=0x7ffff7b853f0, valueize=valueize@entry=0x1516e00
<valueize_op(tree)>,
gvalueize=gvalueize@entry=0x1516d10 <valueize_op_1(tree)>) at
/repo/gcc-trunk/gcc/gimple-fold.cc:7391
#13 0x0000000001522450 in ccp_fold (stmt=0x7ffff7b853f0) at
/repo/gcc-trunk/gcc/tree-ssa-ccp.cc:1289
#14 evaluate_stmt (stmt=0x7ffff7b853f0) at
/repo/gcc-trunk/gcc/tree-ssa-ccp.cc:2208
#15 0x000000000152479e in visit_assignment (stmt=0x7ffff7b853f0,
output_p=0x7fffffffd308) at /repo/gcc-trunk/gcc/tree-ssa-ccp.cc:2841
#16 0x00000000015c4f64 in ssa_propagation_engine::simulate_stmt
(this=0x7fffffffd3e0, stmt=0x7ffff7b853f0) at
/repo/gcc-trunk/gcc/tree-ssa-propagate.cc:230
#17 0x00000000015c523b in ssa_propagation_engine::simulate_block
(this=0x7fffffffd3e0, block=0x7ffff7a27270) at
/repo/gcc-trunk/gcc/tree-ssa-propagate.cc:337
#18 0x00000000015c5654 in ssa_propagation_engine::ssa_propagate
(this=this@entry=0x7fffffffd3e0) at
/repo/gcc-trunk/gcc/tree-ssa-propagate.cc:504
#19 0x0000000001516ae1 in do_ssa_ccp (nonzero_p=true) at
/repo/gcc-trunk/gcc/tree-ssa-ccp.cc:2960
#20 (anonymous namespace)::pass_ccp::execute (this=<optimized out>) at
/repo/gcc-trunk/gcc/tree-ssa-ccp.cc:3004
#21 0x00000000012f994a in execute_one_pass (pass=0x35d7df0) at
/repo/gcc-trunk/gcc/passes.cc:2638
#22 0x00000000012fa210 in execute_pass_list_1 (pass=0x35d7df0) at
/repo/gcc-trunk/gcc/passes.cc:2738
#23 0x00000000012fa222 in execute_pass_list_1 (pass=0x35d7cc0) at
/repo/gcc-trunk/gcc/passes.cc:2739
#24 0x00000000012fa249 in execute_pass_list (fn=0x7ffff7b7f0b8, pass=<optimized
out>) at /repo/gcc-trunk/gcc/passes.cc:2749
#25 0x0000000000f1efa6 in cgraph_node::expand (this=0x7ffff7b80110) at
/repo/gcc-trunk/gcc/context.h:48
#26 cgraph_node::expand (this=0x7ffff7b80110) at
/repo/gcc-trunk/gcc/cgraphunit.cc:1788
#27 0x0000000000f20540 in expand_all_functions () at
/repo/gcc-trunk/gcc/cgraphunit.cc:1999
#28 symbol_table::compile (this=0x7ffff7a1f000) at
/repo/gcc-trunk/gcc/cgraphunit.cc:2349
#29 0x0000000000f23178 in symbol_table::compile (this=0x7ffff7a1f000) at
/repo/gcc-trunk/gcc/cgraphunit.cc:2262
#30 symbol_table::finalize_compilation_unit (this=0x7ffff7a1f000) at
/repo/gcc-trunk/gcc/cgraphunit.cc:2530
#31 0x0000000001405890 in compile_file () at /repo/gcc-trunk/gcc/toplev.cc:479
#32 0x0000000000d5b7ae in do_compile (no_backend=false) at
/repo/gcc-trunk/gcc/toplev.cc:2168
#33 toplev::main (this=this@entry=0x7fffffffd65e, argc=<optimized out>,
argc@entry=18, argv=<optimized out>, argv@entry=0x7fffffffd7a8) at
/repo/gcc-trunk/gcc/toplev.cc:2320
#34 0x0000000000d5d6ef in main (argc=18, argv=0x7fffffffd7a8) at
/repo/gcc-trunk/gcc/main.cc:39
(gdb) fini
Run till exit from #0 0x00007ffff7d91d00 in __memset_avx2_unaligned_erms ()
from /lib64/libc.so.6
mpfr_add1 (a=a@entry=0x7fffffffc780, b=0x7fffffffc7c0, c=<optimized out>,
rnd_mode=MPFR_RNDA) at /repo/gcc-trunk/mpfr/src/add1.c:152
152 difn = cn;
(gdb) fini
Run till exit from #0 mpfr_add1 (a=a@entry=0x7fffffffc780, b=0x7fffffffc7c0,
c=<optimized out>, rnd_mode=MPFR_RNDA) at /repo/gcc-trunk/mpfr/src/add1.c:152
0x0000000002764e5c in mpc_sqr (rop=rop@entry=0x7fffffffc880,
op=op@entry=0x7fffffffc990, rnd=rnd@entry=0) at
/repo/gcc-trunk/mpc/src/sqr.c:270
270 | mpfr_sub (v, x, mpc_imagref (op), MPFR_RNDA);
Value returned is $1 = 0
(gdb)
Run till exit from #0 0x0000000002764e5c in mpc_sqr
(rop=rop@entry=0x7fffffffc880, op=op@entry=0x7fffffffc990, rnd=rnd@entry=0) at
/repo/gcc-trunk/mpc/src/sqr.c:270
Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(consumed memory is ~80GiB)
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-7-20220428134959-g00c4405cd7f-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-7-20220428134959-g00c4405cd7f-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220428 (experimental) (GCC)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/105428] compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128
2022-04-28 19:37 [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128 zsojka at seznam dot cz
@ 2022-04-28 21:53 ` joseph at codesourcery dot com
2022-04-29 4:21 ` zsojka at seznam dot cz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2022-04-28 21:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105428
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
What MPC version are you using? There have been a few fixes for slowness
in the MPC inverse trigonometric and hyperbolic functions over the years,
though there may still be scope for substantial further improvements by
choosing different algorithms for different ranges of inputs. If you're
using current MPC then this case should probably be reported to the MPC
maintainers.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/105428] compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128
2022-04-28 19:37 [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128 zsojka at seznam dot cz
2022-04-28 21:53 ` [Bug target/105428] " joseph at codesourcery dot com
@ 2022-04-29 4:21 ` zsojka at seznam dot cz
2022-04-29 13:57 ` marxin at gcc dot gnu.org
2022-04-29 19:20 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2022-04-29 4:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105428
--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to joseph@codesourcery.com from comment #1)
> What MPC version are you using?
Thank you for the reply. If I understand the backtrace correctly I am using the
libraries downloaded by the contrib/download_prerequisites script: mpc-1.2.1,
mpfr-4.1.0; the same behavior can be observed with system libraries as well,
which are the same version + gentoo patches.
> There have been a few fixes for slowness
> in the MPC inverse trigonometric and hyperbolic functions over the years,
> though there may still be scope for substantial further improvements by
> choosing different algorithms for different ranges of inputs. If you're
> using current MPC then this case should probably be reported to the MPC
> maintainers.
Similar to PR105384 and PR105385 - if you tell me to open a PR against MPC /
MPRF, I will try to do. But I can't tell if this is a bug in the library, or
expected behavior and gcc shouldn't use the library to evaluate the value at
compilation time.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/105428] compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128
2022-04-28 19:37 [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128 zsojka at seznam dot cz
2022-04-28 21:53 ` [Bug target/105428] " joseph at codesourcery dot com
2022-04-29 4:21 ` zsojka at seznam dot cz
@ 2022-04-29 13:57 ` marxin at gcc dot gnu.org
2022-04-29 19:20 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-29 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105428
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2022-04-29
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed with:
Repository : Main Repository (OSS)
Name : gmp-devel
Version : 6.2.1-4.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/105428] compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128
2022-04-28 19:37 [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128 zsojka at seznam dot cz
` (2 preceding siblings ...)
2022-04-29 13:57 ` marxin at gcc dot gnu.org
@ 2022-04-29 19:20 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2022-04-29 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105428
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
If you can identify specific arguments passed to mpc_asin for which it is
excessively slow, that should be reported as an MPC bug.
Computing correctly rounded mpc_asin shouldn't need to be that slow -
provided the algorithm used is appropriate to the input value. See for
example how glibc implements casin / casinh / cacos / cacosh. Or
https://dl.acm.org/doi/10.1145/275323.275324 (Hull et al, Implementing the
complex arcsine and arccosine functions using exception handling, ACM TOMS
vol. 23 no. 3 (Sep 1997) pp 299-335). That may require several different
algorithms to be implemented, but each such algorithm is straightforward.
That's different from the case of Bessel functions of high order - for
which there is some literature about computational techniques that
shouldn't take time proportional to the order, but where the algorithms
are certainly a lot more complicated.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-29 19:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 19:37 [Bug target/105428] New: compilation never (?) finishes with __builtin_casinl() and __builtin_csqrtl() with -O -mlong-double-128 zsojka at seznam dot cz
2022-04-28 21:53 ` [Bug target/105428] " joseph at codesourcery dot com
2022-04-29 4:21 ` zsojka at seznam dot cz
2022-04-29 13:57 ` marxin at gcc dot gnu.org
2022-04-29 19:20 ` joseph at codesourcery dot com
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).