Skip to content

[SYCL][NFC] Reflect the "allowlist" renaming in the code #1480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct DevDescT {
int platformVerSize = 0;
};

static std::vector<DevDescT> getWhiteListDesc() {
static std::vector<DevDescT> getAllowListDesc() {
const char *str = SYCLConfig<SYCL_DEVICE_ALLOWLIST>::get();
if (!str)
return {};
Expand Down Expand Up @@ -101,15 +101,13 @@ static std::vector<DevDescT> getWhiteListDesc() {
}

if (':' != *str)
throw sycl::runtime_error("Malformed device white list",
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 white list",
PI_INVALID_VALUE);
throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE);

// Skip opening sequence "{{"
str += 2;
Expand All @@ -121,8 +119,7 @@ static std::vector<DevDescT> getWhiteListDesc() {
++str;

if ('\0' == *str)
throw sycl::runtime_error("Malformed device white list",
PI_INVALID_VALUE);
throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE);

*size = str - *valuePtr;

Expand All @@ -136,20 +133,18 @@ static std::vector<DevDescT> getWhiteListDesc() {
if ('|' == *str)
decDescs.emplace_back();
else if (',' != *str)
throw sycl::runtime_error("Malformed device white list",
PI_INVALID_VALUE);
throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE);

++str;
}

return decDescs;
}

static void filterWhiteList(vector_class<RT::PiDevice> &PiDevices,
RT::PiPlatform PiPlatform,
const plugin &Plugin) {
const std::vector<DevDescT> WhiteList(getWhiteListDesc());
if (WhiteList.empty())
static void filterAllowList(vector_class<RT::PiDevice> &PiDevices,
RT::PiPlatform PiPlatform, const plugin &Plugin) {
const std::vector<DevDescT> AllowList(getAllowListDesc());
if (AllowList.empty())
return;

const string_class PlatformName =
Expand All @@ -170,7 +165,7 @@ static void filterWhiteList(vector_class<RT::PiDevice> &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,
Expand Down Expand Up @@ -229,9 +224,9 @@ platform_impl::get_devices(info::device_type DeviceType) const {
pi::cast<RT::PiDeviceType>(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<SYCL_DEVICE_ALLOWLIST>::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 {
Expand Down