From ef7bb5c37c7ad6082c996ec362ccb2099bf8ccee Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Thu, 6 Oct 2022 12:18:26 -0700 Subject: [PATCH 01/16] Change library loading and fix esimd selector function --- SYCL/Basic/library_loading.cpp | 12 +++++++----- SYCL/ESIMD/esimd_test_utils.hpp | 19 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/SYCL/Basic/library_loading.cpp b/SYCL/Basic/library_loading.cpp index 7776f84f5e..f6c4625083 100644 --- a/SYCL/Basic/library_loading.cpp +++ b/SYCL/Basic/library_loading.cpp @@ -1,7 +1,9 @@ // REQUIRES: linux // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace.txt || true -// RUN: FileCheck --input-file=%t_trace.txt %s +// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace_no_filter.txt || true +// RUN: FileCheck --input-file=%t_trace_no_filter.txt --check-prefix=CHECK-NO-FILTER %s +// RUN: env SYCL_PI_TRACE=-1 SYCL_DEVICE_FILTER=esimd_emulator %t.out &> %t_trace_esimd_filter.txt || true +// RUN: FileCheck --input-file=%t_trace_esimd_filter.txt --check-prefix=CHECK-ESIMD-FILTER %s // Checks pi traces on library loading #include @@ -9,9 +11,9 @@ using namespace sycl; int main() { - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} + // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} + // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} + // CHECK-ESIMD-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} queue q; q.submit([&](handler &cgh) {}); } diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index b72f2d8a9b..76c7984a4f 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -37,17 +37,16 @@ namespace esimd_test { class ESIMDSelector : public device_selector { // Require GPU device virtual int operator()(const device &device) const { - if (const char *dev_filter = getenv("SYCL_DEVICE_FILTER")) { - std::string filter_string(dev_filter); - if (filter_string.find("gpu") != std::string::npos) - return device.is_gpu() ? 1000 : -1; - std::cerr - << "Supported 'SYCL_DEVICE_FILTER' env var values is 'gpu' and '" - << filter_string << "' does not contain such substrings.\n"; - return -1; + if (device.get_backend() == backend::ext_intel_esimd_emulator) { + return 1000; + } else if (device.is_gpu()) { + // pick gpu device if esimd not available but give it a lower score in + // order not to compete with the esimd in environments where both are + // present + return 900; + } else { + return 0; } - // If "SYCL_DEVICE_FILTER" not defined, only allow gpu device - return device.is_gpu() ? 1000 : -1; } }; From b333881a9e35f7ffd36725f144373ab3d1d35fb5 Mon Sep 17 00:00:00 2001 From: lbushi25 <113361374+lbushi25@users.noreply.github.com> Date: Thu, 6 Oct 2022 16:01:32 -0400 Subject: [PATCH 02/16] Update esimd_test_utils.hpp --- SYCL/ESIMD/esimd_test_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 33962d77fe..27281fce00 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -47,7 +47,7 @@ class ESIMDSelector : public device_selector { } else { return 0; } -} + } }; inline auto createExceptionHandler() { From 9ffd9eb76caaab4b4b8d78ff2fa9cef6d0511f72 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 08:58:22 -0700 Subject: [PATCH 03/16] Revert "Update esimd_test_utils.hpp" This reverts commit b333881a9e35f7ffd36725f144373ab3d1d35fb5. --- SYCL/ESIMD/esimd_test_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 27281fce00..33962d77fe 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -47,7 +47,7 @@ class ESIMDSelector : public device_selector { } else { return 0; } - } +} }; inline auto createExceptionHandler() { From 17a77894b52d0e7ada0c59cbec6015a84feb1ff9 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 08:59:32 -0700 Subject: [PATCH 04/16] Change library loader --- SYCL/Basic/library_loading.cpp | 12 +++++------- SYCL/ESIMD/esimd_test_utils.hpp | 23 ++++++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/SYCL/Basic/library_loading.cpp b/SYCL/Basic/library_loading.cpp index f6c4625083..7776f84f5e 100644 --- a/SYCL/Basic/library_loading.cpp +++ b/SYCL/Basic/library_loading.cpp @@ -1,9 +1,7 @@ // REQUIRES: linux // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace_no_filter.txt || true -// RUN: FileCheck --input-file=%t_trace_no_filter.txt --check-prefix=CHECK-NO-FILTER %s -// RUN: env SYCL_PI_TRACE=-1 SYCL_DEVICE_FILTER=esimd_emulator %t.out &> %t_trace_esimd_filter.txt || true -// RUN: FileCheck --input-file=%t_trace_esimd_filter.txt --check-prefix=CHECK-ESIMD-FILTER %s +// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace.txt || true +// RUN: FileCheck --input-file=%t_trace.txt %s // Checks pi traces on library loading #include @@ -11,9 +9,9 @@ using namespace sycl; int main() { - // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} - // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} - // CHECK-ESIMD-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} + // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} + // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} + // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} queue q; q.submit([&](handler &cgh) {}); } diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 33962d77fe..41e4600ceb 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -37,17 +37,22 @@ namespace esimd_test { class ESIMDSelector : public device_selector { // Require GPU device virtual int operator()(const device &device) const { - if (device.get_backend() == backend::ext_intel_esimd_emulator) { - return 1000; - } else if (device.is_gpu()) { - // pick gpu device if esimd not available but give it a lower score in - // order not to compete with the esimd in environments where both are - // present - return 900; - } else { - return 0; + if (const char *dev_filter = getenv("SYCL_DEVICE_FILTER")) { + std::string filter_string(dev_filter); + if (filter_string.find("gpu") != std::string::npos) + return device.is_gpu() ? 1000 : -1; + std::cerr + << "Supported 'SYCL_DEVICE_FILTER' env var values is 'gpu' and '" + << filter_string << "' does not contain such substrings.\n"; + return -1; } +<<<<<<< HEAD } +======= + // If "SYCL_DEVICE_FILTER" not defined, only allow gpu device + return device.is_gpu() ? 1000 : -1; + } +>>>>>>> parent of ef7bb5c3 (Change library loading and fix esimd selector function) }; inline auto createExceptionHandler() { From a503969d5ab8d91c1af4b87e844281a29cf7b003 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 09:01:36 -0700 Subject: [PATCH 05/16] Revert "Change library loader" This reverts commit 17a77894b52d0e7ada0c59cbec6015a84feb1ff9. --- SYCL/Basic/library_loading.cpp | 12 +++++++----- SYCL/ESIMD/esimd_test_utils.hpp | 23 +++++++++-------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/SYCL/Basic/library_loading.cpp b/SYCL/Basic/library_loading.cpp index 7776f84f5e..f6c4625083 100644 --- a/SYCL/Basic/library_loading.cpp +++ b/SYCL/Basic/library_loading.cpp @@ -1,7 +1,9 @@ // REQUIRES: linux // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace.txt || true -// RUN: FileCheck --input-file=%t_trace.txt %s +// RUN: env SYCL_PI_TRACE=-1 %t.out &> %t_trace_no_filter.txt || true +// RUN: FileCheck --input-file=%t_trace_no_filter.txt --check-prefix=CHECK-NO-FILTER %s +// RUN: env SYCL_PI_TRACE=-1 SYCL_DEVICE_FILTER=esimd_emulator %t.out &> %t_trace_esimd_filter.txt || true +// RUN: FileCheck --input-file=%t_trace_esimd_filter.txt --check-prefix=CHECK-ESIMD-FILTER %s // Checks pi traces on library loading #include @@ -9,9 +11,9 @@ using namespace sycl; int main() { - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} - // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} + // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} + // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} + // CHECK-ESIMD-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} queue q; q.submit([&](handler &cgh) {}); } diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 41e4600ceb..33962d77fe 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -37,22 +37,17 @@ namespace esimd_test { class ESIMDSelector : public device_selector { // Require GPU device virtual int operator()(const device &device) const { - if (const char *dev_filter = getenv("SYCL_DEVICE_FILTER")) { - std::string filter_string(dev_filter); - if (filter_string.find("gpu") != std::string::npos) - return device.is_gpu() ? 1000 : -1; - std::cerr - << "Supported 'SYCL_DEVICE_FILTER' env var values is 'gpu' and '" - << filter_string << "' does not contain such substrings.\n"; - return -1; + if (device.get_backend() == backend::ext_intel_esimd_emulator) { + return 1000; + } else if (device.is_gpu()) { + // pick gpu device if esimd not available but give it a lower score in + // order not to compete with the esimd in environments where both are + // present + return 900; + } else { + return 0; } -<<<<<<< HEAD } -======= - // If "SYCL_DEVICE_FILTER" not defined, only allow gpu device - return device.is_gpu() ? 1000 : -1; - } ->>>>>>> parent of ef7bb5c3 (Change library loading and fix esimd selector function) }; inline auto createExceptionHandler() { From dbe08f0df8981f65e2228e614df5d9b19e78b1e5 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 09:05:00 -0700 Subject: [PATCH 06/16] Update library loading --- SYCL/Basic/library_loading.cpp | 2 +- SYCL/ESIMD/esimd_test_utils.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SYCL/Basic/library_loading.cpp b/SYCL/Basic/library_loading.cpp index f6c4625083..be45109ac7 100644 --- a/SYCL/Basic/library_loading.cpp +++ b/SYCL/Basic/library_loading.cpp @@ -4,8 +4,8 @@ // RUN: FileCheck --input-file=%t_trace_no_filter.txt --check-prefix=CHECK-NO-FILTER %s // RUN: env SYCL_PI_TRACE=-1 SYCL_DEVICE_FILTER=esimd_emulator %t.out &> %t_trace_esimd_filter.txt || true // RUN: FileCheck --input-file=%t_trace_esimd_filter.txt --check-prefix=CHECK-ESIMD-FILTER %s - // Checks pi traces on library loading + #include using namespace sycl; diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 33962d77fe..76c7984a4f 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -26,7 +26,7 @@ using namespace sycl; namespace esimd_test { -// This is function provided to SYCL runtime by the application to decide +// This is the class provided to SYCL runtime by the application to decide // on which device to run, or whether to run at all. // When selecting a device, SYCL runtime first takes (1) a selector provided by // the program or a default one and (2) the set of all available devices. Then @@ -47,7 +47,7 @@ class ESIMDSelector : public device_selector { } else { return 0; } -} + } }; inline auto createExceptionHandler() { From 04f55b1c9e571ec68f5b29f62b957ad3c5a963e0 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 09:17:29 -0700 Subject: [PATCH 07/16] Update esimd selector --- SYCL/ESIMD/sycl_esimd_mix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SYCL/ESIMD/sycl_esimd_mix.cpp b/SYCL/ESIMD/sycl_esimd_mix.cpp index 5f08c1b07c..d5d724fc6e 100644 --- a/SYCL/ESIMD/sycl_esimd_mix.cpp +++ b/SYCL/ESIMD/sycl_esimd_mix.cpp @@ -63,7 +63,7 @@ int main(void) { // We need that many threads in each group sycl::range<1> LocalRange{1}; - queue q(gpu_selector_v, esimd_test::createExceptionHandler()); + queue q(gpu_selector{}, esimd_test::createExceptionHandler()); auto dev = q.get_device(); std::cout << "Running on " << dev.get_info() << "\n"; @@ -94,7 +94,7 @@ int main(void) { // We need that many threads in each group sycl::range<1> LocalRange{1}; - queue q(esimd_test::ESIMDSelector, esimd_test::createExceptionHandler()); + queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler()); auto dev = q.get_device(); std::cout << "Running on " << dev.get_info() << "\n"; From a1593e5a8ec7b8ac279f0eb00e98d1665ccedc9e Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 11:30:48 -0700 Subject: [PATCH 08/16] Fix compilation issues --- SYCL/ESIMD/esimd_test_utils.hpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 76c7984a4f..1fe64c6bbb 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -26,7 +26,7 @@ using namespace sycl; namespace esimd_test { -// This is the class provided to SYCL runtime by the application to decide +// This is the function provided to SYCL runtime by the application to decide // on which device to run, or whether to run at all. // When selecting a device, SYCL runtime first takes (1) a selector provided by // the program or a default one and (2) the set of all available devices. Then @@ -34,21 +34,19 @@ namespace esimd_test { // which '()' returned the highest number, is selected. If a negative number // was returned for all devices, then the selection process will cause an // exception. -class ESIMDSelector : public device_selector { // Require GPU device - virtual int operator()(const device &device) const { - if (device.get_backend() == backend::ext_intel_esimd_emulator) { - return 1000; - } else if (device.is_gpu()) { - // pick gpu device if esimd not available but give it a lower score in - // order not to compete with the esimd in environments where both are - // present - return 900; - } else { - return 0; - } +int ESIMDSelector(const device &device) { + if (device.get_backend() == backend::ext_intel_esimd_emulator) { + return 1000; + } else if (device.is_gpu()) { + // pick gpu device if esimd not available but give it a lower score in + // order not to compete with the esimd in environments where both are + // present + return 900; + } else { + return 0; } -}; +} inline auto createExceptionHandler() { return [](exception_list l) { From 938eb8917823789be3862404ff39e0bb10c7380e Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 11:44:15 -0700 Subject: [PATCH 09/16] Formatting --- SYCL/ESIMD/esimd_test_utils.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 1fe64c6bbb..24f7269c86 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -34,8 +34,8 @@ namespace esimd_test { // which '()' returned the highest number, is selected. If a negative number // was returned for all devices, then the selection process will cause an // exception. - // Require GPU device -int ESIMDSelector(const device &device) { +// Require GPU device +int ESIMDSelector(const device &device) { if (device.get_backend() == backend::ext_intel_esimd_emulator) { return 1000; } else if (device.is_gpu()) { From 07497e70e78be68b02fd8028c233a7b50b4b6eb6 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 12:06:13 -0700 Subject: [PATCH 10/16] Update sycl_esimd_mix.cpp --- SYCL/ESIMD/sycl_esimd_mix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SYCL/ESIMD/sycl_esimd_mix.cpp b/SYCL/ESIMD/sycl_esimd_mix.cpp index d5d724fc6e..5f08c1b07c 100644 --- a/SYCL/ESIMD/sycl_esimd_mix.cpp +++ b/SYCL/ESIMD/sycl_esimd_mix.cpp @@ -63,7 +63,7 @@ int main(void) { // We need that many threads in each group sycl::range<1> LocalRange{1}; - queue q(gpu_selector{}, esimd_test::createExceptionHandler()); + queue q(gpu_selector_v, esimd_test::createExceptionHandler()); auto dev = q.get_device(); std::cout << "Running on " << dev.get_info() << "\n"; @@ -94,7 +94,7 @@ int main(void) { // We need that many threads in each group sycl::range<1> LocalRange{1}; - queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler()); + queue q(esimd_test::ESIMDSelector, esimd_test::createExceptionHandler()); auto dev = q.get_device(); std::cout << "Running on " << dev.get_info() << "\n"; From d7d7e00c0fddc908579eff5daaa9024ff74ed9d0 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 7 Oct 2022 13:18:55 -0700 Subject: [PATCH 11/16] Update esimd utilities file --- SYCL/ESIMD/esimd_test_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 24f7269c86..d05123bdff 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -35,7 +35,7 @@ namespace esimd_test { // was returned for all devices, then the selection process will cause an // exception. // Require GPU device -int ESIMDSelector(const device &device) { +inline int ESIMDSelector(const device &device) { if (device.get_backend() == backend::ext_intel_esimd_emulator) { return 1000; } else if (device.is_gpu()) { From bcefc95d617c9ce8ccb668d20b4ae6b2bd6bf17a Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Mon, 10 Oct 2022 10:23:36 -0700 Subject: [PATCH 12/16] Check ESIMD_EMULATOR does not appear when device filter not set --- SYCL/Basic/library_loading.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SYCL/Basic/library_loading.cpp b/SYCL/Basic/library_loading.cpp index be45109ac7..c8835076b0 100644 --- a/SYCL/Basic/library_loading.cpp +++ b/SYCL/Basic/library_loading.cpp @@ -12,6 +12,7 @@ using namespace sycl; int main() { // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}} + // CHECK-NO-FILTER-NOT: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} // CHECK-NO-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}} // CHECK-ESIMD-FILTER: {{(SYCL_PI_TRACE\[-1\]: dlopen\(.*/libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}} queue q; From b9fd3e2a96a1cb82975e8cb5003fcc355fe1020a Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Tue, 11 Oct 2022 14:05:04 -0700 Subject: [PATCH 13/16] Prevent esimd selector from selecting non-gpu devices --- SYCL/ESIMD/esimd_test_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index d05123bdff..610685757e 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -44,7 +44,7 @@ inline int ESIMDSelector(const device &device) { // present return 900; } else { - return 0; + return -1; } } From aa763f7cc9a25aaae4127213da3c6cb43a383e15 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Tue, 11 Oct 2022 16:06:17 -0700 Subject: [PATCH 14/16] Check if device vendor is intel for esimd selector --- SYCL/ESIMD/esimd_test_utils.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 610685757e..ec3c1b100f 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -36,9 +36,10 @@ namespace esimd_test { // exception. // Require GPU device inline int ESIMDSelector(const device &device) { + std::string intel{ "Intel(R) Corporation" }; if (device.get_backend() == backend::ext_intel_esimd_emulator) { return 1000; - } else if (device.is_gpu()) { + } else if (device.is_gpu() && device.get_info() == intel) { // pick gpu device if esimd not available but give it a lower score in // order not to compete with the esimd in environments where both are // present From 9e186bde6cf53f28d77d8b6f710b90970c980bd5 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Tue, 11 Oct 2022 16:41:16 -0700 Subject: [PATCH 15/16] Formatting --- SYCL/ESIMD/esimd_test_utils.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index ec3c1b100f..293ec304fa 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -36,10 +36,11 @@ namespace esimd_test { // exception. // Require GPU device inline int ESIMDSelector(const device &device) { - std::string intel{ "Intel(R) Corporation" }; + std::string intel{"Intel(R) Corporation"}; if (device.get_backend() == backend::ext_intel_esimd_emulator) { return 1000; - } else if (device.is_gpu() && device.get_info() == intel) { + } else if (device.is_gpu() && + device.get_info() == intel) { // pick gpu device if esimd not available but give it a lower score in // order not to compete with the esimd in environments where both are // present From 35cf24fb89e9681ae76c8fff133299188effc4e9 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Tue, 11 Oct 2022 16:46:24 -0700 Subject: [PATCH 16/16] Coding style changes --- SYCL/ESIMD/esimd_test_utils.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SYCL/ESIMD/esimd_test_utils.hpp b/SYCL/ESIMD/esimd_test_utils.hpp index 293ec304fa..04b186c29f 100644 --- a/SYCL/ESIMD/esimd_test_utils.hpp +++ b/SYCL/ESIMD/esimd_test_utils.hpp @@ -36,11 +36,11 @@ namespace esimd_test { // exception. // Require GPU device inline int ESIMDSelector(const device &device) { - std::string intel{"Intel(R) Corporation"}; + const std::string intel{"Intel(R) Corporation"}; if (device.get_backend() == backend::ext_intel_esimd_emulator) { return 1000; } else if (device.is_gpu() && - device.get_info() == intel) { + (device.get_info() == intel)) { // pick gpu device if esimd not available but give it a lower score in // order not to compete with the esimd in environments where both are // present