Skip to content
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
11 changes: 9 additions & 2 deletions plugin/sycl/device_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,25 @@ ::sycl::queue* DeviceManager::GetQueue(const DeviceOrd& device_spec) const {
(collective::IsDistributed());
DeviceRegister& device_register = GetDevicesRegister();
if (not_use_default_selector) {
const int device_idx =
collective::IsDistributed() ? collective::GetRank() : device_spec.ordinal;
if (device_spec.IsSyclDefault()) {
auto& devices = device_register.devices;
const int device_idx = collective::IsDistributed()
? collective::GetRank() % devices.size()
: device_spec.ordinal;
CHECK_LT(device_idx, devices.size());
queue_idx = device_idx;
} else if (device_spec.IsSyclCPU()) {
auto& cpu_devices_idxes = device_register.cpu_devices_idxes;
const int device_idx = collective::IsDistributed()
? collective::GetRank() % cpu_devices_idxes.size()
: device_spec.ordinal;
CHECK_LT(device_idx, cpu_devices_idxes.size());
queue_idx = cpu_devices_idxes[device_idx];
} else if (device_spec.IsSyclGPU()) {
auto& gpu_devices_idxes = device_register.gpu_devices_idxes;
const int device_idx = collective::IsDistributed()
? collective::GetRank() % gpu_devices_idxes.size()
: device_spec.ordinal;
CHECK_LT(device_idx, gpu_devices_idxes.size());
queue_idx = gpu_devices_idxes[device_idx];
} else {
Expand Down
Loading