<zwr>
ugh cl-launch takes 300-500ms to launch a program while hardcoding SBCL takes <10ms
theruran has joined #commonlisp
<zwr>
maybe a cl-launch written in a fast language (it's written in Shell) that just picks whatever implementation it finds first could have insignificant runtime
Pixel_Outlaw has joined #commonlisp
<zwr>
although the script itself is rather complex and does way more than simply pick any implementation available
troojg has quit [Ping timeout: 252 seconds]
edgar-rft` has joined #commonlisp
edgar-rft_ has quit [Ping timeout: 252 seconds]
<aeth>
why not a script that generates a script that hardcodes SBCL, but could also generate one that hardcodes CCL, etc.?
<Bubblegumdrop>
I mostly just end up using uiop:launch-program
<zwr>
I want something as easy to run as a bash script. No jumping through a dozen hoops to get it to work, just "./whatever.sh" or "./whatever.lisp"
<zwr>
but also that doesn't repeat the "time yt-dlp --help > /dev/null" experience
<zwr>
$ time yt-dlp --help > /dev/null 0m01.59s real 0m00.44s user 0m00.13s system
<Bubblegumdrop>
funnily enough I build lisp apps in docker containers to get them to "run anywhere"
<aeth>
what I do when I don't want it as an executable (which bundles the implementation with it) is I make a one-liner shell script that launches a trivial .lisp file that loads an ASDF system
alcor` has joined #commonlisp
<Bubblegumdrop>
that's basically my build step for my containers
<aeth>
it's two files, but it seems to be the best way to do it... and since it's a one-liner, the shell script doesn't need to exist if it's launched by something that permits shell script one liners
<aeth>
e.g. containers
alcor has quit [Ping timeout: 246 seconds]
<aeth>
If you wanted multi-implementation support, you'd just have different (trivial!) shell script entry points for each implementation, like foobar-sbcl and foobar-ccl
<aeth>
with the entry point .lisp file being portable, and only serving one purpose (loading ASDF systems)
<paulapatience>
Can we assume that generic dispatch (i.e., the time taken to reach the start of a method, not including the time the method takes to execute) is slower than calling MAKE-INSTANCE?
<zwr>
no because if I posted such a file to some random forum I'd have to say "now download this .lisp file and the right .sh script for the implementation you want and..."
<paulapatience>
By assume, I mean is it usually the case, just like structs being usually faster than classes.
<aeth>
zwr: if you were sharing a random file with random people, then you'd want something like SBCL's sb-ext:save-lisp-and-die that creates a standalone executable because CL isn't the JVM so most people won't have it installed
<zwr>
instead it should be a shebang that looks like `#!/usr/bin/env cl` and then `cl` is a program like cl-launch that picks any implementation and runs the script with it except that it doesn't take half a second to do it. Then I can tell the user "install any CL implementation and cl-launch and you can ./script.lisp and it just works"
<aeth>
otherwise, it's just two trivial (and easily auditable) files that only serve to asdf:load-system or ql:quickload something that's in some recognized directory
<zwr>
requiring a runtime is fine, every language does that, some like C just happen to have the runtime built into most systems
<aeth>
the entry-point .lisp file can be a part of the directory (but not a part of the system, since it loads the system(s)... also not needed for a launch from e.g. SLIME)
<aeth>
which then makes it a one-line (well, 3 line) shell script
<aeth>
which can do sbcl --non-interactive --load ~/path/to/entry-point.lisp
<aeth>
if it's a 50x slowdown to do it the "right way", just have 3 or 4 of those if someone doesn't want to use SBCL... languages like Python don't care about cross-implementation support
<zwr>
if I download a bash script from the net all I need is to install bash and type `./script.sh`. I can even share the script inline in any message board and the user can paste it into a file. That's a neat user experience. Having a directory with a shell file and an entry point .lisp file and having to bundle those together or having to figure out the right ccl or whatever invocation is not
<zwr>
generally, "install dependencies, then run file" is a good experience. "download this zip, extract it to a directory, setup a python venv..." is not
<aeth>
Unless you build a standalone, bundled executable (e.g. save-lisp-and-die), it afaik requires at least two files, even for standalone script that doesn't need to load an entire system. You could, if you wanted to give up portability, do #!/usr/bin/sbcl or something similar, but that's not #!/usr/bin/env sbcl, which afaik doesn't work
<aeth>
Now, you could be really evil and clever and come up with a way to put both of those "standalone" script files in one file, with a bilingual shell/CL file
<aeth>
(It doesn't necessarily require two files to load a system if you launch CL directly from the shell script by executing a Lisp command to load, quoted and properly escaped, but this is error-prone... far easier to load a file.)
<aeth>
This is because you're asking more from Common Lisp (use any implementation!) than you're asking for python (directly use `python`, i.e. C Python)
istewart has quit [Quit: Konversation terminated!]
istewart has joined #commonlisp
synchrom1 has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
<aeth>
The problem with the one-file approach is that it has to be special-cased because #! isn't normally allowed because it's a reserved-for-the-user dispatching macro character for reader macros. So something that is e.g. #!/usr/bin/sbcl run directly is some special case at the SBCL level, but it cannot also be run via sbcl --load due to the syntax.
<aeth>
writing some `#!/usr/bin/env cl` may work, but it needs to skip that line for the implementation when the file is loaded.
<aeth>
Some experimentation suggests that this works, at least for SBCL: tail -n +2 your-file.lisp | sbcl --script
<zwr>
sbcl supports the shell shebang
<zwr>
the problem you'll have is that most kernels don't split arguments to the program in the shebang
<aeth>
SBCL supports the shell shebang when you chmod +x the file and then run it directly and the shell shebang is the path to sbcl (env doesn't work because... I think it doesn't pass --non-interactive or --script, and you want either one of those two for scripts)
<zwr>
so `#!/usr/bin/env sbcl --script` will pass to env a single argument with the value "sbcl --script" and it won't find a file by that name
<zwr>
the wii recommends `#!/usr/bin/env -S sbcl --script` which tells GNU env to split arguments itself, but that only works on GNU
<zwr>
the wiki*
<aeth>
well, you can launch it with a program that, in turn, runs: tail -n +2 your-file.lisp | sbcl --script
<aeth>
because now SBCL, loading the file (not executing it where it can handle the shebang), now skips the now-invalid syntax
<aeth>
Assuming you have a cl launcher script installed to, say, /usr/bin/env cl, which knows to do that.
<aeth>
And assuming it has access to the current file name? I think shell does.
<zwr>
yeah, the program in the shebang gets the rest of the arguments in argv[1]
<aeth>
oh, right, you might also want the argv, so it's not quite as trivial
bh34e5 has quit [Read error: Connection reset by peer]
akoana has joined #commonlisp
<zwr>
I think I can figure out a Rust program with insignificant runtime that does all this and even passes argv, I just need to learn more CL, I'm only on chapter 7 of Practical Common Lisp
<aeth>
Well, the problem with argv in particular is that it's obviously not part of the standard (because more OSes than Unix exist), so it probably requires a library that uses the implementation-specific ways to get it
<zwr>
I looked that up a while ago, yes, there are packages that abstract away the nonstandard API of each implementation to provide argv
<zwr>
the basic Rust code is this https://paste.debian.net/plainh/b3f9e576 it just needs to have features added to is as needed, like doing the argument splitting because shebangs don't do that unless it's macOS
<aeth>
Another weird thing about using CL from the shell is that it's a compiled language... but the way this works in this context is that it will compile and then cache the compilation (except for the entrypoint file? Idk). So the first run might take a while.
<aeth>
Also the first run after any library/OS/implementation/etc. update
<zwr>
shebangs are weird, the kernel handles them
<zwr>
you tell the shell to exec the file, the exec() syscall tries to read a line from the file and interprets it as a shebang. it exists to specify an interpreter type program to run the file
<zwr>
problem is, it works fine on one system, but e.g. BSD will have sbcl in /usr/local/bin/sbcl, Linux will have it on /usr/bin/sbcl, so you can't have one shebang that hardcodes sbcl's path
<zwr>
so you do /usr/bin/env and pray env is there and point it at sbcl
<zwr>
that typically works, but it hardcodes sbcl
<zwr>
so you need yet another program that picks the impl
<zwr>
cl-launch works, but it's SLOW
<zwr>
also shebangs work slightly different across operating systems
<zwr>
macOS splits the shebang's argument. Linux has a 256-byte shebang length limit, others probably have a limit too I didn't check
<zwr>
others don't split arguments
istewart has quit [Quit: Konversation terminated!]
<zwr>
I also don't want to find out how long cl-launch takes on my wii
<zwr>
but I know a rust program that does the magic will manage to have insignificant runtime on any toaster
<aeth>
well, no, iirc /usr/bin/env sbcl doesn't work because iirc it won't read --script or --non-interactive, one of which is needed to not also launch a REPL (but I guess maybe you can just call sb-ext:exit at the end? seems like a hack, though)
<akoana>
what "apt" is that? apt add foo => E: Invalid operation add - did you mean "apt install"
<aeth>
zwr: your workaround to -S sbcl --script would work, but then that assumes GNU
<zwr>
akoana: I haven't used ubuntu in ~12 years I just tried to write an example others are more likely to be familiar with
<akoana>
ah, I see - so the correct apt commands are "apt install cl cl-loader" and "sudo apt install bash"
<akoana>
(sudo ... if you're not root)
<aeth>
zwr: as far as the runtime goes, the thing about CL is that (unless you use a commercial implementation) it brings the compiler with it in its runtime so it's probably not going to be minimal
<aeth>
unless someone wanted to try to implement a tree-shaker for a FOSS implementation
<akoana>
here (on debian) sbcl compiles .lisp files to .fasl files having #!/path/to/sbcl --script as the first line, so to get an "executable" one has just to chmod u+x them...
<Bubblegumdrop>
does that work?
<Bubblegumdrop>
huh, neat
<aeth>
hardcoded path, though
<akoana>
well, that's not so bad, because you'd need to re-compile anyway when you use a different sbcl version, for example after an upgrade
<akoana>
and sbcl is smart enough to resolve its own symlink to the exact absolute path for the shebang
<akoana>
no way to cheat with symlinks
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 252 seconds]
Lord_of_Life_ is now known as Lord_of_Life
shawnw has quit [Ping timeout: 248 seconds]
wacki has joined #commonlisp
wobbol has quit [Ping timeout: 276 seconds]
beach` has joined #commonlisp
beach has quit [Killed (NickServ (GHOST command used by beach`!~user@2a01:cb19:682:4600:481e:1022:37dd:bee2))]
beach` is now known as beach
akoana has quit [Quit: leaving]
wacki has quit [Ping timeout: 252 seconds]
puke has joined #commonlisp
decweb has quit [Ping timeout: 252 seconds]
treflip has joined #commonlisp
Th30n has joined #commonlisp
varjag has joined #commonlisp
amb007 has quit [Ping timeout: 246 seconds]
amb007 has joined #commonlisp
shka has joined #commonlisp
alcor` is now known as alcor
alcor has quit [Changing host]
alcor has joined #commonlisp
dinomug has quit [Remote host closed the connection]
riccardocariboni has joined #commonlisp
riccardocariboni is now known as rcs
rcs has quit [Client Quit]
Pixel_Outlaw has quit [Quit: Leaving]
riccardocariboni has joined #commonlisp
riccardocariboni has quit [Client Quit]
riccardocariboni has joined #commonlisp
riccardocariboni has quit [Remote host closed the connection]
King_julian has joined #commonlisp
shawnw has joined #commonlisp
annamalai has quit [Ping timeout: 260 seconds]
jadzi has joined #commonlisp
annamalai has joined #commonlisp
shawnw has quit [Ping timeout: 244 seconds]
annamalai has quit [Ping timeout: 252 seconds]
mishoo has joined #commonlisp
annamalai has joined #commonlisp
varjag has quit [Ping timeout: 252 seconds]
pillton has quit [Ping timeout: 250 seconds]
jadzi has quit [Ping timeout: 252 seconds]
Lord_of_Life has quit [Ping timeout: 246 seconds]
awlygj has joined #commonlisp
Lord_of_Life has joined #commonlisp
King_julian has quit [Ping timeout: 244 seconds]
rcs has joined #commonlisp
mgl has joined #commonlisp
meaty has quit [Ping timeout: 276 seconds]
Krystof has joined #commonlisp
wobbol has joined #commonlisp
pve has joined #commonlisp
ixelp has quit [Ping timeout: 246 seconds]
gilberth has quit [Ping timeout: 255 seconds]
alternateved has joined #commonlisp
jadzi has joined #commonlisp
ixelp has joined #commonlisp
X-Scale has quit [Ping timeout: 256 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
wacki has joined #commonlisp
rcs has quit [Quit: Leaving]
manwithluck has quit [Ping timeout: 260 seconds]
wobbol has quit [Ping timeout: 276 seconds]
jadzi has quit [Ping timeout: 252 seconds]
rcs has joined #commonlisp
rcsrcs has joined #commonlisp
rcs has quit [Client Quit]
rcsrcs has quit [Client Quit]
rcs has joined #commonlisp
rcsrcs has joined #commonlisp
rcsrcs has quit [Client Quit]
rcs has quit [Changing host]
rcs has joined #commonlisp
X-Scale has joined #commonlisp
<rcs>
Hello
rcs has quit [Client Quit]
awlygj has quit [Quit: leaving]
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale has joined #commonlisp
NotThatRPG_ has joined #commonlisp
NotThatRPG has quit [Ping timeout: 252 seconds]
wobbol has joined #commonlisp
X-Scale has quit [Ping timeout: 256 seconds]
mwnaylor has quit [Ping timeout: 248 seconds]
mwnaylor has joined #commonlisp
<pl>
aeth: there was at one point a trivial one for sbcl. So buggy a lot, but somewhat working
chkhd has joined #commonlisp
mwnaylor has quit [Ping timeout: 264 seconds]
mwnaylor has joined #commonlisp
varjag has joined #commonlisp
rcs has joined #commonlisp
rcs has quit [Client Quit]
rcs has joined #commonlisp
theruran has quit [Quit: Connection closed for inactivity]
rcs has quit [Client Quit]
rcs has joined #commonlisp
rcs has quit [Client Quit]
attila_lendvai_ has joined #commonlisp
rcs has joined #commonlisp
rcs has quit [Client Quit]
random-nick has joined #commonlisp
attila_lendvai_ is now known as attila_lendvai
prokhor has joined #commonlisp
random-nick has quit [Ping timeout: 265 seconds]
mwnaylor has quit [Ping timeout: 246 seconds]
ingeniot has joined #commonlisp
attila_lendvai has quit [Ping timeout: 260 seconds]
Guest890 has joined #commonlisp
mrcom has quit [Quit: Leaving]
amb007 has quit [Ping timeout: 272 seconds]
amb007 has joined #commonlisp
donleo has joined #commonlisp
varjag has quit [Ping timeout: 255 seconds]
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
chkhd has quit [Quit: ZZZzzz…]
amb007 has quit [Read error: Connection reset by peer]
chkhd has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
ingeniot has quit [Quit: Client closed]
ingeniot has joined #commonlisp
yitzi has joined #commonlisp
chkhd has quit [Quit: ZZZzzz…]
chkhd has joined #commonlisp
decweb has joined #commonlisp
uhuh has joined #commonlisp
varjag has joined #commonlisp
King_julian has joined #commonlisp
uhuh has quit [Remote host closed the connection]
treflip has quit [Remote host closed the connection]
gilberth has joined #commonlisp
treflip has joined #commonlisp
mari-estel has joined #commonlisp
olnw has quit [Ping timeout: 250 seconds]
olnw has joined #commonlisp
ingeniot has quit [Ping timeout: 256 seconds]
mari-estel has quit [Quit: on the move]
cmack has joined #commonlisp
King_julian has quit [Ping timeout: 244 seconds]
uhuh has joined #commonlisp
shka has quit [Remote host closed the connection]
chkhd has quit [Quit: ZZZzzz…]
shka has joined #commonlisp
chkhd has joined #commonlisp
phae9 has joined #commonlisp
Th30n has quit [Ping timeout: 264 seconds]
chkhd is now known as chkhd`
chkhd` has quit [Quit: ZZZzzz…]
rcs has joined #commonlisp
yitzi has quit [Remote host closed the connection]
annamalai has quit [Ping timeout: 252 seconds]
treflip has quit [Remote host closed the connection]
zxcvz has joined #commonlisp
yitzi has joined #commonlisp
zxcvz has quit [Client Quit]
uhuh has quit [Remote host closed the connection]
oneeyedalien has joined #commonlisp
dra has joined #commonlisp
annamalai has joined #commonlisp
donleo has quit [Quit: Leaving]
oneeyedalien has quit [Quit: Leaving]
donleo has joined #commonlisp
rcs has quit [Quit: rcs]
mari-estel has joined #commonlisp
<srji>
hello
Alfr is now known as Guest4221
Alfr has joined #commonlisp
annamalai has quit [Ping timeout: 252 seconds]
Guest4221 has quit [Ping timeout: 248 seconds]
mari-estel has quit [Remote host closed the connection]
mari-estel has joined #commonlisp
annamalai has joined #commonlisp
mari-estel has quit [Remote host closed the connection]
mari-estel has joined #commonlisp
mari-estel has quit [Remote host closed the connection]
mari-estel has joined #commonlisp
JuanDaugherty has joined #commonlisp
reb has joined #commonlisp
<phae9>
hello
<beach>
Hello srji.
<beach>
Hello phae9.
<beach>
phae9: Are you new here? I don't recognize your nick.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<phae9>
I was here a day ago but yeah pretty much
<beach>
Great! Welcome! What brings you to #commonlisp?
awlygj has joined #commonlisp
<phae9>
nothing in particular, I just wanna see what people are talking about wrt CL :)
<beach>
I see.
<beach>
So I take it you are already using Common Lisp, yes?
skeemer has joined #commonlisp
montxero has quit [Remote host closed the connection]
montxero has joined #commonlisp
mgl has quit [Ping timeout: 245 seconds]
NotThatRPG_ has quit [Ping timeout: 265 seconds]
varjag has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
<phae9>
as a hobby, small project stuff
<beach>
Got it.
NotThatRPG has joined #commonlisp
rcs has joined #commonlisp
rcs has quit [Client Quit]
NotThatRPG has quit [Ping timeout: 248 seconds]
cage has joined #commonlisp
cage has quit [Excess Flood]
cage has joined #commonlisp
mari-estel has quit [Quit: taking a break]
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
alcor` has joined #commonlisp
alcor has quit [Killed (NickServ (GHOST command used by alcor`!~user@2001:9e8:7d8:cb00:e2c5:8f90:a07c:5a09))]
alcor` is now known as alcor
alcor has quit [Changing host]
alcor has joined #commonlisp
alcor has quit [Remote host closed the connection]
zxcvz has joined #commonlisp
droideqa has quit [Quit: Connection closed for inactivity]
NotThatRPG has joined #commonlisp
annamalai has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
annamalai has joined #commonlisp
alcor has joined #commonlisp
dra has quit [Ping timeout: 264 seconds]
pranav has joined #commonlisp
Akbar-Birbal has left #commonlisp [#commonlisp]
zxcvz has quit [Quit: zxcvz]
jonatack has quit [Ping timeout: 272 seconds]
jonatack has joined #commonlisp
puke has quit [Ping timeout: 252 seconds]
JuanDaugherty has quit [Quit: JuanDaugherty]
alcor has quit [Killed (NickServ (GHOST command used by alcor`!~user@2001:9e8:7d8:e600:1e91:3477:2a99:7fbe))]
wacki has quit [Read error: Connection reset by peer]
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
wacki has joined #commonlisp
pve has quit [Quit: leaving]
dstein64- has joined #commonlisp
dstein64 has quit [Ping timeout: 248 seconds]
dstein64- is now known as dstein64
alcor has quit [Remote host closed the connection]
wacki has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shka has quit [Quit: Konversation terminated!]
skeemer has quit [Ping timeout: 252 seconds]
screwlisp has joined #commonlisp
amb007 has joined #commonlisp
ldb has joined #commonlisp
amb007 has quit [Ping timeout: 265 seconds]
attila_lendvai has quit [Ping timeout: 265 seconds]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 244 seconds]
alternateved has quit [Remote host closed the connection]
phae9 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
borei has joined #commonlisp
<borei>
hi all !
<ldb>
hello
varjag has quit [Ping timeout: 252 seconds]
<borei>
guys need some advise. Im working on linear-algebra library, using SBCL. Implementing SIMD for various operation - i got just fantastic results. Looking forward in terms of performance improvements i started to work on CUDA, no high level libraries, just straight cuda kernels wrapped into C functions. Main question is how to pass array
<borei>
(single-float or double-float) to C and to GPU. It's possible to create C-array in lisp, load it with data and pass to C function and then load to GPU, but that will require additional memory and additional copy operations.
<borei>
looking through CFFI i didn't find how to pass pointer to lisp array to C function.
<borei>
any advise is more then welcome.
<aeth>
SIMD is already somewhat implemented with a (sort of) high level wrapper in SBCL as SB-SIMD (unless you're already aware of and using that). It seems to be incomplete. Perhaps your effort could be merged into it.
<ixelp>
GitHub - sionescu/static-vectors: Allocate SIMPLE-ARRAYs in static memory
<borei>
yep yep - im using it, that extension was just merged to main SBCL branch
<aeth>
It creates a bilingual CL vector / C array.
<aeth>
It has to be created on the CL side (because there's an implementation-specific preface) and maintained on the CL side (manually freed), but you can get a pointer to it and pass it to C
<aeth>
CFFI's built-in solution is, afaik, copying. This is extremely slow for graphics.
<borei>
copying doesn't work
<borei>
vectors and matrices im working with pretty big. 10kx10k - that order, so we are talking about gigs of transfer
NotThatRPG_ has joined #commonlisp
<borei>
that static-vectors is pretty close for what im looking for.
<aeth>
yes
<aeth>
before I used static-vectors, my startup time was, I think, several minutes
<aeth>
something ridiculous
<aeth>
and that was only for kilobytes
<aeth>
there must've been something particularly pessimized in CFFI and/or cl-opengl
NotThatRPG has quit [Ping timeout: 252 seconds]
<Bubblegumdrop>
borei perhaps look into clisp? I believe it uses llvm and allows you to call into native C++ code. #clasp https://clasp-developers.github.io/
<ixelp>
Clasp
<Bubblegumdrop>
s/clisp/clasp/
<ldb>
I heard Clasp is not as fast as SBCL
<aeth>
probably not
NotThatRPG_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<borei>
im pretty tight with SBCL now, SB-SIMD is through my code in many places.
donleo has quit [Ping timeout: 260 seconds]
<aeth>
but more critically, LLVM is a pretty slow compiler (slow in compilation time, not in generated code)
<aeth>
C++ programmers apparently don't care about iteration time at all
<aeth>
I think they'd double compilation time for a 10% speedup
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<borei>
hmm, i were just thinking about slightly different approach. Will it better to create custom vector class with data allocated using `foreign-alloc`, need to create "*ref" and "setf *ref", etc etc functions - but i think it's possible.
<borei>
but for such arrays/vectors i don't need to create additional layer to pass data to C function(s).
<Bubblegumdrop>
Oh
<Bubblegumdrop>
so you can ask more about clasp in #clasp
<borei>
just pass pointer to foreign fucntions
<Bubblegumdrop>
But I think like aeth says it's slow to compile
<Bubblegumdrop>
I don't think the generated code is slow at all.
<Bubblegumdrop>
aeth is totally accurate
<Bubblegumdrop>
double compile times for 10% speedup
<Bubblegumdrop>
at the scale this project is being used at it makes a difference
<ixelp>
How Lisp is designing Nanotechnology (with Prof. Christian Schafmeister) - YouTube
<aeth>
borei: static-vectors is easier... it's just like a native (simple-array some-specific-type (some-size)), except you can static-vectors:static-vector-pointer it to get a pointer for C
<borei>
i'll look deeper at that proj.
<bike>
clasp doesn't generate code as good as sbcl's in most cases, no
<bike>
compilers are hard
<bike>
llvm's slow compilation is less of a problem now that we've adopted a solution of avoiding llvm for most code
<borei>
performance wise sbcl is really close to C/C++
benjaminl has quit [Read error: Connection reset by peer]
<aeth>
If you are entirely in simd-packs, then you'd just have to get the elements from something like (sb-simd-avx2:f32.4-values (sb-simd-avx2:make-f32.4 1f0 2f0 3f0 4f0))
<aeth>
Or the other ways if there are any
benjaminl has joined #commonlisp
<borei>
i got 3.2-3.5 GFLOPs on double floats with SB-SIMD
<borei>
single thread.
<aeth>
but being able to deal with CL instead of CFFI (except for the pointer) makes it easier even there, e.g. I have an array-of-4 so I can just pass in the array and offset and then SETF that with the values reached from f32.4-values
<borei>
true true
<aeth>
because SETF can handle VALUES
<aeth>
so I can personally do (setf (array-of-4 the-static-vector offset) (sb-simd-avx2:f32.4-values (sb-simd-avx2:make-f32.4 1f0 2f0 3f0 4f0)))
<aeth>
and now the SIMD pack is in something readable by C
<borei>
i need simd packs only on the lisp side.
<aeth>
bike: oh, that's good to know, I haven't tried to compile it in a while (although I assume unless the compiler is entirely self-hosted, _that_ will have the same issues still)
<aeth>
I'd have to guess that CL can easily beat C in performance in this sort of vectorized code, if only because the right API should be easier to use for more things.
<aeth>
C++ would be harder because there are convenient and probably very optimized libraries that use features that C doesn't have. Which may support ARM NEON and AVX512, which SB-SIMD does not do yet
<borei>
not sure about C, because it's doing some optimization for AVX2/SSE4, but python, even num-py is definitely way far behind.
<aeth>
that's not to say that you couldn't do this in C, but that it would be incredibly syntactically painful... at least C++ has e.g. overloading
<borei>
i need C only for one purpose - communicate with GPU.
<aeth>
CL doesn't have overloading, but everything's prefix and cl:+ isn't any more special than your-lib:+ or your-lib:v+ or whatever you call it
borei has quit [Quit: Client closed]
<bike>
aeth: we added a bytecode compiler (did a presentation at ELS 2022) that'll compile and run lisp without any LLVM involvement. you can build the whole system with just bytecode now, and then only use llvm in the built system (or not at all)
<bike>
so build times are pretty ok now
<bike>
llvm is bad enough that i've been considering putting in my own code generator, but i haven't gotten around to it
<aeth>
Compile LLVM IR to SPIR-V (which was a design goal!) and then interoperate it with what I'm working on except as a full CL (-:
<aeth>
might be hard to actually run it on the GPU, though
<bike>
quite
<aeth>
considering that I looked at recursion, LOOP, TAGBODY, conditions, etc., etc., and decided against it
<bike>
general tagbody is already annoying in llvm-ir, let alone lowering it
<aeth>
on the other hand, the restricted environment of the GPU seems ideal for total functional programming
<aeth>
which must have benefits because it has a name
jonatack has quit [Ping timeout: 255 seconds]
<remexre>
does it sound right that if I want to add a initarg that doesn't get used by a slot (it's used in an initialize-instance method), but i still have initargs that're used by other slots, i need to define a shared-initialize method?
<remexre>
(i ask because i don't think i've had to define a shared-initialize method before, but i don't think i've actually needed to do this before either)
<bike>
if it's only used in an initialize-instance method, shared-initialize doesn't have to handle it
<bike>
shared initialize will just ignore your initarg and handle the slot initargs normally
<remexre>
oh i think my issue might be a missing &allow-other-keys on a parent class's ii :after lol
<remexre>
ah yep
<bike>
initialize instance should effectively have allow-other-keys already
<remexre>
i also have an &rest on that method, if it'd make a difference?
<bike>
the usual keyword validity rules don't apply to these functions. when you make-instance, make-instance figures out all the valid initargs for that particular class, and those include all the slot initargs as well as any keyword parameters of applicable methods of initialize-instance and shared-initialize
<Bubblegumdrop>
hm
<Bubblegumdrop>
has anyone written a lisp interpreter in glsl?
<aeth>
People have compiled things that look like Common Lisp to GLSL several (3+) times to varying degrees of Lispiness vs GLSLness