google / google/xls

Make RunValues distinct from RunPacked and Run to enable zero argument functions

Open
#416 3 comments 0 reactions 0 assignees View on GitHub
jit
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Trying to create a JIT wrapper for the function
```
fn a() -> u32 {
u32: 1
}
```

will result in a header like
```
class A {
public:
static absl::StatusOr> Create();
IrJit* jit() { return jit_.get(); }

absl::StatusOr Run();
absl::Status Run(PackedBitsView<32> result);
absl::StatusOr Run();
...
```

This will fail to compile, since the 1st and 3rd overloads don't have args to differentiate them (no original args = no Run() args). In practice, JIT-compiling a zero-arg function is a bit silly - it's just a fancy way of accessing a constant.

I think a reasonable thing to do, given that, is just to declare zero-arg functions as unjittable and to report a useful log message and abort should one be specified.

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.