diff --git a/include/device_selection.h b/include/device_selection.h index e41c7d0a..b355d69b 100644 --- a/include/device_selection.h +++ b/include/device_selection.h @@ -67,7 +67,8 @@ auto pick_devices(const config& cfg, const DevicesOrSelector& user_devices_or_se } const auto select_all = [platforms](auto& selector) { - std::unordered_map>> scored_devices_by_backend; + std::unordered_map, std::vector>, utils::pair_hash> + scored_devices_by_platform_and_backend; for(size_t i = 0; i < platforms.size(); ++i) { const auto devices = platforms[i].get_devices(sycl::info::device_type::all); for(size_t j = 0; j < devices.size(); ++j) { @@ -79,12 +80,12 @@ auto pick_devices(const config& cfg, const DevicesOrSelector& user_devices_or_se } const auto score = selector(devices[j]); if(score < 0) continue; - scored_devices_by_backend[devices[j].get_backend()].push_back(std::pair{devices[j], score}); + scored_devices_by_platform_and_backend[{i, devices[j].get_backend()}].push_back(std::pair{devices[j], score}); } } size_t max_score = 0; std::vector max_score_devices; - for(auto& [backend, scored_devices] : scored_devices_by_backend) { + for(auto& [platform_and_backend, scored_devices] : scored_devices_by_platform_and_backend) { size_t sum_score = 0; std::vector devices; for(auto& [d, score] : scored_devices) {