Skip to content

BUG: utest dnrm2_tiny failed #3679

Closed
Closed

Description

@XiWeiGu

Utest dnrm2_tiny failed on Loongson-3A5000

TEST 30/35 rot:srot_inc_0 [OK]
TEST 31/35 rot:csrot_inc_0 [OK]
TEST 32/35 dnrm2:dnrm2_inf [OK]
TEST 33/35 dnrm2:dnrm2_tiny [FAIL]
ERR: test_dnrm2.c:65 expected 0.000e+00, got inf (diff -inf, tol 1.000e-13)
TEST 34/35 fork:safety [OK]
TEST 35/35 fork:safety_after_fork_in_parent [OK]
RESULTS: 35 tests (34 ok, 1 failed, 0 skipped) ran in 223 ms

Utest dnrm2_tiny failed on Loongson-3A4000

TEST 30/35 rot:zdrot_inc_0 [OK]
TEST 31/35 rot:drot_inc_0 [OK]
TEST 32/35 dnrm2:dnrm2_tiny [FAIL]
ERR: test_dnrm2.c:65 expected 0.000e+00, got inf (diff -inf, tol 1.000e-13)
TEST 33/35 dnrm2:dnrm2_inf [OK]
TEST 34/35 fork:safety [OK]
TEST 35/35 fork:safety_after_fork_in_parent [OK]
RESULTS: 35 tests (34 ok, 1 failed, 0 skipped) ran in 583 ms

Loongson-3A4000 DNRM2 kernel: kernel/mips64/dnrm2.S,the following code causes the test to fail:

    div.d   ALPHA, ALPHA, s1
    MOV max, s1

s1 is the maximum value of the input vector, the initial value of ALPHA is 1.
In the test case of dnrm2_tiny, s1=7.457008414e-310, ALPHA=1/s1 is inf, test fail.
Loongson-3A5000 which using DNRM2 kernel: kernel/loongarch64/dnrm2.S has the similar problem.

Similar code has found in the power DNRM2 kernel, perhaps other platforms will have similar problem.

Activity

  1. martin-frbg commented on Jul 6, 2022

    @martin-frbg
    Collaborator

    Interesting, thanks. So MIPS64 dnrm2.S has (effectively) the same problem as ARM64 thunderx2 kernel (used for several recent cpus) in #3654 POWER appears to be unaffected (EDIT: but all recent ppc use the generic C dnrm2, older ppc440/G4 not tested), but we do not have MIPS in CI and I did not remember to try it on gccfarm.

  2. martin-frbg commented on Jul 6, 2022

    @martin-frbg
    Collaborator

    My "solution" for the thunderx2 kernel is just a very ugly hack, simply forcing that zero times infinity still has to be zero. Not sure if something like that would work in the final "MUL s1, max, s1" here, or if both s1 and max have gone to Inf at that point ?

  3. XiWeiGu commented on Jul 6, 2022

    @XiWeiGu
    ContributorAuthor

    My "solution" for the thunderx2 kernel is just a very ugly hack, simply forcing that zero times infinity still has to be zero. Not sure if something like that would work in the final "MUL s1, max, s1" here, or if both s1 and max have gone to Inf at that point ?

    Before MUL s1, max, s1, s1 is Inf, max is 7.457008414e-310.

  4. sharkcz commented on Jul 18, 2022

    @sharkcz
    Contributor

    Seems ppc64 (POWER6 kernel) also suffers from the same issue with dnrm2_tiny test failing

    ...
    TEST 30/37 rot:zdrot_inc_0 [OK]
    TEST 31/37 rot:drot_inc_0 [OK]
    TEST 32/37 dnrm2:dnrm2_tiny [FAIL]
      ERR: test_dnrm2.c:65  expected 0.000e+00, got inf (diff -inf, tol 1.000e-13)
    TEST 33/37 dnrm2:dnrm2_inf [OK]
    TEST 34/37 potrf:smoketest_trivial [OK]
    ...
    
  5. martin-frbg commented on Jul 18, 2022

    @martin-frbg
    Collaborator

    Yes, and SPARC does it too - (not) funny how these things crop up after decades.

  6. sharkcz commented on Jul 25, 2022

    @sharkcz
    Contributor

    All is green in our CI, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions