google / google/xls

DSLX to C++ type conversion should emit C++ structs compatible with JIT

Open
#991 1 comment 0 reactions 0 assignees View on GitHub
dslx enhancement jit
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Currently the DSLX->C++ type converter (ccp_transpiler) generates C++ structs which are not compatible with the JIT. This means that values need to be packed and unpacked into xls::Values before being passed to JIT'ed functions which can have a significant performance penalty.

Example. DSLX type:
```
struct Foo {
x: u7
y: u64
}
```

Currently generated C++ type by cpp_transpiler:

```
struct Foo {
uint64_t x;
uint64_t y;
```

The native type used by the JIT is:

```
struct Foo {
uint8_t x;
uint64_t y;
}
````

The JIT rounds up bit widths to the next power of 2. Currently the transpiler does not support types wider than 64 bits but I'd imagine these can be represented as std::arrays of bytes/words.

One complication here is that this would tightly couple the C++ types in user code, the LLVM types used in the JIT, and their underlying layout. Maybe this is ok as these things are likely to be stable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.