From 8ea56ff5f781193e9471d8778c4e31b2ebe277af Mon Sep 17 00:00:00 2001 From: Artem Gindinson Date: Mon, 6 Apr 2020 08:49:56 +0300 Subject: [PATCH 1/2] [SYCL][NFC] Reflect the "allowlist" renaming in the code This should finalize the renaming introduced by [4df18fa2623b86d], making the whole setting more consistent. Signed-off-by: Artem Gindinson --- sycl/source/detail/platform_impl.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index ac0274c0bd4c7..c792a6525a430 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -65,7 +65,7 @@ struct DevDescT { int platformVerSize = 0; }; -static std::vector getWhiteListDesc() { +static std::vector getAllowListDesc() { const char *str = SYCLConfig::get(); if (!str) return {}; @@ -101,14 +101,14 @@ static std::vector getWhiteListDesc() { } if (':' != *str) - throw sycl::runtime_error("Malformed device white list", + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); // Skip ':' str += 1; if ('{' != *str || '{' != *(str + 1)) - throw sycl::runtime_error("Malformed device white list", + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); // Skip opening sequence "{{" @@ -121,7 +121,7 @@ static std::vector getWhiteListDesc() { ++str; if ('\0' == *str) - throw sycl::runtime_error("Malformed device white list", + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); *size = str - *valuePtr; @@ -136,7 +136,7 @@ static std::vector getWhiteListDesc() { if ('|' == *str) decDescs.emplace_back(); else if (',' != *str) - throw sycl::runtime_error("Malformed device white list", + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); ++str; @@ -145,11 +145,11 @@ static std::vector getWhiteListDesc() { return decDescs; } -static void filterWhiteList(vector_class &PiDevices, +static void filterAllowList(vector_class &PiDevices, RT::PiPlatform PiPlatform, const plugin &Plugin) { - const std::vector WhiteList(getWhiteListDesc()); - if (WhiteList.empty()) + const std::vector AllowList(getAllowListDesc()); + if (AllowList.empty()) return; const string_class PlatformName = @@ -170,7 +170,7 @@ static void filterWhiteList(vector_class &PiDevices, const string_class DeviceDriverVer = sycl::detail::get_device_info< string_class, info::device::driver_version>::get(Device, Plugin); - for (const DevDescT &Desc : WhiteList) { + for (const DevDescT &Desc : AllowList) { if (nullptr != Desc.platformName && !std::regex_match(PlatformName, std::regex(std::string(Desc.platformName, @@ -229,9 +229,9 @@ platform_impl::get_devices(info::device_type DeviceType) const { pi::cast(DeviceType), NumDevices, PiDevices.data(), nullptr); - // Filter out devices that are not present in the white list + // Filter out devices that are not present in the allowlist if (SYCLConfig::get()) - filterWhiteList(PiDevices, MPlatform, this->getPlugin()); + filterAllowList(PiDevices, MPlatform, this->getPlugin()); std::transform(PiDevices.begin(), PiDevices.end(), std::back_inserter(Res), [this](const RT::PiDevice &PiDevice) -> device { From 88b006a36ffa555839dbf70923280eaaab075a8b Mon Sep 17 00:00:00 2001 From: Artem Gindinson Date: Mon, 6 Apr 2020 09:30:55 +0300 Subject: [PATCH 2/2] Apply clang-format Signed-off-by: Artem Gindinson --- sycl/source/detail/platform_impl.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index c792a6525a430..10fd2d0fc9aa2 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -101,15 +101,13 @@ static std::vector getAllowListDesc() { } if (':' != *str) - throw sycl::runtime_error("Malformed device allowlist", - PI_INVALID_VALUE); + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); // Skip ':' str += 1; if ('{' != *str || '{' != *(str + 1)) - throw sycl::runtime_error("Malformed device allowlist", - PI_INVALID_VALUE); + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); // Skip opening sequence "{{" str += 2; @@ -121,8 +119,7 @@ static std::vector getAllowListDesc() { ++str; if ('\0' == *str) - throw sycl::runtime_error("Malformed device allowlist", - PI_INVALID_VALUE); + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); *size = str - *valuePtr; @@ -136,8 +133,7 @@ static std::vector getAllowListDesc() { if ('|' == *str) decDescs.emplace_back(); else if (',' != *str) - throw sycl::runtime_error("Malformed device allowlist", - PI_INVALID_VALUE); + throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE); ++str; } @@ -146,8 +142,7 @@ static std::vector getAllowListDesc() { } static void filterAllowList(vector_class &PiDevices, - RT::PiPlatform PiPlatform, - const plugin &Plugin) { + RT::PiPlatform PiPlatform, const plugin &Plugin) { const std::vector AllowList(getAllowListDesc()); if (AllowList.empty()) return;