-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL][CUDA] Minor fixes required to run BabelStream benchmarks on CUDA #1543
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
Changes from all commits
1757da8
aa384ae
f910c93
195414f
5f611cb
09b9859
a907581
ac3b6f8
70a3e08
a659354
17480e0
66810be
ad3951c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -196,6 +196,40 @@ static void filterAllowList(vector_class<RT::PiDevice> &PiDevices, | |||||||||||||||||||||||||||||||||||||||
PiDevices.resize(InsertIDx); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
// @return True if the device is invalid for the current backend preferences | ||||||||||||||||||||||||||||||||||||||||
static bool isDeviceInvalidForBe(const device &Device) { | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if (Device.is_host()) | ||||||||||||||||||||||||||||||||||||||||
return false; | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
// Retrieve Platform version to identify CUDA OpenCL platform | ||||||||||||||||||||||||||||||||||||||||
// String: OpenCL 1.2 CUDA <version> | ||||||||||||||||||||||||||||||||||||||||
const platform platform = Device.get_info<info::device::platform>(); | ||||||||||||||||||||||||||||||||||||||||
const std::string platformVersion = | ||||||||||||||||||||||||||||||||||||||||
platform.get_info<info::platform::version>(); | ||||||||||||||||||||||||||||||||||||||||
const bool HasOpenCL = (platformVersion.find("OpenCL") != std::string::npos); | ||||||||||||||||||||||||||||||||||||||||
const bool HasCUDA = (platformVersion.find("CUDA") != std::string::npos); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
backend *PrefBackend = detail::SYCLConfig<detail::SYCL_BE>::get(); | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Let's move this like after rejecting NVIDIA OpenCL impementation. |
||||||||||||||||||||||||||||||||||||||||
auto DeviceBackend = detail::getSyclObjImpl(Device)->getPlugin().getBackend(); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
// Reject the NVIDIA OpenCL implementation | ||||||||||||||||||||||||||||||||||||||||
if (DeviceBackend == backend::opencl && HasCUDA && HasOpenCL) | ||||||||||||||||||||||||||||||||||||||||
return true; | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
// If no preference, assume OpenCL and reject CUDA | ||||||||||||||||||||||||||||||||||||||||
if (DeviceBackend == backend::cuda && !PrefBackend) { | ||||||||||||||||||||||||||||||||||||||||
return true; | ||||||||||||||||||||||||||||||||||||||||
} else if (!PrefBackend) | ||||||||||||||||||||||||||||||||||||||||
return false; | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
// If using PI_OPENCL, reject the CUDA backend | ||||||||||||||||||||||||||||||||||||||||
if (DeviceBackend == backend::cuda && *PrefBackend == backend::opencl) | ||||||||||||||||||||||||||||||||||||||||
return true; | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
return false; | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
Comment on lines
+220
to
+231
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
From the PR description, this piece of code seems to be "not required to run BabelStream benchmarks on CUDA" and removing NVIDIA OpenCL implementation is enough. Right? If so, @Ruyk, can we move this part to a separate PR to make @hiaselhans happy? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, i'll split out the changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually, babel stream doesnt use a device selector but a device list, so the NVIDIA OpenCL still appears. There are other workarounds I can do so not a problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
thanks @bader 😄 Line 54 in cf65794
just saying we're re-implementing things already implemented somewhere else... |
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
vector_class<device> | ||||||||||||||||||||||||||||||||||||||||
platform_impl::get_devices(info::device_type DeviceType) const { | ||||||||||||||||||||||||||||||||||||||||
vector_class<device> Res; | ||||||||||||||||||||||||||||||||||||||||
|
@@ -211,6 +245,7 @@ platform_impl::get_devices(info::device_type DeviceType) const { | |||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
pi_uint32 NumDevices; | ||||||||||||||||||||||||||||||||||||||||
const detail::plugin &Plugin = getPlugin(); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
Plugin.call<PiApiKind::piDevicesGet>( | ||||||||||||||||||||||||||||||||||||||||
MPlatform, pi::cast<RT::PiDeviceType>(DeviceType), 0, | ||||||||||||||||||||||||||||||||||||||||
pi::cast<RT::PiDevice *>(nullptr), &NumDevices); | ||||||||||||||||||||||||||||||||||||||||
|
@@ -235,6 +270,9 @@ platform_impl::get_devices(info::device_type DeviceType) const { | |||||||||||||||||||||||||||||||||||||||
PiDevice, std::make_shared<platform_impl>(*this))); | ||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
Res.erase(std::remove_if(Res.begin(), Res.end(), isDeviceInvalidForBe), | ||||||||||||||||||||||||||||||||||||||||
Res.end()); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
return Res; | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.