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

Question about workflow using cross compilation #452

Open
3 tasks done
Scarlet1ssimo opened this issue Jan 16, 2025 · 4 comments
Open
3 tasks done

Question about workflow using cross compilation #452

Scarlet1ssimo opened this issue Jan 16, 2025 · 4 comments

Comments

@Scarlet1ssimo
Copy link

Check List

  • The binary I am trying to run has been compiled statically for either RV64 or AArch64.
  • The compiled binary is a Linux Elf file.
  • I have provided both a config file and a binary to SimEng as runtime arguments.

Binary File Information
Please run file on the binary used and paste the output below (i.e. file myBinary.elf).

~ file test.out
test.out: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=93985e2691fb50b5a4cbbcb448e553aa65b7f9d7, for GNU/Linux 3.7.0, not stripped

System Description
Please provide the following as a list:

  • The Operating System of the system you are running SimEng on: Ubuntu 24.04
  • The compiler used to compile SimEng and its version: clang 18
  • The compiler used to compile the static binary and its version: aarch64-linux-gnu-g++ 13.3.0
  • The ISA or specific processor that the binary was compiled for: armv8.4-a+sve
  • The processor of the system you are running SimEng on: intel i9 14900k
  • The main memory capacity of the system you are running SimEng on: 64G

SimEng Version
Provide the SimEng repository branch, commit hash, and version tag (if relevant) that the issue is present on.

branch: dev 84f4c7f

SimEng CMAKE Options Used

cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_LINKER=lld -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build -S . -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_INSTALL_PREFIX=./simeng-install -DSIMENG_ENABLE_TESTS=ON

Binary Compilation Instructions
Provide a bullet list of how the binary in question was compiled, including all compiler flags used.

~ cat test.cpp
int main() { return 0; }
~ aarch64-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc-cross/aarch64-linux-gnu/13/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ......
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)
~ aarch64-linux-gnu-g++ test.cpp -o test.out -static -march=armv8.4-a+sve -mbranch-protection=none

SimEng Command Line Expression
Provide the command line expression used to run SimEng e.g. ./simeng /path/to/configs/a64fx.yaml /path/to/myBinary.elf

simeng ~/SimEng/configs/a64fx_SME.yaml test.out

SimEng Metadata Output
If your simulation begins to execute the binary, please provide the metadata that SimEng prints at the start of execution.
E.g.

[SimEng] Build metadata:
[SimEng]        Version: 0.9.6
[SimEng]        Compile Time - Date: 00:45:08 - Jan 16 2025
[SimEng]        Build type: Release
[SimEng]        Compile options: $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>;-Wall;-pedantic;-Werror
[SimEng]        Test suite: ON

[SimEng] Running in Out-of-Order mode
[SimEng] Workload: test.out
[SimEng] Config file: /home/scarlet/SimEng/configs/a64fx_SME.yaml
[SimEng] ISA: AArch64
[SimEng] Auto-generated Special File directory: True
[SimEng] Special File directory used: /home/scarlet/SimEng/build/specialFiles/
[SimEng] Number of Cores: 1
[SimEng] Starting...


[SimEng:ExceptionHandler] Encountered execution not-yet-implemented exception
[SimEng:ExceptionHandler]   Generated by instruction:
[SimEng:ExceptionHandler]     0x0000000000400600: 3f 23 03 d5     paciasp 
[SimEng:ExceptionHandler]       opcode ID: 3783
[SimEng:Core] Halting due to fatal exception

Problem Description
I was trying to use SimEng to simulate aarch64 binaries produced by aarch64-linux-gnu-g++, but didn't get it to work. It keeps generating paciasp which is not supported. I'd like to know if it was my compilation skill issue or I just can't do it in this way? What's the right way to get it right?

BTW, according to this page, do I have to get the 10.3.0 version of aarch64-linux-gnu-g++?

@FinnWilkinson
Copy link
Contributor

Hi,

It looks like you are doing the right process, but as you said the paciasp instruction is not supported yet.
Using GCC/G++ 10.3 should help this, or you could try the sme-loops-support branch which should have the logic for this instruction.

However, I cannot guarentee 100% functional correctness of this branch (from my testing it works fine, and it passes our test pipelines, but as it is not in main we don't want to promise it will work for everything!)

@Scarlet1ssimo
Copy link
Author

Thank you for your kind reply. I'll follow up if I find anything good in that branch.
Just want to check the common workflow for this tool. Would you recommend to work on a aarch64 machine to make workflow easier?

@Scarlet1ssimo
Copy link
Author

Hi. The branch sme-loops-support doesn't get it right. I supposepaciasp is pointer authentication code, not in SVE/SME set.
Or do you know anything about how to stop compiler generating it?

@FinnWilkinson
Copy link
Contributor

Hi,
Regarding workflow it is definately easiest to do on a Linux machine as cross compilation with LLVM is usually very simple out of the box. But most of our dev team work on MacBooks when running SimEng and then use a Linux environment to compile codes we want to run through SimEng.

I have just double checked the sme-loops-support branch and the paciasp instruction is supported. Could you double check you have re-built SimEng (possibly from scratch by deleting the build directory) and that you're on the correct branch. Or are you now getting a different error?

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

No branches or pull requests

2 participants