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

64-bit values for 32-bit RAM_DOMAIN? #2389

Open
ruricolist opened this issue Jan 12, 2023 · 4 comments
Open

64-bit values for 32-bit RAM_DOMAIN? #2389

ruricolist opened this issue Jan 12, 2023 · 4 comments
Labels

Comments

@ruricolist
Copy link
Contributor

Currently a Souffle program handling 64-bit values has to use a RAM_DOMAIN_SIZE=64, which means using 64 bits for everything. If the majority of values are 32 bit, and 32 bit suffices for indexing, a 64-bit domain wastes memory.

We have been discussing internally whether it would be workable to use RAM_DOMAIN_SIZE=32 but add explicit 64-bit integer types to Souffle. Is this something you would be interested in incorporating?

@quentin
Copy link
Member

quentin commented Jan 13, 2023

Would that effort support arbitrary value sizes? I'm thinking about opaque values from functors (C/C++ structs), or inlined records / tuples for instance.

@ruricolist
Copy link
Contributor Author

We were thinking more along the lines of adding new types that could be used in Datalog (like a number64 or unsigned64 type) where 64 bits are specifically required. For a 64-bit domain they would be equivalent to number/unsigned, but for a 32-bit domain they would get special handling.

@quentin
Copy link
Member

quentin commented Jan 16, 2023

I can foresee at least one difficulty with the interpreter engine that is currently not design to support more data types efficiently. The topic is discussed in the vicinity of this comment: #2311 (comment)

@b-scholz
Copy link
Member

Yes - indeed. The interpreter is the main stumble block. The idea here is to de-specialize data structures as much as possible. For tuples with arbitrary element lengths, we would need specialized/interpreted comparators. This would be too slow in practice.

An alternative design for the interpreter is to have several sub-indices representing one index. The sub-indices contain elements of equal length in the interpreter (e.g. 32 bit elements, 64 bit elements etc). But there might be other ideas to avoid specialized/interpreted comparators.

In addition, there are other hurdles, such as re-implementing a new typesystem (which would need to be refactored anyway).

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

No branches or pull requests

3 participants