Lisp HUG Maillist Archive

LispWorks + AVX-512?

Hello,

I was wondering if anyone has tinkered with the AVX-512 instruction
set and could recommend best practices for writing LispWorks programs
that make efficient use of SSE/AVX intrinsics.

This is far from a complete thought, but I was thinking about
something like this as a starting point:

1. Write a C library exposing an API to whichever SSE/AVX intrinsics
you care about using and compile it.
2. Link that C library into the Lisp image via LispWorks' foreign
language interface.
3. Using LispWorks' "compiler" package, write domain-specific compiler
transforms that somehow expand into calls to the aforementioned C
library when appropriate.
4. ???

I am thinking that Lisp and C should probably make use of shared
memory via static (non-movable) vectors.

I have no idea where to really get started with compiler:deftransform.
Does anyone have any example code they can share?

Please correct any mistaken assumptions I have made in this post.

Thank you,
Adrian

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: LispWorks + AVX-512?

Unable to parse email body. Email id is 14704

Re: LispWorks + AVX-512?

Hi Adrian,

Here's a couple of tips about interfacing LispWorks with C...


1. Incorporating a C module with LispWorks

LispWorks has a great feature where you can easily compile and embed a C module. As an example, please have have a look at this project I published on GitHub:
https://github.com/tuscland/lw-serial-port

The defsystem describes how to compile the C file, it is quite simple:
https://github.com/tuscland/lw-serial-port/blob/master/defsystem.lisp

And here is how to load an embedded module:
https://github.com/tuscland/lw-serial-port/blob/master/src/macosx/serial-device.lisp



2. Generting FLI definitions from C headers

LispWorks has a C parser that can automatically generate FLI code from the headers. I successfully used it in the past (it may or may not be useful to you, depending on your specific workflow):

http://www.lispworks.com/documentation/lw60/FLI/html/fli-186.htm



Cam


> On 1 Jan 2018, at 17:38, Adrian Medina <adrian.medina@mail.yu.edu> wrote:
> 
> Hello,
> 
> I was wondering if anyone has tinkered with the AVX-512 instruction
> set and could recommend best practices for writing LispWorks programs
> that make efficient use of SSE/AVX intrinsics.
> 
> This is far from a complete thought, but I was thinking about
> something like this as a starting point:
> 
> 1. Write a C library exposing an API to whichever SSE/AVX intrinsics
> you care about using and compile it.
> 2. Link that C library into the Lisp image via LispWorks' foreign
> language interface.
> 3. Using LispWorks' "compiler" package, write domain-specific compiler
> transforms that somehow expand into calls to the aforementioned C
> library when appropriate.
> 4. ???
> 
> I am thinking that Lisp and C should probably make use of shared
> memory via static (non-movable) vectors.
> 
> I have no idea where to really get started with compiler:deftransform.
> Does anyone have any example code they can share?
> 
> Please correct any mistaken assumptions I have made in this post.
> 
> Thank you,
> Adrian
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:30 UTC