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

AttrSet shouldn't actually be a set. #10

Open
eddyb opened this issue Nov 6, 2024 · 0 comments
Open

AttrSet shouldn't actually be a set. #10

eddyb opened this issue Nov 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@eddyb
Copy link
Collaborator

eddyb commented Nov 6, 2024

Right now BTreeSet<Attr> is done really hackily, with non-Ord leaves (and/or "there should be only one of this kind of attribute") being wrapped in OrdAssertEq (where non-equal comparisons just panic).

A better design might look like BTreeMap<AttrKey, AttrValue>, with AttrValue either containing the same set of variants (but only the "payload" information), or something more like LLVM's "metadata" syntax (i.e. regular IR constants plus a few other structured forms that aren't well-represented as values etc.).

There's a few variations but without dependent types we can't do too much to optimize on multiple axis (whereas dependent types could have "a different value type based on the associated key" etc.).

I think initially I also wanted to do weirder interning of attributes and specialize for the "small number of attributes" case (i.e. use a bit in AttrSet to indicate whether the rest of the integer refers to an interned Attr or a set thereof etc.) but that's probably too silly to consider.

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

No branches or pull requests

1 participant