Skip to content

Conversation

@nnethercote
Copy link
Collaborator

NvvmArch's implementation can be simplified in various ways.

@nnethercote
Copy link
Collaborator Author

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.

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.
@nnethercote nnethercote marked this pull request as ready for review November 26, 2025 02:55
@nnethercote
Copy link
Collaborator Author

@LegNeato I have updated this with several new commits. It's ready for review.

.chars()
.last()
.is_some_and(|c| c.is_ascii_alphabetic())
!self.target_feature().ends_with(['f', 'a'])
Copy link
Contributor

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.

Copy link
Collaborator Author

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))

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.
Copy link
Contributor

@LegNeato LegNeato left a comment

Choose a reason for hiding this comment

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

Sweet 🥇

@LegNeato LegNeato merged commit 8ae203e into Rust-GPU:main Nov 26, 2025
11 checks passed
@nnethercote nnethercote deleted the NvvmArch-cleanups branch November 26, 2025 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants