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

DefaultDevice should be an alias of BestAvailable #2443

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion burn-book/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Tensor {
[[3.0, 4.0],
[5.0, 6.0]],
shape: [2, 2],
device: BestAvailable,
device: DefaultDevice,
backend: "wgpu",
kind: "Float",
dtype: "f32",
Expand Down
3 changes: 1 addition & 2 deletions crates/burn-tensor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ mod cube_wgpu {
WgpuDevice::IntegratedGpu(index) => DeviceId::new(1, *index as u32),
WgpuDevice::VirtualGpu(index) => DeviceId::new(2, *index as u32),
WgpuDevice::Cpu => DeviceId::new(3, 0),
WgpuDevice::BestAvailable => DeviceId::new(4, 0),
WgpuDevice::BestAvailable | WgpuDevice::DefaultDevice => DeviceId::new(4, 0),
// For an existing device, use the 64 bit wgpu device ID as the burn DeviceID.
// We're only storing 32 bits, so wrap the the 64 bit value to 32 bits. This
// might collide - but a 1 in 4 billion chance seems ok given there's only a few
// devices in flight at any time.
WgpuDevice::Existing(id) => {
DeviceId::new(5, (id.inner() % (u32::MAX as u64)) as u32)
}
WgpuDevice::DefaultDevice => DeviceId::new(6, 0),
}
}
}
Expand Down