diff --git a/sycl/doc/EnvironmentVariables.md b/sycl/doc/EnvironmentVariables.md index 0a99f8899f517..91b2b0e22eb1c 100644 --- a/sycl/doc/EnvironmentVariables.md +++ b/sycl/doc/EnvironmentVariables.md @@ -11,8 +11,8 @@ subject to change. Do not rely on these variables in production code. | Environment variable | Values | Description | | -------------------- | ------ | ----------- | -| SYCL_PI_TRACE | Any(\*) | Force tracing of PI calls to stderr. | -| SYCL_BE | PI_OPENCL, PI_CUDA, PI_OTHER | When SYCL RT is built with PI, this controls which plugin is used by the default device selector. Default value is PI_OPENCL. | +| SYCL_PI_TRACE | Described [below](#sycl_pi_trace-options) | Enable specified level of tracing for PI. | +| SYCL_BE | PI_OPENCL, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. | | SYCL_DEVICE_TYPE | One of: CPU, GPU, ACC, HOST | Force SYCL to use the specified device type. If unset, default selection rules are applied. If set to any unlisted value, this control has no effect. If the requested device type is not found, a `cl::sycl::runtime_error` exception is thrown. If a non-default device selector is used, a device must satisfy both the selector and this control to be chosen. This control only has effect on devices created with a selector. | | SYCL_PROGRAM_COMPILE_OPTIONS | String of valid OpenCL compile options | Override compile options for all programs. | | SYCL_PROGRAM_LINK_OPTIONS | String of valid OpenCL link options | Override link options for all programs. | @@ -39,3 +39,12 @@ SYCL_PRINT_EXECUTION_GRAPH can accept one or more comma separated values from th | after_addHostAcc | print graph after addHostAccessor method | | always | print graph before and after each of the above methods | +### SYCL_PI_TRACE Options + +SYCL_PI_TRACE accepts a bit-mask. Supported tracing levels are in the table below + +| Option | Description | +| ------ | ----------- | +| 1 | Enable basic tracing, which is tracing of PI plugins/devices discovery | +| 2 | Enable tracing of the PI calls | +| -1 | Enable all levels of tracing | diff --git a/sycl/include/CL/sycl/detail/pi.hpp b/sycl/include/CL/sycl/detail/pi.hpp index de77c7671f2b7..55b914d429e3d 100644 --- a/sycl/include/CL/sycl/detail/pi.hpp +++ b/sycl/include/CL/sycl/detail/pi.hpp @@ -13,6 +13,7 @@ #pragma once +#include #include #include #include @@ -43,6 +44,17 @@ enum class PiApiKind { class plugin; namespace pi { +// The SYCL_PI_TRACE sets what we will trace. +// This is a bit-mask of various things we'd want to trace. +enum TraceLevel { + PI_TRACE_BASIC = 0x1, + PI_TRACE_CALLS = 0x2, + PI_TRACE_ALL = -1 +}; + +// Return true if we want to trace PI related activities. +bool trace(TraceLevel level); + #ifdef SYCL_RT_OS_WINDOWS #define OPENCL_PLUGIN_NAME "pi_opencl.dll" #define CUDA_PLUGIN_NAME "pi_cuda.dll" @@ -111,13 +123,6 @@ void *loadOsLibrary(const std::string &Library); // library, implementation is OS dependent. void *getOsLibraryFuncAddress(void *Library, const std::string &FunctionName); -// For selection of SYCL RT back-end, now manually through the "SYCL_BE" -// environment variable. -enum Backend { SYCL_BE_PI_OPENCL, SYCL_BE_PI_CUDA, SYCL_BE_PI_OTHER }; - -// Check for manually selected BE at run-time. -bool useBackend(Backend Backend); - // Get a string representing a _pi_platform_info enum std::string platformInfoToString(pi_platform_info info); diff --git a/sycl/source/detail/config.cpp b/sycl/source/detail/config.cpp index d37626c1526c2..8258bae4ed412 100644 --- a/sycl/source/detail/config.cpp +++ b/sycl/source/detail/config.cpp @@ -103,7 +103,7 @@ void readConfig() { void dumpConfig() { #define CONFIG(Name, MaxSize, CompileTimeDef) \ { \ - const char *Val = SYCLConfig::get(); \ + const char *Val = SYCLConfigBase::getRawValue(); \ std::cerr << SYCLConfigBase::MConfigName << " : " \ << (Val ? Val : "unset") << std::endl; \ } diff --git a/sycl/source/detail/config.def b/sycl/source/detail/config.def index 2f0af4d345c8d..271eb51fa6530 100644 --- a/sycl/source/detail/config.def +++ b/sycl/source/detail/config.def @@ -13,3 +13,5 @@ CONFIG(SYCL_PRINT_EXECUTION_GRAPH, 32, __SYCL_PRINT_EXECUTION_GRAPH) CONFIG(SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP, 1, __SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP) CONFIG(SYCL_DEVICE_ALLOWLIST, 1024, __SYCL_DEVICE_ALLOWLIST) +CONFIG(SYCL_BE, 16, __SYCL_BE) +CONFIG(SYCL_PI_TRACE, 16, __SYCL_PI_TRACE) diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index 90ec14f8582d8..e1d571d8dfb3d 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -8,9 +8,14 @@ #pragma once +#include #include +#include +#include +#include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { @@ -48,6 +53,9 @@ constexpr const char *getStrOrNullptr(const char *Str) { return (Str[0] == '_' && Str[1] == '_') ? nullptr : Str; } +// Intializes configs from the configuration file +void readConfig(); + template class SYCLConfigBase; #define CONFIG(Name, MaxSize, CompileTimeDef) \ @@ -65,38 +73,89 @@ template class SYCLConfigBase; * beginning of the string, if it starts with double underscore(__) the \ * value is not set.*/ \ static const char *const MCompileTimeDef; \ + \ + static const char *getRawValue() { \ + if (ConfigFromEnvEnabled) \ + if (const char *ValStr = getenv(MConfigName)) \ + return ValStr; \ + \ + if (ConfigFromFileEnabled) { \ + readConfig(); \ + if (MValueFromFile) \ + return MValueFromFile; \ + } \ + \ + if (ConfigFromCompileDefEnabled && MCompileTimeDef) \ + return MCompileTimeDef; \ + \ + return nullptr; \ + } \ }; #include "config.def" #undef CONFIG -// Intializes configs from the configuration file -void readConfig(); - template class SYCLConfig { using BaseT = SYCLConfigBase; public: static const char *get() { - const char *ValStr = getRawValue(); + static const char *ValStr = BaseT::getRawValue(); return ValStr; } +}; -private: - static const char *getRawValue() { - if (ConfigFromEnvEnabled) - if (const char *ValStr = getenv(BaseT::MConfigName)) - return ValStr; +template <> class SYCLConfig { + using BaseT = SYCLConfigBase; - if (ConfigFromFileEnabled) { - readConfig(); - if (BaseT::MValueFromFile) - return BaseT::MValueFromFile; +public: + static backend *get() { + static bool Initialized = false; + static backend *BackendPtr = nullptr; + + // Configuration parameters are processed only once, like reading a string + // from environment and converting it into a typed object. + if (Initialized) + return BackendPtr; + + const char *ValStr = BaseT::getRawValue(); + const std::array, 2> SyclBeMap = { + {{"PI_OPENCL", backend::opencl}, {"PI_CUDA", backend::cuda}}}; + if (ValStr) { + auto It = std::find_if( + std::begin(SyclBeMap), std::end(SyclBeMap), + [&ValStr](const std::pair &element) { + return element.first == ValStr; + }); + if (It == SyclBeMap.end()) + pi::die("Invalid backend. " + "Valid values are PI_OPENCL/PI_CUDA"); + static backend Backend = It->second; + BackendPtr = &Backend; } + Initialized = true; + return BackendPtr; + } +}; - if (ConfigFromCompileDefEnabled && BaseT::MCompileTimeDef) - return BaseT::MCompileTimeDef; +template <> class SYCLConfig { + using BaseT = SYCLConfigBase; - return nullptr; +public: + static int get() { + static bool Initialized = false; + // We don't use TraceLevel enum here because user can provide any bitmask + // which can correspond to several enum values. + static int Level = 0; // No tracing by default + + // Configuration parameters are processed only once, like reading a string + // from environment and converting it into a typed object. + if (Initialized) + return Level; + + const char *ValStr = BaseT::getRawValue(); + Level = (ValStr ? std::atoi(ValStr) : 0); + Initialized = true; + return Level; } }; diff --git a/sycl/source/detail/pi.cpp b/sycl/source/detail/pi.cpp index 4ec13c447a1c7..a85590b30e843 100644 --- a/sycl/source/detail/pi.cpp +++ b/sycl/source/detail/pi.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,9 +23,9 @@ #include #include #include +#include #include #include -#include #ifdef XPTI_ENABLE_INSTRUMENTATION // Include the headers necessary for emitting @@ -141,39 +142,21 @@ std::string memFlagsToString(pi_mem_flags Flags) { return Sstream.str(); } -// Check for manually selected BE at run-time. -static Backend getBackend() { - static const char *GetEnv = std::getenv("SYCL_BE"); - // Current default backend as SYCL_BE_PI_OPENCL - // Valid values of GetEnv are "PI_OPENCL", "PI_CUDA" and "PI_OTHER" - std::string StringGetEnv = (GetEnv ? GetEnv : "PI_OPENCL"); - static const Backend Use = - std::map{ - { "PI_OPENCL", SYCL_BE_PI_OPENCL }, - { "PI_CUDA", SYCL_BE_PI_CUDA }, - { "PI_OTHER", SYCL_BE_PI_OTHER } - }[ GetEnv ? StringGetEnv : "PI_OPENCL"]; - return Use; -} - -// Check for manually selected BE at run-time. -bool useBackend(Backend TheBackend) { - return TheBackend == getBackend(); -} - // GlobalPlugin is a global Plugin used with Interoperability constructors that // use OpenCL objects to construct SYCL class objects. std::shared_ptr GlobalPlugin; // Find the plugin at the appropriate location and return the location. -// TODO: Change the function appropriately when there are multiple plugins. -bool findPlugins(vector_class &PluginNames) { +bool findPlugins(vector_class> &PluginNames) { // TODO: Based on final design discussions, change the location where the // plugin must be searched; how to identify the plugins etc. Currently the // search is done for libpi_opencl.so/pi_opencl.dll file in LD_LIBRARY_PATH // env only. - PluginNames.push_back(OPENCL_PLUGIN_NAME); - PluginNames.push_back(CUDA_PLUGIN_NAME); + // + PluginNames.push_back(std::make_pair(OPENCL_PLUGIN_NAME, + backend::opencl)); + PluginNames.push_back( + std::make_pair(CUDA_PLUGIN_NAME, backend::cuda)); return true; } @@ -207,52 +190,59 @@ bool bindPlugin(void *Library, PiPlugin *PluginInformation) { return true; } -// Load the plugin based on SYCL_BE. -// TODO: Currently only accepting OpenCL and CUDA plugins. Edit it to identify -// and load other kinds of plugins, do the required changes in the -// findPlugins, loadPlugin and bindPlugin functions. +bool trace(TraceLevel Level) { + auto TraceLevelMask = SYCLConfig::get(); + return (TraceLevelMask & Level) == Level; +} + +// Initializes all available Plugins. vector_class initialize() { vector_class Plugins; - - if (!useBackend(SYCL_BE_PI_OPENCL) && !useBackend(SYCL_BE_PI_CUDA)) { - die("Unknown SYCL_BE"); - } - - bool EnableTrace = (std::getenv("SYCL_PI_TRACE") != nullptr); - - vector_class PluginNames; + vector_class> PluginNames; findPlugins(PluginNames); - if (PluginNames.empty() && EnableTrace) - std::cerr << "No Plugins Found." << std::endl; + if (PluginNames.empty() && trace(PI_TRACE_ALL)) + std::cerr << "SYCL_PI_TRACE[all]: " + << "No Plugins Found." << std::endl; - PiPlugin PluginInformation; // TODO: include. + PiPlugin PluginInformation; for (unsigned int I = 0; I < PluginNames.size(); I++) { - void *Library = loadPlugin(PluginNames[I]); + void *Library = loadPlugin(PluginNames[I].first); if (!Library) { - if (EnableTrace) { - std::cerr << "Check if plugin is present. Failed to load plugin: " - << PluginNames[I] << std::endl; + if (trace(PI_TRACE_ALL)) { + std::cerr << "SYCL_PI_TRACE[all]: " + << "Check if plugin is present. " + << "Failed to load plugin: " << PluginNames[I].first + << std::endl; } continue; } - if (!bindPlugin(Library, &PluginInformation) && EnableTrace) { - std::cerr << "Failed to bind PI APIs to the plugin: " << PluginNames[I] - << std::endl; + if (!bindPlugin(Library, &PluginInformation)) { + if (trace(PI_TRACE_ALL)) { + std::cerr << "SYCL_PI_TRACE[all]: " + << "Failed to bind PI APIs to the plugin: " + << PluginNames[I].first << std::endl; + } + continue; } - if (useBackend(SYCL_BE_PI_OPENCL) && - PluginNames[I].find("opencl") != std::string::npos) { + backend *BE = SYCLConfig::get(); + if (!BE || (*BE == backend::opencl && + PluginNames[I].first.find("opencl") != std::string::npos)) { // Use the OpenCL plugin as the GlobalPlugin - GlobalPlugin = std::make_shared(PluginInformation); - } - if (useBackend(SYCL_BE_PI_CUDA) && - PluginNames[I].find("cuda") != std::string::npos) { + GlobalPlugin = + std::make_shared(PluginInformation, backend::opencl); + } else if (*BE == backend::cuda && + PluginNames[I].first.find("cuda") != std::string::npos) { // Use the CUDA plugin as the GlobalPlugin - GlobalPlugin = std::make_shared(PluginInformation); + GlobalPlugin = std::make_shared(PluginInformation, backend::cuda); } - Plugins.push_back(plugin(PluginInformation)); + Plugins.emplace_back(plugin(PluginInformation, PluginNames[I].second)); + if (trace(TraceLevel::PI_TRACE_BASIC)) + std::cerr << "SYCL_PI_TRACE[basic]: " + << "Plugin found and successfully loaded: " + << PluginNames[I].first << std::endl; } #ifdef XPTI_ENABLE_INSTRUMENTATION diff --git a/sycl/source/detail/plugin.hpp b/sycl/source/detail/plugin.hpp index 14ddf8f9560e2..41b3535eba544 100644 --- a/sycl/source/detail/plugin.hpp +++ b/sycl/source/detail/plugin.hpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #pragma once +#include #include #include #include @@ -23,9 +24,8 @@ class plugin { public: plugin() = delete; - plugin(RT::PiPlugin Plugin) : MPlugin(Plugin) { - MPiEnableTrace = (std::getenv("SYCL_PI_TRACE") != nullptr); - } + plugin(RT::PiPlugin Plugin, backend UseBackend) + : MPlugin(Plugin), MBackend(UseBackend) {} ~plugin() = default; @@ -52,13 +52,13 @@ class plugin { template RT::PiResult call_nocheck(ArgsT... Args) const { RT::PiFuncInfo PiCallInfo; - if (MPiEnableTrace) { + if (pi::trace(pi::TraceLevel::PI_TRACE_CALLS)) { std::string FnName = PiCallInfo.getFuncName(); std::cout << "---> " << FnName << "(" << std::endl; RT::printArgs(Args...); } RT::PiResult R = PiCallInfo.getFuncPtr(MPlugin)(Args...); - if (MPiEnableTrace) { + if (pi::trace(pi::TraceLevel::PI_TRACE_CALLS)) { std::cout << ") ---> "; RT::printArgs(R); } @@ -74,10 +74,11 @@ class plugin { checkPiResult(Err); } + backend getBackend(void) const { return MBackend; } + private: RT::PiPlugin MPlugin; - bool MPiEnableTrace; - + const backend MBackend; }; // class plugin } // namespace detail } // namespace sycl diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 064638eb8696f..29e3f94053940 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include #include #include #include @@ -270,7 +271,8 @@ static bool isDeviceBinaryTypeSupported(const context &C, } // OpenCL 2.1 and greater require clCreateProgramWithIL - if (pi::useBackend(pi::SYCL_BE_PI_OPENCL) && + backend CBackend = (detail::getSyclObjImpl(C)->getPlugin()).getBackend(); + if ((CBackend == backend::opencl) && C.get_platform().get_info() >= "2.1") return true; diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 5664ca1ad25e0..0f4534cdc6813 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -10,6 +10,7 @@ #include "CL/sycl/access/access.hpp" #include +#include #include #include #include @@ -1672,7 +1673,7 @@ cl_int ExecCGCommand::enqueueImp() { Requirement *Req = (Requirement *)(Arg.MPtr); AllocaCommandBase *AllocaCmd = getAllocaForReq(Req); RT::PiMem MemArg = (RT::PiMem)AllocaCmd->getMemAllocation(); - if (RT::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) { + if (Plugin.getBackend() == backend::opencl) { Plugin.call(Kernel, Arg.MIndex, sizeof(RT::PiMem), &MemArg); } else { diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index d08fa5a63922e..91f2cc453bbb0 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,14 @@ vector_class device::get_devices(info::device_type deviceType) { if (detail::match_types(deviceType, forced_type)) { detail::force_type(deviceType, forced_type); for (const auto &plt : platform::get_platforms()) { + // If SYCL_BE is set then skip platforms which doesn't have specified + // backend. + backend *ForcedBackend = detail::SYCLConfig::get(); + if (ForcedBackend) + if (!plt.is_host() && + (detail::getSyclObjImpl(plt)->getPlugin().getBackend() != + *ForcedBackend)) + continue; if (includeHost && plt.is_host()) { vector_class host_device( plt.get_devices(info::device_type::host)); @@ -63,6 +72,7 @@ vector_class device::get_devices(info::device_type deviceType) { } } } + return devices; } diff --git a/sycl/source/device_selector.cpp b/sycl/source/device_selector.cpp index 6eb1a32d13471..aba27e0c926fa 100644 --- a/sycl/source/device_selector.cpp +++ b/sycl/source/device_selector.cpp @@ -6,27 +6,72 @@ // //===----------------------------------------------------------------------===// +#include #include #include #include #include +#include #include // 4.6.1 Device selection class __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { + +// Utility function to check if device is of the preferred backend. +// Currently preference is given to the opencl backend. +static bool isDeviceOfPreferredSyclBe(const device &Device) { + if (Device.is_host()) + return false; + + return detail::getSyclObjImpl(Device)->getPlugin().getBackend() == + backend::opencl; +} + device device_selector::select_device() const { vector_class devices = device::get_devices(); int score = -1; const device *res = nullptr; - for (const auto &dev : devices) - if (score < operator()(dev)) { + for (const auto &dev : devices) { + int dev_score = (*this)(dev); + if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_ALL)) { + string_class PlatformVersion = dev.get_info() + .get_info(); + string_class DeviceName = dev.get_info(); + std::cout << "SYCL_PI_TRACE[all]: " + << "select_device(): -> score = " << score << std::endl + << "SYCL_PI_TRACE[all]: " + << " platform: " << PlatformVersion << std::endl + << "SYCL_PI_TRACE[all]: " + << " device: " << DeviceName << std::endl; + } + + // SYCL spec says: "If more than one device receives the high score then + // one of those tied devices will be returned, but which of the devices + // from the tied set is to be returned is not defined". Here we give a + // preference to the device of the preferred BE. + // + if (score < dev_score || + (score == dev_score && isDeviceOfPreferredSyclBe(dev))) { res = &dev; - score = operator()(dev); + score = dev_score; } + } - if (res != nullptr) + if (res != nullptr) { + if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_BASIC)) { + string_class PlatformVersion = res->get_info() + .get_info(); + string_class DeviceName = res->get_info(); + std::cout << "SYCL_PI_TRACE[all]: " + << "Selected device ->" << std::endl + << "SYCL_PI_TRACE[all]: " + << " platform: " << PlatformVersion << std::endl + << "SYCL_PI_TRACE[all]: " + << " device: " << DeviceName << std::endl; + } return *res; + } throw cl::sycl::runtime_error("No device of requested type available.", PI_DEVICE_NOT_FOUND); @@ -34,57 +79,70 @@ device device_selector::select_device() const { int default_selector::operator()(const device &dev) const { - // Take note of the SYCL_BE environment variable when doing default selection - const char *SYCL_BE = std::getenv("SYCL_BE"); - if (SYCL_BE) { - std::string backend = (SYCL_BE ? SYCL_BE : ""); - // Taking the version information from the platform gives us more useful - // information than the driver_version of the device. - const platform platform = dev.get_info(); - const std::string platformVersion = - platform.get_info();; - // If using PI_CUDA, don't accept a non-CUDA device - if (platformVersion.find("CUDA") == std::string::npos && - backend == "PI_CUDA") { - return -1; - } - // If using PI_OPENCL, don't accept a non-OpenCL device - if (platformVersion.find("OpenCL") == std::string::npos && - backend == "PI_OPENCL") { - return -1; - } - } + int Score = -1; + + // Give preference to device of SYCL BE. + if (isDeviceOfPreferredSyclBe(dev)) + Score = 50; // override always wins if (dev.get_info() == detail::get_forced_type()) - return 1000; + Score += 1000; if (dev.is_gpu()) - return 500; + Score += 500; if (dev.is_cpu()) - return 300; + Score += 300; if (dev.is_host()) - return 100; + Score += 100; - return -1; + return Score; } int gpu_selector::operator()(const device &dev) const { - return dev.is_gpu() ? 1000 : -1; + int Score = -1; + if (dev.is_gpu()) { + Score = 1000; + // Give preference to device of SYCL BE. + if (isDeviceOfPreferredSyclBe(dev)) + Score += 50; + } + return Score; } int cpu_selector::operator()(const device &dev) const { - return dev.is_cpu() ? 1000 : -1; + int Score = -1; + if (dev.is_cpu()) { + Score = 1000; + // Give preference to device of SYCL BE. + if (isDeviceOfPreferredSyclBe(dev)) + Score += 50; + } + return Score; } int accelerator_selector::operator()(const device &dev) const { - return dev.is_accelerator() ? 1000 : -1; + int Score = -1; + if (dev.is_accelerator()) { + Score = 1000; + // Give preference to device of SYCL BE. + if (isDeviceOfPreferredSyclBe(dev)) + Score += 50; + } + return Score; } int host_selector::operator()(const device &dev) const { - return dev.is_host() ? 1000 : -1; + int Score = -1; + if (dev.is_host()) { + Score = 1000; + // Give preference to device of SYCL BE. + if (isDeviceOfPreferredSyclBe(dev)) + Score += 50; + } + return Score; } } // namespace sycl diff --git a/sycl/test/basic_tests/event_release.cpp b/sycl/test/basic_tests/event_release.cpp index 37e0d4258b28b..9693516a54353 100644 --- a/sycl/test/basic_tests/event_release.cpp +++ b/sycl/test/basic_tests/event_release.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER #include #include #include diff --git a/sycl/test/basic_tests/subdevice_pi.cpp b/sycl/test/basic_tests/subdevice_pi.cpp index af58fcc68a32f..143bc156de194 100644 --- a/sycl/test/basic_tests/subdevice_pi.cpp +++ b/sycl/test/basic_tests/subdevice_pi.cpp @@ -1,7 +1,7 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=1 %t.out separate equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-SEPARATE -// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=1 %t.out shared equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-SHARED --implicit-check-not piContextCreate --implicit-check-not piMemBufferCreate -// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=1 %t.out fused equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-FUSED --implicit-check-not piContextCreate --implicit-check-not piMemBufferCreate +// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=2 %t.out separate equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-SEPARATE +// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=2 %t.out shared equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-SHARED --implicit-check-not piContextCreate --implicit-check-not piMemBufferCreate +// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=2 %t.out fused equally %CPU_CHECK_PLACEHOLDER --check-prefix CHECK-FUSED --implicit-check-not piContextCreate --implicit-check-not piMemBufferCreate // // Intel OpenCL CPU Runtime supports device partition on all (multi-core) // platforms. Other devices may not support this. diff --git a/sycl/test/devicelib/assert.cpp b/sycl/test/devicelib/assert.cpp index 9170d2557e283..3106f7ac4d1e9 100644 --- a/sycl/test/devicelib/assert.cpp +++ b/sycl/test/devicelib/assert.cpp @@ -75,11 +75,11 @@ // // Overall this sounds stable enough. What could possibly go wrong? // -// RUN: env SYCL_PI_TRACE=1 SHOULD_CRASH=1 CL_CONFIG_USE_VECTORIZER=False SYCL_DEVICE_TYPE=CPU EXPECTED_SIGNAL=SIGABRT SKIP_IF_NO_EXT=1 %t.out 2>%t.stderr.native >%t.stdout.native +// RUN: env SYCL_PI_TRACE=2 SHOULD_CRASH=1 CL_CONFIG_USE_VECTORIZER=False SYCL_DEVICE_TYPE=CPU EXPECTED_SIGNAL=SIGABRT SKIP_IF_NO_EXT=1 %t.out 2>%t.stderr.native >%t.stdout.native // RUN: FileCheck %s --input-file %t.stdout.native --check-prefixes=CHECK-NATIVE || FileCheck %s --input-file %t.stderr.native --check-prefix CHECK-NOTSUPPORTED // RUN: FileCheck %s --input-file %t.stderr.native --check-prefixes=CHECK-MESSAGE || FileCheck %s --input-file %t.stderr.native --check-prefix CHECK-NOTSUPPORTED // -// RUN: env SYCL_PI_TRACE=1 SYCL_DEVICELIB_INHIBIT_NATIVE=cl_intel_devicelib_assert CL_CONFIG_USE_VECTORIZER=False SYCL_DEVICE_TYPE=CPU EXPECTED_SIGNAL=SIGSEGV %t.out >%t.stdout.pi.fallback +// RUN: env SYCL_PI_TRACE=2 SYCL_DEVICELIB_INHIBIT_NATIVE=cl_intel_devicelib_assert CL_CONFIG_USE_VECTORIZER=False SYCL_DEVICE_TYPE=CPU EXPECTED_SIGNAL=SIGSEGV %t.out >%t.stdout.pi.fallback // RUN: env SHOULD_CRASH=1 SYCL_DEVICELIB_INHIBIT_NATIVE=cl_intel_devicelib_assert CL_CONFIG_USE_VECTORIZER=False SYCL_DEVICE_TYPE=CPU EXPECTED_SIGNAL=SIGSEGV %t.out >%t.stdout.msg.fallback // RUN: FileCheck %s --input-file %t.stdout.pi.fallback --check-prefixes=CHECK-FALLBACK // RUN: FileCheck %s --input-file %t.stdout.msg.fallback --check-prefixes=CHECK-MESSAGE diff --git a/sycl/test/regression/image_access.cpp b/sycl/test/regression/image_access.cpp index aa9303559c422..ee9af31c630be 100644 --- a/sycl/test/regression/image_access.cpp +++ b/sycl/test/regression/image_access.cpp @@ -1,7 +1,7 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: env SYCL_DEVICE_TYPE=HOST %t.out -// RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER -// RUN: env SYCL_PI_TRACE=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER // TODO: For now PI checks are skipped for ACC device. To decide if it's good. // RUN: env %ACC_RUN_PLACEHOLDER %t.out diff --git a/sycl/test/scheduler/HostAccDestruction.cpp b/sycl/test/scheduler/HostAccDestruction.cpp index e812816ead5ac..fda1c29298c0c 100644 --- a/sycl/test/scheduler/HostAccDestruction.cpp +++ b/sycl/test/scheduler/HostAccDestruction.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -I %sycl_source_dir %s -o %t.out -// RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER //==---------------------- HostAccDestruction.cpp --------------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/sycl/test/scheduler/MemObjRemapping.cpp b/sycl/test/scheduler/MemObjRemapping.cpp index e0b49f6b94b62..04061f2a77e4c 100644 --- a/sycl/test/scheduler/MemObjRemapping.cpp +++ b/sycl/test/scheduler/MemObjRemapping.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER #include #include #include diff --git a/sycl/test/scheduler/ReleaseResourcesTest.cpp b/sycl/test/scheduler/ReleaseResourcesTest.cpp index 9fb6525efe982..b7ced5c5e59b8 100644 --- a/sycl/test/scheduler/ReleaseResourcesTest.cpp +++ b/sycl/test/scheduler/ReleaseResourcesTest.cpp @@ -1,8 +1,8 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out // RUN: env SYCL_DEVICE_TYPE=HOST %t.out -// RUN: env SYCL_PI_TRACE=1 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER -// RUN: env SYCL_PI_TRACE=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER -// RUN: env SYCL_PI_TRACE=1 %ACC_RUN_PLACEHOLDER %t.out 2>&1 %ACC_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER +// RUN: env SYCL_PI_TRACE=2 %ACC_RUN_PLACEHOLDER %t.out 2>&1 %ACC_CHECK_PLACEHOLDER // TODO: error: expected string not found in input // TODO: PI ---> pi::piProgramCreate(Context, Data, DataLen, &Program)