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

chore(candle): Allow enabling accelerate #1009

Merged
merged 8 commits into from
Nov 30, 2023

Conversation

dcvz
Copy link
Contributor

@dcvz dcvz commented Nov 28, 2023

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

Fixes #968

Changes

Enables using accelerate for macOS

Testing

Tests have been run

@dcvz dcvz force-pushed the chore/candle-accelerate branch 3 times, most recently from a882676 to 92ca050 Compare November 28, 2023 15:44
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.

@louisfd can you check why the test fails on accelerate?

burn-autodiff/src/tests/transpose.rs Outdated Show resolved Hide resolved
@dcvz dcvz force-pushed the chore/candle-accelerate branch from 394aa36 to 2c7fb88 Compare November 30, 2023 09:07
@dcvz
Copy link
Contributor Author

dcvz commented Nov 30, 2023

@louisfd @nathanielsimard I fixed the failing test on accelerate. Error previously was:

---- tests::ad_transpose::tests::should_diff_swap_dims stdout ----
thread 'tests::ad_transpose::tests::should_diff_swap_dims' panicked at burn-candle/src/ops/tensor.rs:141:68:
called `Result::unwrap()` on an `Err` value: MatMulUnexpectedStriding(MatMulUnexpectedStriding { lhs_l: Layout { shape: [2, 2, 2], stride: [4, 2, 1], start_offset: 0 }, rhs_l: Layout { shape: [2, 2, 2], stride: [1, 2, 4], start_offset: 0 }, bmnk: (2, 2, 2, 2), msg: "non-contiguous rhs" })

I resolve this by making sure the rhs is contiguous. This is a noop if it was already contiguous so I think it should be ok, but take a look.

@dcvz dcvz marked this pull request as ready for review November 30, 2023 10:17
Copy link
Collaborator

@antimora antimora left a comment

Choose a reason for hiding this comment

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

LGTM.

I have tested on M3 Max and it's working.

@louisfd louisfd merged commit f73136e into tracel-ai:main Nov 30, 2023
10 checks passed
@dcvz dcvz deleted the chore/candle-accelerate branch November 30, 2023 18:03
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.

Enable accelerate feature flag in candle for Macs
5 participants