non-packed views do not always correctly match JIT ABI
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
The BitsView, ArrayView and TupleView (plus their mutable counterparts) are meant to exactly reflect the JIT data-structures used to hold XLS values during computation, allowing tests to avoid the overhead of converting between interpreter and JIT representations. Unfortunately since the JIT data-structures are generated by LLVM their ABI is designed for best performance. This means the layout rules are basically the same as standard C++ layout rules and the view structures do not (and really cannot) correctly match them in all circumstances.
We probably want to remove these entierly and replace them with some sort of generated view struct that matches the JIT ABI. This could be emmitted by the jit-wrapper and as long as the wrapper is regenerated with a jit LLVM update this should work fine.
The JIT expects bit-values of size 129 <= kBitSize <= 256 to be 64 bytes long. BitsView always expects it to be packed tightly. This can cause asan failures or OOB writes when converting this type of value to a jit buffer.
Contributor guide
Assessment
This issue has not been assessed yet.