KhronosGroup / SYCL-Docs

SYCL Open Source Specification
Other
110 stars 67 forks source link

Time functions #385

Open zjin-lcf opened 1 year ago

zjin-lcf commented 1 year ago

Time functions (e.g. clock() and clock64()) may be added to the SYCL specification.

Reference http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#time-function

keryell commented 1 year ago

Perhaps adding something more modern C++ than a cycle count? What happens if the the frequency change? What if this feature is not provided by the hardware? You can use some CUDA interoperability mode in the meantime if an implementation provides it.

nliber commented 1 year ago

I agree with @keryell here.

zjin-lcf commented 1 year ago

If you have better ideas about the support of the time() function. Please add it to the SYCL spec.

I don't understand the point of "not provided by hardware". Will a feature in the specification exist after it is provided by hardware?

I understand that the SYCL specification is creative work by people. For the time() function, it is catching up with CUDA/HIP.

keryell commented 1 year ago

Sure. But Khronos is not targeting CUDA or a clone. This is why the standards target common hardware features only and address others with some Khronos or vendor extensions. I do not think it is available in OpenCL C kernel language either. On an FPGA you could make one by yourself, by adding a clock kernel connected by some SYCL pipes (Intel extension) and just incrementing a counter forever. :-) Or on GPU by a kernel you launch and forget which would increment atomically a counter in a buffer or a global device variable (Intel extension).

jinz2014 commented 6 months ago

https://nvidia.github.io/cccl/libcudacxx/standard_api/time_library/chrono.html