simde icon indicating copy to clipboard operation
simde copied to clipboard

rdtsc (feature request)

Open jeffhammond opened this issue 2 years ago • 2 comments

I find _rdtsc, __rdtsc, and/or _rdtscp in a lot of code that uses x86 intrinsics.

I requested this feature from SSE2Neon (https://github.com/DLTcollab/sse2neon/issues/472) and some folks suggested an implementation for ARM.

A PowerPC implementation is https://www.mcs.anl.gov/~kazutomo/rdtsc.h (I can ask the author to contribute to avoid any license questions).

Thanks.

jeffhammond avatar Feb 18 '22 09:02 jeffhammond

rdtsc may be a better fit for the builtin module in portable-snippets. It's mostly focused on generic built-ins (i.e., __builtin_bswap32 not _byteswap_ulong), but there are a few x86-style instrinsics as well (including _byteswap_ulong).

I'm not sure I want to be adding too many non-SIMD intrinsics to SIMDe; _mm_malloc etc. make sense, but rdtsc makes less sense... I'm not saying "no" yet, but I'm leaning in that direction.

Another possibility would be a new project for the non-SIMD intrinsics. I'd be happy to fold the builtins module from psnip into that project, of course, and we could steal from SIMDe when it made sense (things like CPU detection). There is even an obvious name for the project: "extrinsic" ;)

What does everyone else think?

nemequ avatar Feb 18 '22 14:02 nemequ

I find that usage of RDTSC correlates strongly with SIMD intrinsics, and I like to minimize the number of dependencies I have to include, so I'd vote to just pull this small set of features into this project, the way SSE2Neon has done, but as I'm probably not going to be the one doing the work, my vote should be scaled appropriately.

On the other hand, if "extrinsic" were a git submodule of simde, I probably wouldn't notice, but I'm not a huge fan of git submodules in general.

jeffhammond avatar Mar 23 '22 09:03 jeffhammond