Skip to content

Commit 990b1d1

Browse files
authored
[ESIMD]Replace use of vc intrinsic with spirv extension for rdtsc API (#13536)
1 parent 572aa5c commit 990b1d1

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10428,6 +10428,7 @@ static void getOtherSPIRVTransOpts(Compilation &C,
1042810428
",+SPV_INTEL_fpga_invocation_pipelining_attributes"
1042910429
",+SPV_INTEL_fpga_latency_control"
1043010430
",+SPV_INTEL_task_sequence"
10431+
",+SPV_KHR_shader_clock"
1043110432
",+SPV_INTEL_bindless_images";
1043210433
ExtArg = ExtArg + DefaultExtArg + INTELExtArg;
1043310434
if (C.getDriver().IsFPGAHWMode())

clang/test/Driver/sycl-spirv-ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// CHECK-DEFAULT-SAME:,+SPV_INTEL_fpga_invocation_pipelining_attributes
4949
// CHECK-DEFAULT-SAME:,+SPV_INTEL_fpga_latency_control
5050
// CHECK-DEFAULT-SAME:,+SPV_INTEL_task_sequence
51+
// CHECK-DEFAULT-SAME:,+SPV_KHR_shader_clock
5152
// CHECK-DEFAULT-SAME:,+SPV_INTEL_bindless_images
5253
// CHECK-DEFAULT-SAME:,+SPV_INTEL_token_type
5354
// CHECK-DEFAULT-SAME:,+SPV_INTEL_bfloat16_conversion
@@ -125,4 +126,3 @@
125126
// CHECK-CPU-SAME:,+SPV_KHR_non_semantic_info
126127
// CHECK-CPU-SAME:,+SPV_KHR_cooperative_matrix
127128
// CHECK-CPU-SAME:,+SPV_INTEL_fp_max_error"
128-

sycl/include/CL/__spirv/spirv_ops.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ __CLC_BF16_SCAL_VEC(uint32_t)
12801280

12811281
extern __DPCPP_SYCL_EXTERNAL int32_t __spirv_BuiltInGlobalHWThreadIDINTEL();
12821282
extern __DPCPP_SYCL_EXTERNAL int32_t __spirv_BuiltInSubDeviceIDINTEL();
1283+
extern __DPCPP_SYCL_EXTERNAL uint64_t __spirv_ReadClockKHR(int);
12831284

12841285
template <typename from, typename to>
12851286
extern __DPCPP_SYCL_EXTERNAL

sycl/include/sycl/ext/intel/esimd/detail/math_intrin.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ __ESIMD_INTRIN __ESIMD_raw_vec_t(T1, N)
244244
__esimd_ssdp4a_sat(__ESIMD_raw_vec_t(T2, N) src0,
245245
__ESIMD_raw_vec_t(T3, N) src1,
246246
__ESIMD_raw_vec_t(T4, N) src2) __ESIMD_INTRIN_END;
247-
__ESIMD_INTRIN __ESIMD_raw_vec_t(uint32_t, 4)
248-
__esimd_timestamp() __ESIMD_INTRIN_END;
249247

250248
template <typename T0, typename T1, int SZ>
251249
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)

sycl/include/sycl/ext/intel/esimd/math.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,8 +1844,11 @@ __ESIMD_API uint32_t subb(uint32_t &borrow, uint32_t src0, uint32_t src1) {
18441844
/// rdtsc - get the value of timestamp counter.
18451845
/// @return the current value of timestamp counter
18461846
__ESIMD_API uint64_t rdtsc() {
1847-
__ESIMD_NS::simd<uint32_t, 4> retv = __esimd_timestamp();
1848-
return retv.template bit_cast_view<uint64_t>()[0];
1847+
#ifdef __SYCL_DEVICE_ONLY__
1848+
return __spirv_ReadClockKHR(0);
1849+
#else
1850+
__ESIMD_UNSUPPORTED_ON_HOST;
1851+
#endif
18491852
}
18501853

18511854
/// @} sycl_esimd_math

0 commit comments

Comments
 (0)