-
Notifications
You must be signed in to change notification settings - Fork 217
NvvmArch cleanups
#304
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
NvvmArch cleanups
#304
Conversation
db485c2 to
cc450b2
Compare
|
This will conflict with #306. That PR is more important so I will wait for it to merge first. I might also add some extra stuff here. Hence the "draft" status. |
cc450b2 to
9d92214
Compare
In particular, the backward- vs. forward-compatibility idea.
This is simpler, and the result can be easily converted to `String` if necessary. Also remove lots of `NvvmArch::` prefixes in the tests.
It's a more precise type -- these are static values. Also it avoids unnecessary allocations.
9d92214 to
8a362f9
Compare
|
@LegNeato I have updated this with several new commits. It's ready for review. |
crates/nvvm/src/lib.rs
Outdated
| .chars() | ||
| .last() | ||
| .is_some_and(|c| c.is_ascii_alphabetic()) | ||
| !self.target_feature().ends_with(['f', 'a']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous logic was future-proof where this will be incorrect if NVIDIA adds another? A base variant is defined as not having a letter suffix at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I changed it to this:
!self.target_feature().ends_with(|c| char::is_ascii_alphabetic(&c))
8a362f9 to
593afc1
Compare
This is just a slightly less powerful version of `all_target_features`, one that always includes all the 'a' and 'f' variants for each level. It doesn't seem worth having.
593afc1 to
8e78cd9
Compare
LegNeato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet 🥇
NvvmArch's implementation can be simplified in various ways.