mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-02-12 00:10:45 +01:00
Updated SYCL device filtering (llama/8901)
* Updated device filter to depend on default_selector (fixes non-intel device issues) * Small related update to example/sycl Readme
This commit is contained in:
parent
b1348d3530
commit
ab39dd34e1
@ -874,7 +874,7 @@ namespace dpct
|
|||||||
inline std::string get_preferred_gpu_platform_name() {
|
inline std::string get_preferred_gpu_platform_name() {
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
std::string filter = "level-zero";
|
std::string filter = "";
|
||||||
char* env = getenv("ONEAPI_DEVICE_SELECTOR");
|
char* env = getenv("ONEAPI_DEVICE_SELECTOR");
|
||||||
if (env) {
|
if (env) {
|
||||||
if (std::strstr(env, "level_zero")) {
|
if (std::strstr(env, "level_zero")) {
|
||||||
@ -892,11 +892,24 @@ namespace dpct
|
|||||||
else {
|
else {
|
||||||
throw std::runtime_error("invalid device filter: " + std::string(env));
|
throw std::runtime_error("invalid device filter: " + std::string(env));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
auto default_device = sycl::device(sycl::default_selector_v);
|
||||||
|
auto default_platform_name = default_device.get_platform().get_info<sycl::info::platform::name>();
|
||||||
|
|
||||||
|
if (std::strstr(default_platform_name.c_str(), "Level-Zero") || default_device.is_cpu()) {
|
||||||
|
filter = "level-zero";
|
||||||
|
}
|
||||||
|
else if (std::strstr(default_platform_name.c_str(), "CUDA")) {
|
||||||
|
filter = "cuda";
|
||||||
|
}
|
||||||
|
else if (std::strstr(default_platform_name.c_str(), "HIP")) {
|
||||||
|
filter = "hip";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto plaform_list = sycl::platform::get_platforms();
|
auto platform_list = sycl::platform::get_platforms();
|
||||||
|
|
||||||
for (const auto& platform : plaform_list) {
|
for (const auto& platform : platform_list) {
|
||||||
auto devices = platform.get_devices();
|
auto devices = platform.get_devices();
|
||||||
auto gpu_dev = std::find_if(devices.begin(), devices.end(), [](const sycl::device& d) {
|
auto gpu_dev = std::find_if(devices.begin(), devices.end(), [](const sycl::device& d) {
|
||||||
return d.is_gpu();
|
return d.is_gpu();
|
||||||
|
Loading…
Reference in New Issue
Block a user