Skip to content

Use enums to validate their own values#2333

Merged
rwgk merged 2 commits into
NVIDIA:mainfrom
mdboom:cuda-core-enum-validation
Jul 13, 2026
Merged

Use enums to validate their own values#2333
rwgk merged 2 commits into
NVIDIA:mainfrom
mdboom:cuda-core-enum-validation

Conversation

@mdboom

@mdboom mdboom commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Previously there were a few places in the code base where we were validating enums by checking from a set of values (which were copied from the enum itself) and then raising an exception with the acceptable values (also copied from the enum itself). This is 3 places to keep in sync as the acceptable values change.

This uses a helper function to validate that a str is an acceptable value for an enum and provides a consistent error message.

@mdboom mdboom added this to the cuda.core next milestone Jul 9, 2026
@mdboom mdboom self-assigned this Jul 9, 2026
@mdboom mdboom added the cuda.core Everything related to the cuda.core module label Jul 9, 2026
@github-actions

This comment has been minimized.

@mdboom mdboom added the PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together. label Jul 13, 2026
@rwgk rwgk added the P1 Medium priority - Should do label Jul 13, 2026
@rwgk rwgk merged commit c000331 into NVIDIA:main Jul 13, 2026
107 of 109 checks passed
@github-actions

Copy link
Copy Markdown
Doc Preview CI
Preview removed because the pull request was closed or merged.

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

Labels

cuda.core Everything related to the cuda.core module P1 Medium priority - Should do PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants