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

[MCA] Duplicate symbols reported for simple programs (like "hello world") after 98e342dca237 #62528

Closed
ormris opened this issue May 3, 2023 · 12 comments · Fixed by llvm/llvm-project-release-prs#440

Comments

@ormris
Copy link
Collaborator

ormris commented May 3, 2023

Duplicate symbols are now being reported for simple programs like "hello world" after commit 98e342d.

To reproduce:

$ cat hello.cpp
#include <iostream>
using namespace std;
int main()
{
     cout << "hello world" << endl;
     return 0;
}
$ clang -S hello.cpp
$ llvm-mca hello.s
hello.s:6:1: error: symbol '__cxx_global_var_init' is already defined
__cxx_global_var_init:                  # @__cxx_global_var_init
^
hello.s:23:1: error: symbol '.Lfunc_end0' is already defined
.Lfunc_end0:
^
hello.s:31:1: error: symbol 'main' is already defined
main:                                   # @main
^
hello.s:52:1: error: symbol '.Lfunc_end1' is already defined
.Lfunc_end1:
^
hello.s:59:1: error: symbol '_GLOBAL__sub_I_hello.cpp' is already defined
_GLOBAL__sub_I_hello.cpp:               # @_GLOBAL__sub_I_hello.cpp
^
hello.s:71:1: error: symbol '.Lfunc_end2' is already defined
.Lfunc_end2:
^
hello.s:81:1: error: symbol '.L.str' is already defined
.L.str:
^
...
$

@michaelmaitland, could you take a look at this?

commit 98e342dca23729dd4e9cdc5f25c647d617b94283 (HEAD)
Author: Michael Maitland <michaeltmaitland@gmail.com>
Date:   Fri Nov 4 08:51:39 2022 -0700

    [RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV

    On x86 and AArch, SIMD instructions encode all of the scheduling information in the instruction
    itself. For example, VADD.I16 q0, q1, q2 is a neon instruction that operates on 16-bit integer
    elements stored in 128-bit Q registers, which leads to eight 16-bit lanes in parallel. This kind
    of information impacts how the instruction takes to execute and what dependencies this may cause.

    On RISCV however, the data that impacts scheduling is encoded in CSR registers such as vtype or
    vl, in addition with the instruction itself. But MCA does not track or use the data in these
    registers. This patch fixes this problem by introducing Instruments into MCA.

    * Replace `CodeRegions` with `AnalysisRegions`
    * Add `Instrument` and `InstrumentManager`
    * Add `InstrumentRegions`
    * Add RISCV Instrument and `InstrumentManager`
    * Parse `Instruments` in driver
    * Use instruments to override schedule class
    * RISCV use lmul instrument to override schedule class
    * Fix unit tests to pass empty instruments
    * Add -ignore-im clopt to disable this change

    A prior version of this patch was commited in 5e82ee537321. 2323a4ee610f reverted
    that change because the unit test files caused build errors. The change with fixes
    were committed in b88b8307bf9e but reverted once again e8e92c8313a0 due to more
    build errors.

    This commit adds the prior changes and fixes the build error.

    Differential Revision: https://reviews.llvm.org/D137440
@llvmbot
Copy link
Collaborator

llvmbot commented May 3, 2023

@llvm/issue-subscribers-tools-llvm-mca

@michaelmaitland
Copy link
Contributor

I will take a look.

@llvmbot
Copy link
Collaborator

llvmbot commented May 3, 2023

@llvm/issue-subscribers-backend-risc-v

@michaelmaitland
Copy link
Contributor

michaelmaitland commented May 3, 2023

@RKSimon I think this problem is riscv independent as I can reproduce on x86.

@michaelmaitland
Copy link
Contributor

@michaelmaitland
Copy link
Contributor

michaelmaitland commented May 4, 2023

Closed by commit rG1c2b8129e994 (1c2b812): [llvm-mca] Fix duplicate symbols error (authored by michaelmaitland).

@ormris
Copy link
Collaborator Author

ormris commented May 4, 2023

Thanks!

@ormris ormris added this to the LLVM 16.0.X Release milestone May 4, 2023
@ormris ormris reopened this May 4, 2023
@ormris
Copy link
Collaborator Author

ormris commented May 4, 2023

/cherry-pick 1c2b812

@llvmbot
Copy link
Collaborator

llvmbot commented May 4, 2023

/branch llvm/llvm-project-release-prs/issue62528

@llvmbot
Copy link
Collaborator

llvmbot commented May 4, 2023

/pull-request llvm/llvm-project-release-prs#440

@ormris
Copy link
Collaborator Author

ormris commented May 5, 2023

CC @asb

@ormris
Copy link
Collaborator Author

ormris commented May 18, 2023

@tstellar Does this belong in the PR migration project? It seems like the other tickets there are focused on project-wide tasks, rather than cherry-picks.

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

Successfully merging a pull request may close this issue.

5 participants