Skip to content

Commit f673854

Browse files
authored
[SYCLomatic] Fix a bug that the result of get_max_clock_frequency is in MHz while should be in kHz (#828)
cudaDeviceProp::clockRate is in kHz while the result of sycl::device::get_info<sycl::info::device::max_clock_frequency> is in MHz. Multiplying with a thousand in helper function to fix the gap. Signed-off-by: Ni, Wenhui <[email protected]>
1 parent d0d6a24 commit f673854

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/runtime/dpct-rt/include/device.hpp.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ public:
629629
// Device|device_info_get_max_clock_frequency
630630
// DPCT_DEPENDENCY_END
631631
// DPCT_CODE
632+
/// Return the maximum clock frequency of this device in KHz.
632633
int get_max_clock_frequency() const {
633634
return get_device_info().get_max_clock_frequency();
634635
}
@@ -785,7 +786,7 @@ public:
785786
this->has(sycl::aspect::usm_host_allocations));
786787

787788
prop.set_max_clock_frequency(
788-
get_info<sycl::info::device::max_clock_frequency>());
789+
get_info<sycl::info::device::max_clock_frequency>() * 1000);
789790

790791
prop.set_max_compute_units(
791792
get_info<sycl::info::device::max_compute_units>());

clang/test/dpct/helper_files_ref/include/device.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ class device_ext : public sycl::device {
252252
return get_device_info().get_max_compute_units();
253253
}
254254

255+
/// Return the maximum clock frequency of this device in KHz.
255256
int get_max_clock_frequency() const {
256257
return get_device_info().get_max_clock_frequency();
257258
}
@@ -322,7 +323,7 @@ class device_ext : public sycl::device {
322323
this->has(sycl::aspect::usm_host_allocations));
323324

324325
prop.set_max_clock_frequency(
325-
get_info<sycl::info::device::max_clock_frequency>());
326+
get_info<sycl::info::device::max_clock_frequency>() * 1000);
326327

327328
prop.set_max_compute_units(
328329
get_info<sycl::info::device::max_compute_units>());

0 commit comments

Comments
 (0)