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 num-traits for math ops instead of always using libm (for std and no-std) #1584

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

antimora
Copy link
Collaborator

@antimora antimora commented Apr 7, 2024

When I converted core, tensor and ndarray to be no-std compatible, I used libm functions for std and no-std regardless. I think it would be better if we used std linked functions if it's std flag, otherwise to use libm, which is how num_traits actually operates. This can potentially enhance performance if there are math libs take advantage of specific architecture, whereas libm is arch is generic. Also bundle size will be smaller.

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

#168

Changes

Use num-traits for all math ops

Testing

  1. run-checks.sh all
  2. Benchmark comparisons before and after running std

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 86.39%. Comparing base (f3e0aa6) to head (1b09bc4).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/burn-ndarray/src/element.rs 50.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1584      +/-   ##
==========================================
- Coverage   86.39%   86.39%   -0.01%     
==========================================
  Files         688      688              
  Lines       78676    78675       -1     
==========================================
- Hits        67974    67973       -1     
  Misses      10702    10702              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@antimora antimora changed the title Use num-traits for float ops instead of always using libm (for std and no-std) Use num-traits for math ops instead of always using libm (for std and no-std) Apr 8, 2024
Copy link
Member

@nathanielsimard nathanielsimard left a comment

Choose a reason for hiding this comment

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

LGTM

@antimora antimora merged commit 2f88548 into tracel-ai:main Apr 8, 2024
14 checks passed
@antimora antimora deleted the no-std-math branch April 29, 2024 21:48
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.

3 participants