[llvm] [llvm-exegesis] [AArch64] Resolving "snippet crashed while running: Segmentation fault" for Load Instructions (PR #142552)
Lakshay Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 03:32:59 PDT 2025
lakshayk-nv wrote:
> Why exactly did you need to support `--mode=subprocess` for this?
>>
It is prerequisite only if loading registers with address to auxiliary mmap (Updated initial comment accordingly).
> but the scratch memory register/block is a lot simpler.
>>
We want to get some feedback on scratchMemoryRegister route.
Firstly, This require to change definition of `isMemory()` (currently true if `OPERAND_MEMORY`) to `OPERAND_MEMORY || mayLoad || mayStore`. Wherein, mayLoad is check of MCID::MayLoad flag of instruction.
This change seems reasonable but unsure of spillover of this for other architectures.
```
// The call stack for `fillMemoryOperands()` is the following :-
main()
generateSnippets()
SnippetGenerator:generateConfigurations()
SerialSnippetGenerator:appendCodeTemplates()
switch (ExecutionModeBit)
case SERIAL_VIA_MEMORY_INSTR // i.e. Instr.hasMemoryOperands i.e isMemory i.e. OPERAND_MEMORY (previously)
if mayLoad
if (!RegClass.contains(ScratchMemoryRegister)) return;
fillMemoryOperands()
```
> TODO: Implement getScratchMemoryRegister() correctly
>
>return MCRegister() result in register to not be valid and exit with "Infeasible : target does not support memory instructions"
>return X14, any hardcode register. Results in illegal instruction is generated: undefined physical register (if specifically that scratch register is not used generated instruction).
So, To enable load instructions in `--mode=inprocess`
- [ ] Update `isMemory` implementation
- [ ] Implement `getScratchMemoryRegister()`
- [ ] Implement `fillMemoryOperands()`
Q0. Is updating `isMemory` to `OPERAND_MEMORY || mayLoad || mayStore` correct and without unintended consequences ?
Q1.1. [sanity check] Scratch memory register be an arbitrary register (i.e. X14) is correct ?
Q1.2. [optional] any pointers on undefined physical register, why does this get thrown usually and potential wayout ?
Q2. `fillMemoryOperands()` Implementation
Q2.1. How `fillMemoryOperands()` differentiate memory address registers from register containing offset value ?
Q2.2. How `fillMemoryOperands()` get valid correct memory address to init/fill register ?
https://github.com/llvm/llvm-project/pull/142552
More information about the llvm-commits
mailing list