-
Notifications
You must be signed in to change notification settings - Fork 768
[SYCL][CUDA] atomic_ref.fetch_add used for fp64 reduction if device.has(atomic64) #3950
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Changes from 1 commit
f95f28c
80c8508
b1a8a7d
70a2c54
ab8a600
49ec72a
3b4bc5b
b4bde0c
6a0f948
24ee26e
471ccde
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 |
---|---|---|
|
@@ -38,7 +38,8 @@ enum class aspect { | |
ext_intel_gpu_subslices_per_slice = 22, | ||
ext_intel_gpu_eu_count_per_subslice = 23, | ||
ext_intel_max_mem_bandwidth = 24, | ||
ext_intel_mem_channel = 25 | ||
ext_intel_mem_channel = 25, | ||
atomic64 = 26 | ||
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. Technically, there are |
||
}; | ||
|
||
} // namespace sycl | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,28 @@ template <> struct get_device_info<bool, info::device::queue_profiling> { | |
} | ||
}; | ||
|
||
// Specialization for atomic64 that is necessary because | ||
// PI_DEVICE_INFO_ATOMIC_64 isn't implemented for backend other than cuda. | ||
// TODO the if-statement can be removed when the other backends support | ||
// PI_DEVICE_INFO_ATOMIC_64. | ||
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. see comment below, just allow backend to "not know" the value and gracefully react to an error 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. OK thanks. Done. |
||
template <> struct get_device_info<bool, info::device::atomic64> { | ||
static bool get(RT::PiDevice dev, const plugin &Plugin) { | ||
|
||
bool result = false; | ||
|
||
platform plt = | ||
get_device_info<platform, info::device::platform>::get(dev, Plugin); | ||
|
||
if (plt.get_backend() == backend::cuda) { | ||
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. instead of checking for "cuda" here you should run for any backend, but allow errors (from backends that don't support it), and gracefully return false. 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 for the suggestion. I've implemented this as suggested. |
||
Plugin.call<PiApiKind::piDeviceGetInfo>( | ||
dev, pi::cast<RT::PiDeviceInfo>(info::device::atomic64), | ||
sizeof(result), &result, nullptr); | ||
} | ||
|
||
return (result); | ||
} | ||
}; | ||
|
||
// Specialization for exec_capabilities, OpenCL returns a bitfield | ||
template <> | ||
struct get_device_info<vector_class<info::execution_capability>, | ||
|
@@ -613,6 +635,10 @@ template <> inline bool get_device_info_host<info::device::image_support>() { | |
return true; | ||
} | ||
|
||
template <> inline bool get_device_info_host<info::device::atomic64>() { | ||
return false; | ||
} | ||
|
||
template <> | ||
inline cl_uint get_device_info_host<info::device::max_read_image_args>() { | ||
// current value is the required minimum | ||
|
Uh oh!
There was an error while loading. Please reload this page.