Re: LW compiler optimizations

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
That operation is exactly the MAC that we are talking about. And Apple’s vDSP probably does use low-grade SIMD in the CPU to pull this off. That’s probably how I can get an effective speed of 0.44 ns / pair. 

And so, I forgot to mention the other use case - Neural Networks, alongside cryptography, DSP, and others. MAC is so useful in so many areas. Today’s languages really ought to be making overt allowances for it.

I thought about using it for general polynomial evaluation, but then not. Sometimes we need to prefer one order or another to preserve accuracy in the summation.

> On Jan 14, 2025, at 00:48, Yuri Davidovsky (as work at disclosure dot ie) <[email protected]> wrote:
> 
> 
> 
>> On 14 Jan 2025, at 07:56, Christopher Stacy (as cstacy at dtpq dot com) <[email protected]> wrote:
>> 
>> I don't do any DSP programming,  but it seems like a standard interface for MAC could be useful Apparently C has a standard interface called "fma()". Most computers have hardware for this. In addition, some higher level interfaces could also be standardized, where the operating system or other libraries are (FFI or otherwise) called.
> 
> D lang does it in a very elegant way without even advertising it, and it took me by surprise. I was playing with some neural network code in it a while back, and was seeing some performance that literally should not have been possible on that machine, multiples of the clock speed.
> 
> That got me puzzled.
> 
> What I was doing is the array operations, similar to
> 
> a += b * c
> 
> where a, b and c are arrays. First it only seemed like a syntactic piece of sugar, but it turned out that the compiler vectorised the operations using SIMD operations behind the scenes. If those were not present, it would not matter, the compiler would simply fall back to the scalar operations.
> 
> It was quite remarkable how smoothly it was designed and implemented, you literally had to know nothing of simd programming and it would work, if I were writing my own statically typed language, that would be my go-to example.
> 
> Another feature of the language that got me impressed was array slicing, which was also extremely well optimised and worked seamlessly. One would simply had to use expressions like
> 
> a[8..72] += b[8..72] * c [8..72]
> 
> and it would work.
> 
> https://dlang.org/articles/d-array-article.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.