Re: LW compiler optimizations
"Marco Antoniotti (as marco dot antoniotti at unimib dot it)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <CAG0Nw2mJis=8Cn3zP8_rcSY9fnEwPZVrM-4Hk9jJsCnR_hVMCg@mail.gmail.com> |
Julia has similar constructs. You can even choose whether to "broadcast"
or not.
E.g.,
julia> *sin.([1, 2, 3])* # Note the dot '.'.
3-element Vector{Float64}:
0.8414709848078965
0.9092974268256817
0.1411200080598672
Which is nice. After all, Julia is a Common Lisp in a drag 😁😁😁
MA
On Tue, Jan 14, 2025 at 8:50 AM 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.
>
> D Slices - D Programming Language
> <https://dlang.org/articles/d-array-article.html>
> dlang.org <https://dlang.org/articles/d-array-article.html>
> [image: favicon.ico] <https://dlang.org/articles/d-array-article.html>
> <https://dlang.org/articles/d-array-article.html>
>
>
--
Marco Antoniotti, Professor, Director tel. +39 - 02 64 48 79 01
DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY
favicon.ico
(application/octet-stream, 33.7 KB) - not displayed