-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[llvm-exegesis] [AArch64] Resolving "snippet crashed while running: Segmentation fault" for Load Instructions #142552
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
base: main
Are you sure you want to change the base?
Conversation
Switched X16 as temporary register in loadFPCRImmediate instead of X8 which is used by syscalls
…re syscall registers and syscall generator
…ions used by subprocess execution mode.
…ters requiring memory address.
@llvm/pr-subscribers-tools-llvm-exegesis Author: Lakshay Kumar (lakshayk-nv) ChangesWe want to support load and store instructions for aarch64 but currently they throw segmentation fault as register are initialized by 0 but load instruction requires register to be loaded with valid memory address. A. Prerequisite for this is to support
|
Why exactly did you need to support |
✅ With the latest revision this PR passed the C/C++ code formatter. |
…project into llvm-exegesis-segfault
We want to support load and store instructions for aarch64 but currently they throw segmentation fault as register are initialized by 0 but load instruction requires register to be loaded with valid memory address.
This is a WIP patch and not expecting to merging it in current state but to get feedback.
Load registers requiring memory address
There are possibly two ways to support load instructions (setting registers with valid memory address):-
1. With address to auxiliary mmap:
Prerequisite for this is to support
--mode=subprocess
for AArch64.Adding support for
--mode=subprocess
and Memory Annotation of manual snippet.configurePerfCounter()
.Generating syscall for aux mmap, save its return value in stack and load required registers with memory address.
Implemented the same, currently.
TODO: how to differentiate between register requiring address and otherwise ?
For example: LD1B opcode (
ld1b {z6.b}, p4/z, [x14, x2]
) expects first register to contain address and second having offset value.Temporary fix: Init first register queried by instruction to loaded by address and rest by setRegTo as done previously.
2. Utilize
fillMemoryOperands
Found
fillMemoryOperands()
used by x86 implementation, seems relevant to init registers required by load instructions.Implementation for
fillMemoryOperands()
,getScratchMemoryRegister()
is missing for AArch64.Firstly, Codeflow check for
IsMemory
(i.e.OPERAND_MEMORY
) which is not relevant for AArch64.Thus, Experimentally added
IsMemory
to ORmayLoadOrStore
too (MCInstrDescView.cpp
)TODO: Implement
getScratchMemoryRegister()
correctlyreturn MCRegister()
result in register to not be valid and exit with"Infeasible : target does not support memory instructions"
TODO: Implement
fillMemoryOperands
Please review: @sjoerdmeijer, @boomanaiden154, @davemgreen
Looking forward for feedback.
Thanks,