Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread Serguei Sokol
Le 27/03/2024 à 14:54, jesse koops a écrit : I tried that but I found the interface awkward and there was really no performance bonus. It was in the early phase of experimentation and I didn't save it, so it could very well be that I got the compiler settings wrong and simd was not used. But if

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread Vladimir Dergachev
I like assembler, and I do use SIMD intrinsincs in some of my code (not R), but sparingly. The issue is more than portability between platforms, but also portability between processors - if you write your optimized code using AVX, it might not take advantage of newer AVX512 cpus. In many

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread jesse koops
I tried that but I found the interface awkward and there was really no performance bonus. It was in the early phase of experimentation and I didn't save it, so it could very well be that I got the compiler settings wrong and simd was not used. But if that was the case, there would still be the

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread Serguei Sokol
Le 26/03/2024 à 15:51, Tomas Kalibera a écrit : On 3/26/24 10:53, jesse koops wrote: Hello R-package-devel, I recently got inspired by the rcppsimdjson package to try out simd registers. It works fantastic on my computer but I struggle to find information on how to make it portable. It

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread jesse koops
Thanks, the source of digest seems especially helpful. Ironically, I actually used only 10 or so lines with simd code in the package in a single function that is a bottleneck. It gives a very noticable performance boost, even with unaligned vectors, and something about directly using processor

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread Dirk Eddelbuettel
On 27 March 2024 at 08:48, jesse koops wrote: | Thank you, I was not aware of the easy way to search CRAN. I looked at | rcppsimdjson of course, but couldn't figure it out since it is done in | the simdjson library if interpret it correclty, not within the R | ecosystem and I didn't know how

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread jesse koops
Thank you, I was not aware of the easy way to search CRAN. I looked at rcppsimdjson of course, but couldn't figure it out since it is done in the simdjson library if interpret it correclty, not within the R ecosystem and I didn't know how that would change things. Writing R extensions assumes a

Re: [R-pkg-devel] using portable simd instructions

2024-03-27 Thread jesse koops
Thank you very much, that looks promising. Though if I look at your congigure.ac script, also extremely daunting and far above my current level of understanding. I guess I'll start with the autoconf manual then. Op di 26 mrt 2024 om 16:04 schreef Vincent Dorie : > > Hi Jesse, > > What I've done

Re: [R-pkg-devel] using portable simd instructions

2024-03-26 Thread Vincent Dorie
Hi Jesse, What I've done is to use a mix of compile-time detection of compiler SIMD support and run-time detection of SIMD hardware support. At package load, SIMD-specific versions of functions are installed in a symbol table. It's not perfect and it can be hard to support evolving platforms,

Re: [R-pkg-devel] using portable simd instructions

2024-03-26 Thread Tomas Kalibera
On 3/26/24 10:53, jesse koops wrote: Hello R-package-devel, I recently got inspired by the rcppsimdjson package to try out simd registers. It works fantastic on my computer but I struggle to find information on how to make it portable. It doesn't help in this case that R and Rcpp make

Re: [R-pkg-devel] using portable simd instructions

2024-03-26 Thread Dirk Eddelbuettel
On 26 March 2024 at 10:53, jesse koops wrote: | How can I make this portable and CRAN-acceptable? But writing (or borrowing ?) some hardware detection via either configure / autoconf or cmake. This is no different than other tasks decided at install-time. Start with 'Writing R Extensions', as

[R-pkg-devel] using portable simd instructions

2024-03-26 Thread jesse koops
Hello R-package-devel, I recently got inspired by the rcppsimdjson package to try out simd registers. It works fantastic on my computer but I struggle to find information on how to make it portable. It doesn't help in this case that R and Rcpp make including Cpp code so easy that I have never had