Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addmul_2/3/4/5 call in mulmid_basecase.c is invalid #259

Open
dlaugt opened this issue Sep 5, 2018 · 10 comments
Open

addmul_2/3/4/5 call in mulmid_basecase.c is invalid #259

dlaugt opened this issue Sep 5, 2018 · 10 comments
Labels

Comments

@dlaugt
Copy link

dlaugt commented Sep 5, 2018

I've upgraded mpir from 2.1.1 to 3.0.0 on our compilation servers (Linux and Solaris). All tests passed on Linux. However, on Solaris, some tests are failing:

PASS: t-constants
PASS: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
PASS: t-modlinv
PASS: t-parity
PASS: t-popc
PASS: t-sub

============================================================================
Testsuite summary for MPIR 3.0.0
============================================================================
# TOTAL: 9
# PASS:  9
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

PASS: t-addadd_n
PASS: t-addsub_n
PASS: t-aors_1
PASS: t-asmtype
../../../test-driver[107]: 5502 Abort(coredump)
FAIL: t-dc_bdiv_q
../../../test-driver[107]: 5515 Abort(coredump)
FAIL: t-dc_bdiv_q_n
PASS: t-dc_bdiv_qr
PASS: t-dc_bdiv_qr_n
../../../test-driver[107]: 5555 Abort(coredump)
FAIL: t-dc_div_q
PASS: t-dc_div_qr
PASS: t-dc_div_qr_n
../../../test-driver[107]: 5594 Abort(coredump)
FAIL: t-dc_divappr_q
PASS: t-divebyff
PASS: t-divebyfobm1
PASS: t-divrem_1
PASS: t-fat
../../../test-driver[107]: 5659 Abort(coredump)
FAIL: t-gcdext
PASS: t-get_d
PASS: t-hgcd
PASS: t-instrument
PASS: t-inv_div_q
PASS: t-inv_div_qr
PASS: t-inv_div_qr_n
PASS: t-inv_divappr_q
PASS: t-inv_divappr_q_n
PASS: t-invert
PASS: t-iord_u
PASS: t-lorrshift1
PASS: t-matrix22
PASS: t-mp_bases
PASS: t-mullow_basecase
PASS: t-mullowhigh
../../../test-driver[107]: 5867 Abort(coredump)
FAIL: t-mulmid
PASS: t-mulmod_2expm1
PASS: t-mulmod_2expp1
PASS: t-neg
PASS: t-perfsqr
PASS: t-redc_1
PASS: t-sb_bdiv_q
PASS: t-sb_bdiv_qr
PASS: t-sb_div_q
PASS: t-sb_div_qr
PASS: t-sb_divappr_q
PASS: t-scan
PASS: t-sizeinbase
PASS: t-subadd_n
PASS: t-tdiv_q
PASS: t-tdiv_qr

============================================================================
Testsuite summary for MPIR 3.0.0
============================================================================
# TOTAL: 48
# PASS:  42
# SKIP:  0
# XFAIL: 0
# FAIL:  6
# XPASS: 0
# ERROR: 0

I don't know how to dig into those errors. Any suggestions?
test-suite.log

@wbhart
Copy link
Owner

wbhart commented Sep 5, 2018 via email

@dlaugt
Copy link
Author

dlaugt commented Sep 5, 2018

I've just compiled mpir 2.7.2 on the same Solaris machine and on the same compiler (gcc 4.8.1). All tests have passed with this version. This seems to be caused by a change on the code of mpir 3.0.0...

@dlaugt
Copy link
Author

dlaugt commented Sep 5, 2018

One more indication. On Linux with the same compiler (gcc 4.8.1), all tests have passed.

@dlaugt
Copy link
Author

dlaugt commented Sep 5, 2018

CPU is a SPARC-T4:

$ psrinfo -pv
The physical processor has 64 virtual processors (0-63)
  SPARC-T4 (chipid 0, clock 2848 MHz)
The physical processor has 64 virtual processors (64-127)
  SPARC-T4 (chipid 1, clock 2848 MHz)

@wbhart
Copy link
Owner

wbhart commented Sep 5, 2018 via email

@dlaugt
Copy link
Author

dlaugt commented Sep 7, 2018

The regression is coming from the following change: #193

All tests are passing on Solaris when I replace mpn/generic/mulmid_basecase.c with the one in 2.7.2. I suspect a bug on this code when mpn_addmul_2, mpn_addmul_3, mpn_addmul_4, mpn_addmul_5 or mpn_addmul_6 are native.

Anyway, from my side, I will take mulmid_basecase.c of 2.7.2 which is in synch with the master branch of GMP.

@wbhart
Copy link
Owner

wbhart commented Sep 7, 2018

The issue is probably in this commit then:

b78c923

But the code is directly from GMP. If the bug exists in MPIR it probably exists there too. Or, as I say, it's just a miscompilation.

I'm not sure there is any special mpn_addmul2/3/4/5 assembly code. So, short of a bug in the code in that commit, I can't really think of anything else. I suppose it is possible that the mpn_addmul2 generic code in MPIR makes different assumptions to the code in MPIR. But that's a stretch. Lots of other things would be expected to break, if so.

@wbhart
Copy link
Owner

wbhart commented Sep 7, 2018

By the way, what is the result of ./config.guess on your machine, so we can rule out an issue with assembly code.

@dlaugt
Copy link
Author

dlaugt commented Sep 10, 2018

Which gmp repo are you referring to? In this repo, I don't see the optimization with mpn_addmul2/3/4/5/6 in mpn/generic/mulmid_basecase.c. The result of ./config.guess is ultrasparc-sun-solaris2.10.

@wbhart
Copy link
Owner

wbhart commented Sep 10, 2018 via email

@wbhart wbhart changed the title Test suite failure on Solaris addmul_2/3/4/5 call in mulmid_basecase.c is invalid Sep 28, 2018
@wbhart wbhart added the bug label Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants