Skip to content

ZGEMM3M is broken due to cgemm3m_unroll_n never assigned #4500

Closed

Description

@dmikushin

I tried ZGEMM3M on Haswell, it does not work, gives SIGFPE (division by zero). It happens because the divider is cgemm3m_unroll_n, which is never assigned with any value.

@wjc404 , could it be that the cgemm3m_unroll_n assignment was accidentally removed?

Activity

  1. martin-frbg commented on Feb 10, 2024

    @martin-frbg
    Collaborator

    Is it CGEMM3M or ZGEMM3M that you are seeing problems with (different unroll parameters, different kernels) ?
    On first glance I do not see any dropped assignments, are you building for DYNAMIC_ARCH or a single TARGET ?

  2. martin-frbg commented on Feb 10, 2024

    @martin-frbg
    Collaborator

    Also, do you build with gmake or cmake ? The level 3 driver uses shared code where the variable type is passed in by the build system and cgemm3m should depend on cgemm3m_unroll_n while zgemm3m sees zgemm3m_unroll_n only, no cross-use of parameters

  3. martin-frbg commented on Feb 10, 2024

    @martin-frbg
    Collaborator

    I cannot reproduce this, and do not see why/where this could happen (unless it is a specific compiler overoptimizing something).

  4. dmikushin commented on Feb 10, 2024

    @dmikushin
    ContributorAuthor

    Hi @martin-frbg ,

    do not see why/where this could happen

    Sorry for a misleading description. I will explain everything now!

    I'm building DYNAMIC_ARCH mode, and my native architecture is HASWELL.

    According to OpenBLAS design, all supported functions and tuneable parameters are provided via a global variable gotoblas:

    (gdb) p &gotoblas
    $8 = (gotoblas_t **) 0x7ffff7fb2a20 <gotoblas>
    

    So normally, whatever functionality is supported, its entries must be filled within the gotoblas structure. For example, for dgemm it looks like this:

    Screenshot from 2024-02-10 20-08-02

    So my point is: the entries for cgemm3m and zgemm3m in gotoblas structure are never assigned:

    Screenshot from 2024-02-10 20-10-49

    Screenshot from 2024-02-10 20-10-49

    I hope I'm making it clear now: there is no way how gemm3m could ever work, if they are entirely missing from gotoblas variable above.

    I cannot reproduce this

    1. Please try to use this PR.
    2. Run the gdb ./benchmark_gemm3m_COMPLEX_DOUBLE
    3. The test should crash with a segfault
    4. Print gotoblas: p *gotoblas
    5. You should see that the segfault is due to the function being called gotoblas->zgemm3m_itcopyb is 0x0 (as well as everything else, like on my screenshots above).
  5. martin-frbg commented on Feb 10, 2024

    @martin-frbg
    Collaborator

    thanks. still suspect something else wrong as the gemm3m test/ctest work for me (noticed they are not - perhaps no longer - hooked up by default). in a hurry now, will try to experiment later. which platform and compiler ?

  6. dmikushin commented on Feb 10, 2024

    @dmikushin
    ContributorAuthor

    which platform and compiler ?

    gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

  7. added a commit that references this issue on Feb 12, 2024
    47bc7e6
  8. dmikushin commented on Feb 12, 2024

    @dmikushin
    ContributorAuthor

    OK, I've got the explanation now. The reason why *gemm3m are missing is that USE_GEMM3M switch defined by CMake was never translated into a C macro for the files that check #if (USE_GEMM3M). Therefore, the logic depending on CMake var worked, and logic depending on the macro did not. #4502 should fix this.

  9. added a commit that references this issue on Feb 12, 2024
    d0f5dc7
  10. martin-frbg commented on Feb 15, 2024

    @martin-frbg
    Collaborator

    Sorry for any confusion I caused - I was not well and must have mistakenly used a gmake build to convince myself that the GEMM3M tests worked with CMAKE. :(
    Will wire up those GEMM3M counterparts in test and ctest in a followup PR...

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