Skip to content

Commit

Permalink
DefaultDevice should be an alias of BestAvailable (#2443)
Browse files Browse the repository at this point in the history
* BestAvailable should be an alias

* Fix an old reference
  • Loading branch information
ArthurBrussee authored Oct 31, 2024
1 parent 6d08509 commit 8e466d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
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

0 comments on commit 8e466d7

Please sign in to comment.