Skip to content

[SYCL] Remove FPGA from ONEAPI_DEVICE_SELECTOR and SYCL_DEVICE_ALLOWLIST #19296

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

Draft
wants to merge 5 commits into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions sycl/source/detail/allowlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
// described in SyclBeMap
ValidateEnumValues(BackendNameKeyName, getSyclBeMap());
ValidateEnumValues(DeviceTypeKeyName,
getSyclDeviceTypeMap<true /*Enable 'acc'*/>());
getSyclDeviceTypeMap());

if (Key == DeviceVendorIdKeyName) {
// DeviceVendorId should have hex format
Expand Down Expand Up @@ -417,13 +417,17 @@ void applyAllowList(std::vector<ur_device_handle_t> &UrDevices,
break;
}
for (const auto &SyclDeviceType :
getSyclDeviceTypeMap<true /*Enable 'acc'*/>()) {
getSyclDeviceTypeMap()) {
if (SyclDeviceType.second == DeviceType) {
const auto &DeviceTypeValue = SyclDeviceType.first;
DeviceDesc[DeviceTypeKeyName] = DeviceTypeValue;
break;
}
}
// TEMPORARILY NEEDED WHILE FPGA IS REMOVED FROM getSyclDeviceTypeMap, but
// is still visible by the UR
if (DeviceDesc.find(DeviceTypeKeyName) == DeviceDesc.end())
DeviceDesc[DeviceTypeKeyName] = "INVALID DEVICE";
// get DeviceVendorId value and put it to DeviceDesc
uint32_t DeviceVendorIdUInt =
DeviceImpl.get_info<info::device::vendor_id>();
Expand Down
5 changes: 1 addition & 4 deletions sycl/source/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ getSyclDeviceTypeMap() {
{{"host", info::device_type::host},
{"cpu", info::device_type::cpu},
{"gpu", info::device_type::gpu},
/* Duplicate entries are fine as this map is one-directional.*/
{supportAcc ? "acc" : "fpga", info::device_type::accelerator},
{"fpga", info::device_type::accelerator},
{"*", info::device_type::all}}};
return SyclDeviceTypeMap;
}
Expand Down Expand Up @@ -485,7 +482,7 @@ template <> class SYCLConfig<SYCL_REDUCTION_PREFERRED_WORKGROUP_SIZE> {
return Result;

std::string ValueStr{ValueRaw};
auto DeviceTypeMap = getSyclDeviceTypeMap<true /*Enable 'acc'*/>();
auto DeviceTypeMap = getSyclDeviceTypeMap();

// Iterate over all configurations.
size_t Start = 0, End = 0;
Expand Down
16 changes: 3 additions & 13 deletions sycl/source/device_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ __SYCL_EXPORT int default_selector_v(const device &dev) {
if (dev.is_cpu())
Score += 300;

// Since we deprecate SYCL_BE and SYCL_DEVICE_TYPE,
// we should not disallow accelerator to be chosen.
// But this device type gets the lowest heuristic point.
if (dev.is_accelerator())
Score += 75;
Score = detail::REJECT_DEVICE_SCORE;

// Add preference score.
Score += detail::getDevicePreference(dev);
Expand Down Expand Up @@ -220,15 +217,8 @@ __SYCL_EXPORT int cpu_selector_v(const device &dev) {
return Score;
}

__SYCL_EXPORT int accelerator_selector_v(const device &dev) {
int Score = detail::REJECT_DEVICE_SCORE;

traceDeviceSelector("info::device_type::accelerator");
if (dev.is_accelerator()) {
Score = 1000;
Score += detail::getDevicePreference(dev);
}
return Score;
__SYCL_EXPORT int accelerator_selector_v(const device &) {
return detail::REJECT_DEVICE_SCORE;
}

__SYCL_EXPORT detail::DSelectorInvocableType
Expand Down
5 changes: 2 additions & 3 deletions sycl/unittests/allowlist/ParseAllowList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ TEST(ParseAllowListTests, CheckAllValidBackendNameValuesAreProcessed) {
TEST(ParseAllowListTests, CheckAllValidDeviceTypeValuesAreProcessed) {
std::string AllowList;
for (const auto &SyclDeviceType :
sycl::detail::getSyclDeviceTypeMap<true /*Enable 'acc'*/>()) {
sycl::detail::getSyclDeviceTypeMap()) {
if (!AllowList.empty())
AllowList += "|";
AllowList += "DeviceType:" + SyclDeviceType.first;
Expand All @@ -186,8 +186,7 @@ TEST(ParseAllowListTests, CheckAllValidDeviceTypeValuesAreProcessed) {
sycl::detail::parseAllowList(AllowList);
sycl::detail::AllowListParsedT ExpectedValue{
{{"DeviceType", "host"}}, {{"DeviceType", "cpu"}},
{{"DeviceType", "gpu"}}, {{"DeviceType", "acc"}},
{{"DeviceType", "fpga"}}, {{"DeviceType", "*"}}};
{{"DeviceType", "gpu"}}, {{"DeviceType", "*"}}};
EXPECT_EQ(ExpectedValue, ActualValue);
}

Expand Down
Loading