Skip to content

Reland (#120419):[Exegesis][RISCV] Add RISCV support for llvm-exegesis #120467

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

Merged
merged 37 commits into from
Dec 18, 2024

Conversation

dybv-sc
Copy link
Contributor

@dybv-sc dybv-sc commented Dec 18, 2024

2nd reland attempt. This should be merged again and applying #120451 should fix buildbot issue.

Original commit message:

[Exegesis][RISCV] Add RISCV support for llvm-exegesis (https://github.com/llvm/llvm-project/pull/89047)
This patch also makes following amendments to core exegesis:
* Added distinction between regular registers aliasing check and
registers used as memory address in instruction.
* Added scratch memory space pointer register.
* General exegesis options were amended:
        * mattr - new option to pass a list of enabled target features

Llvm-exegesis RISCV port is a result of team effort. Below everyone
involved listed.
Co-authored-by: Konstantin Vladimirov
<konstantin.vladimirov@syntacore.com>
Co-authored-by: Dmitrii Petrov <dmitrii.petrov@syntacore.com>
Co-authored-by: Dmitry Bushev <dmitry.bushev@syntacore.com>
Co-authored-by: Mark Goncharov <mark.goncharov@syntacore.com>
Co-authored-by: Anastasiya Chernikova
<anastasiya.chernikova@syntacore.com>

---------

Co-authored-by: Dmitry Bushev <dmitry.bushev@syntacore.com>

AnastasiyaChernikova and others added 30 commits November 26, 2024 17:29
This patch also makes following amendments to core exegesis:
* Added distinction between regular registers aliasing check and registers used as memory address in instruction.
* Added scratch memory space pointer register.
* Added ability for targets to define register name to register number mapping (findRegisterByName).
* General exegesis options were amended:
	* mattr - new option to pass a list of enabled target features
	* opcode-name - this option is amended to accept range of opcodes at once

Llvm-exegesis RISCV port is a result of team effort. Below everyone involved listed.
Co-authored-by: Konstantin Vladimirov <konstantin.vladimirov@syntacore.com>
Co-authored-by: Dmitrii Petrov <dmitrii.petrov@syntacore.com>
Co-authored-by: Dmitry Bushev <dmitry.bushev@syntacore.com>
Co-authored-by: Mark Goncharov <mark.goncharov@syntacore.com>
Co-authored-by: Anastasiya Chernikova <anastasiya.chernikova@syntacore.com>
@dybv-sc
Copy link
Contributor Author

dybv-sc commented Dec 18, 2024

@kazutakahirata
Copy link
Contributor

@dybv-sc Thanks for the update! When I try out your patch, I am getting:

CMake Error at cmake/modules/LLVMProcessSources.cmake:113 (message):
  Found erroneous configuration for source file RISCVCounters.cpp

  LLVM's build system enforces that all source files are added to a build
  target, that exactly one build target exists in each directory, and that
  this target lists all files in that directory.  If you want multiple
  targets in the same directory, add PARTIAL_SOURCES_INTENDED to the target
  specification, though it is discouraged.

I'm guessing that llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt should somehow mention RISCVCounters.cpp. Thoughts?

@dybv-sc
Copy link
Contributor Author

dybv-sc commented Dec 18, 2024

@dybv-sc Thanks for the update! When I try out your patch, I am getting:

CMake Error at cmake/modules/LLVMProcessSources.cmake:113 (message):
  Found erroneous configuration for source file RISCVCounters.cpp

  LLVM's build system enforces that all source files are added to a build
  target, that exactly one build target exists in each directory, and that
  this target lists all files in that directory.  If you want multiple
  targets in the same directory, add PARTIAL_SOURCES_INTENDED to the target
  specification, though it is discouraged.

I'm guessing that llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt should somehow mention RISCVCounters.cpp. Thoughts?

Hi,

Have you applied all of the patches there are in this request? We used to have this file, but after some discussion, we removed it (with the intention to rework and bring it back in some later request). Currently there should be no this file on top of our branch.

RISCV_MC::isOpcodeAvailable) {}

#define GET_REGISTER_MATCHER
#include "RISCVGenAsmMatcher.inc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed before relanding. It doesn't make sense to land with a forward fix already planned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, amended Kazu's fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please update the commit message before merging.

authored-by: Kazu Hirata <kazu@google.com>
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kazutakahirata
Copy link
Contributor

@dybv-sc Thanks for the update! When I try out your patch, I am getting:

CMake Error at cmake/modules/LLVMProcessSources.cmake:113 (message):
  Found erroneous configuration for source file RISCVCounters.cpp

  LLVM's build system enforces that all source files are added to a build
  target, that exactly one build target exists in each directory, and that
  this target lists all files in that directory.  If you want multiple
  targets in the same directory, add PARTIAL_SOURCES_INTENDED to the target
  specification, though it is discouraged.

I'm guessing that llvm/tools/llvm-exegesis/lib/RISCV/CMakeLists.txt should somehow mention RISCVCounters.cpp. Thoughts?

Hi,

Have you applied all of the patches there are in this request? We used to have this file, but after some discussion, we removed it (with the intention to rework and bring it back in some later request). Currently there should be no this file on top of our branch.

Huh. When I applied https://github.com/llvm/llvm-project/pull/120467.patch locally, that didn't work. When I applied https://github.com/llvm/llvm-project/pull/120467.diff, however, that did work. I didn't know there was a difference between patch and diff.

Anyway, thank you for updating the patch!

Copy link
Contributor

@kazutakahirata kazutakahirata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@dybv-sc dybv-sc merged commit 8e8692a into llvm:main Dec 18, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 18, 2024

LLVM Buildbot has detected a new failure on builder lldb-arm-ubuntu running on linaro-lldb-arm-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/8788

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/instruction-breakpoint/TestDAP_instruction_breakpoint.py (1142 of 2856)
PASS: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (1143 of 2856)
PASS: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py (1144 of 2856)
PASS: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py (1145 of 2856)
PASS: lldb-api :: tools/lldb-dap/output/TestDAP_output.py (1146 of 2856)
PASS: lldb-api :: tools/lldb-dap/module/TestDAP_module.py (1147 of 2856)
PASS: lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.py (1148 of 2856)
PASS: lldb-api :: tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py (1149 of 2856)
UNSUPPORTED: lldb-api :: tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py (1150 of 2856)
UNSUPPORTED: lldb-api :: tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py (1151 of 2856)
FAIL: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py (1152 of 2856)
******************** TEST 'lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/launch -p TestDAP_launch.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 8e8692a542037056b332f4a3b5f12441267b76eb)
  clang revision 8e8692a542037056b332f4a3b5f12441267b76eb
  llvm revision 8e8692a542037056b332f4a3b5f12441267b76eb
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']
========= DEBUG ADAPTER PROTOCOL LOGS =========
1734563122.495487213 --> 
Content-Length: 344

{
  "arguments": {
    "adapterID": "lldb-native",
    "clientID": "vscode",
    "columnsStartAt1": true,
    "linesStartAt1": true,
    "locale": "en-us",
    "pathFormat": "path",
    "sourceInitFile": false,
    "supportsRunInTerminalRequest": true,
    "supportsStartDebuggingRequest": true,
    "supportsVariablePaging": true,
    "supportsVariableType": true
  },
  "command": "initialize",
  "seq": 1,
  "type": "request"
}
1734563122.497909546 <-- 
Content-Length: 1589


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 20, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/1878

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-20892-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


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

Successfully merging this pull request may close these issues.

6 participants