Skip to content
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

Feature to use unbounded weights #1081

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mihaibudiu
Copy link

This is a feature for the generated rust code.
When enabling this feature the code will always produce correct results.
Unlike the checked_weights feature, this feature will get slower when weights are larger instead of panicking.
Panics are still possible if the weights are read and expected to fit into 64 bits and they don't. This is currently done by ThreadUpdateHandler.
I will post additional information about the slowdown this is causing on benchmarks.
However, I believe this (or a similar feature) should be merged. Correctness is more important than performance.

@vmwclabot
Copy link
Member

@mbudiu-vmw, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@mihaibudiu
Copy link
Author

Fixes #878

@mihaibudiu
Copy link
Author

Overheads seem to be on the order of 40%-50%, more than I expected.
I would expect this to be lower if weights are always small.

@vmwclabot
Copy link
Member

@mbudiu-vmw, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

rust/ddlog_benches/Cargo.toml Outdated Show resolved Hide resolved
rust/template/differential_datalog/Cargo.toml Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
rust/template/differential_datalog/src/program/mod.rs Outdated Show resolved Hide resolved
@Kixiron
Copy link
Contributor

Kixiron commented Sep 15, 2021

Overheads seem to be on the order of 40%-50%, more than I expected.
I would expect this to be lower if weights are always small.

The value of the weight doesn't have a lot to do with it here, if it does indeed spike into heap integers that will be a significant performance penalty, but there's also a massive baseline penalty because the unbounded weight type is at minimum 24 bytes of stack space (probably 25 though, meaning that with alignment it's realistically more like 32 bytes), meaning that every arrangement, stream, collection and vector is now significantly larger than it was, plus the possibility of having a heap integer completely disables any chance the compiler has of auto-vectorizing code, meaning that we can't take advantage of any instruction-level parallelism with anything that previously was

@mihaibudiu
Copy link
Author

If this is the best we can do in Rust maybe we should just implement this in C++ and wrap it in Rust.

@Kixiron
Copy link
Contributor

Kixiron commented Sep 15, 2021

There won't be any difference in C++

@vmwclabot
Copy link
Member

@mbudiu-vmw, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

Comment on lines +33 to +48

### Supported features

The benchmarks can be run using checked_weights, which will cause a
Rust panic on weight overflow. This can be done by running:

```sh
cargo make benchmarks --features checked_weights
```

The benchmarks can be run using unbounded_weights, which will always
produce correct results, but may run slower. This can be done by running:

```sh
cargo make benchmarks --features unbounded_weights
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this chunk above the links

@Kixiron
Copy link
Contributor

Kixiron commented Sep 16, 2021

Please mark comments as resolved once you've addressed them

@mihaibudiu
Copy link
Author

Often github resolves the comments by itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants