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

Use a u64 counter for autodiff NodeIDs #843

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

dae
Copy link
Contributor

@dae dae commented Oct 2, 2023

I measure an approximate 13.6% performance boost in our crate from this change.

Pull Request Template

Checklist

  • Confirm that run-checks script has been executed.

Related Issues/PRs

#839
Provide links to relevant issues and dependent PRs.

Changes

Summarize the problem being addressed and your solution.

Testing

Describe how these changes have been tested.

I measure an approximate 13.6% performance boost in our crate from this
change.
}

impl NodeID {
/// Create a unique [node id](NodeID).
pub fn new() -> Self {
static COUNTER: AtomicU64 = AtomicU64::new(0);
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I thought about using u64 for autodiff IDs; it makes more sense for that use case. However, for extremely long training, it might become a problem (overflow). Do we know what behavior occurs in that case? I think it would be better if it were to trigger a panic. In that case, the training would crash and could be restarted from a checkpoint, instead of potentially corrupting the weights without understanding why. Of course, it would have to be an exceptionally long training period, and if it becomes a problem, we could consider using u128 (two u64) in that scenario.

@nathanielsimard nathanielsimard merged commit 28e2a99 into tracel-ai:main Oct 4, 2023
dae added a commit to open-spaced-repetition/fsrs-rs that referenced this pull request Oct 4, 2023
L-M-Sherlock pushed a commit to open-spaced-repetition/fsrs-rs that referenced this pull request Oct 5, 2023
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