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

#0: Add StrongTypeHandle to help creating non-clashing alias types #16309

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

omilyutin-tt
Copy link
Contributor

@omilyutin-tt omilyutin-tt commented Dec 24, 2024

Ticket

N/A

Problem description

In tt-metal, primitive types such as uint32_t / int often get used to alias distinct meaningful concepts like DeviceId, chip_id, ethernet_channel_t, etc. This is error prone, as this allows interchangeable uses with their underlying types.

What's changed

Add StrongTypeHandle as a way to create strong aliases that are incompatible with each other:

  • Integrated with std::hash and std::ostream (if the underlying type supports these).
  • Tests / documentation.

Checklist

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

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.

1 participant