Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
b0lt
Apr 29, 2005

CPColin posted:

What we really need is just-in-time code deletion that deletes your code right before you try to run it so we can all finally be free from touching computer

you are thinking of vigil

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




CPColin posted:

What we really need is just-in-time code deletion that deletes your code right before you try to run it so we can all finally be free from touching computer

It needs to delete the code right before you try to save it

tef
May 30, 2004

-> some l-system crap ->

Dijkstracula posted:

also the notion of "copy-and-patch JIT"s sound a heck of a lot like the so-called copy-and-annotate binary translation techniques that were popular back in the day, perhaps you would like to learn more starting at about the 15 minute mark of https://www.infoq.com/presentations/dynamic-analysis-tools/

fwiw the paper https://dl.acm.org/doi/pdf/10.1145/3485513 has this as the contributions

quote:

Our contributions are:

(1) The concept of a binary stencil, which is a pre-built implementation of an AST node or bytecode opcode with missing values (immediate literals, stack variable offsets, and branch and call targets) to be patched in at runtime.

(2) An algorithm that uses a library with many binary stencil variants to emit optimized machine code. There are two types of variants: one that enumerates different parameter configurations (whether they are literals, in different registers, or on the stack) and one that enumerates
different code patterns (a single AST node/bytecode or a supernode of a common AST subtree/bytecode sequence).

and they do cite "Optimizing direct threaded code by selective inlining" in 1998 https://dl.acm.org/doi/10.1145/277650.277743

it's kinda not the same but yeah it ain't that different either

Sapozhnik
Jan 2, 2005

Nap Ghost
if time is a flat circle then i'd like to see a resurrection of tracing JITs because that was some absolutely :catdrugs: poo poo and i loved it. at least if i understood the concept correctly

(i read about it a bit in rpython's implementation notes around uhh 10 years ago? but the implementation seems to have changed or at least the docs have)

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

what if using an llm to predict what code paths would be optimised by a tracing jit :2bong:

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

gently caress I might have to pitch this idea to my phd advisor

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Dijkstracula posted:

gently caress I might have to pitch this idea to my phd advisor

[sprays u with water bottle]

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Dijkstracula posted:

what if using an llm to predict what code paths would be optimised by a tracing jit :2bong:

a non-deterministic jit that requires tens of gigabytes of RAM, a beefy GPU, and can emit instructions at a few hundred bytes per second sounds like a perfect fit for python

akadajet
Sep 14, 2003

Dijkstracula posted:

what if using an llm to predict what code paths would be optimised by a tracing jit :2bong:

my 4090 is ready for your poc

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

akadajet posted:

my 4090 is ready for your poc

please, no roleplay in the thread

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
just feed your python program into chatgpt and ask it to rewrite it in assembly

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

Dijkstracula posted:

also the notion of "copy-and-patch JIT"s sound a heck of a lot like the so-called copy-and-annotate binary translation techniques that were popular back in the day, perhaps you would like to learn more starting at about the 15 minute mark of https://www.infoq.com/presentations/dynamic-analysis-tools/

also seems similar to what i remember about apple's 68k emulators for powerpc mac

the first gen 68k emulator was a simple interpreter - figure out the current instruction's opcode, jump to the appropriate handler function, repeat. was enough to get first generation powerpc macs out the door with reasonable performance

they went on to do a second gen 68k emulator which built upon this foundation by supporting copying-and-modifying instruction handlers into a JIT cache so that frequently executed loops and functions which fit in the cache didn't have to suffer the overhead of software 68k decode

this was all in the early 1990s

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Sapozhnik posted:

if time is a flat circle then i'd like to see a resurrection of tracing JITs because that was some absolutely :catdrugs: poo poo and i loved it. at least if i understood the concept correctly

(i read about it a bit in rpython's implementation notes around uhh 10 years ago? but the implementation seems to have changed or at least the docs have)

tracing works great if you have very few deviations from the hot path, very fast transitions between generated code and the interpreter and ideally a language that isn’t insanely dynamic. I learned the hard way that it wasn’t a good fit for JS (as-benchmarked-at-the-time at least) with the resources we had available to us, but the luajit2 alien science worked out pretty well for Mike Pall

I’d love to give it another try with a V8/Chakra-sized team and a saner timeline

Asleep Style
Oct 20, 2010

how does luajit compare to the python jit described in the article? I don't know anything about jit compilers but I've done a bit of lua 5.1 and it was pretty nice to use

tef
May 30, 2004

-> some l-system crap ->
luajit did some type specialisation iirc, this one's more "hey, what if instead of calling a c function per bytecode, we jammed the c code together and made a c-function per python function"

there's gonna be some speedup, without a lot of overhead or startup costs, it's alright

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

luajit did type and value specialization, including inlining custom versions of calls to things like `sin`. and of course it did all the inlining that is the real prize of tracing. it was a very aggressive JIT in that sense, and I was continuously jealous of it while working on ours

(I don’t think Williams was involved but it’s where the Citeseer link went. it’s impossible to google for the paper because it’s the test document for pdf.js and probably the most widely viewed CS paper in history for that reason!)

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Subjunctive posted:

luajit did type and value specialization, including inlining custom versions of calls to things like `sin`. and of course it did all the inlining that is the real prize of tracing. it was a very aggressive JIT in that sense, and I was continuously jealous of it while working on ours

(I don’t think Williams was involved but it’s where the Citeseer link went. it’s impossible to google for the paper because it’s the test document for pdf.js and probably the most widely viewed CS paper in history for that reason!)

wont this just loop through the primes array once, hitting continue each time, and do nothing?

Only registered members can see post attachments!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Carthag Tuek posted:

wont this just loop through the primes array once, hitting continue each time, and do nothing?



yeah, I think the caption is wrong and it should be “true” for the initialization

I think that was fixed for the PLDI version, but that’s behind a paywall and I could only find the preprint

Asleep Style
Oct 20, 2010

thanks folks!

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Subjunctive posted:

yeah, I think the caption is wrong and it should be “true” for the initialization

I think that was fixed for the PLDI version, but that’s behind a paywall and I could only find the preprint

would be funny if its still there lol

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Carthag Tuek posted:

would be funny if its still there lol

I’m trying to grab a copy to check! wouldn’t be the first such thing in a paper I’ve read, but the first in one I wrote

I’ve only written that paper

Sapozhnik
Jan 2, 2005

Nap Ghost
oh yeah, now i remember. the cool thing about the pypy tracing jit was that the action of the interpreter loop itself was part of the trace

i skimmed a paper a while back about cracking denuvo using similar techniques, like write an interpreter for the obfuscated vm, trace the interpreter, then run the traces through e.g. LLVM's optimizer to figure out just what the hell it is doing. sounds like an interesting approach.

Doom Mathematic
Sep 2, 2008
Python didn't have a JIT this whole time?

Zlodo
Nov 25, 2006
I want to jit python...

...par la fenêtre!!!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

mainline Python didn’t, no

Instagram had an AOT compiler called Cinder for their app

pypy is a tracing JIT but afaik it’s neither completely compatible nor suitable for production deployment

Guido for a long time pushed back on JITs because it would complicate the runtime too much, if my hazy memory is correct (his belief is correct of course, but its complexity worth taking IMO)

people dealt with Python’s performance (and threading!) limitations by just punting everything to modules written in C

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
there are like half a dozen different python jits in various levels of bitrot, but the primary python implementation, cpython, has always been amateurish and bad

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
wasn’t there something in the mailing lists recently about better multiprocessing/threading support coming to cpython finally? maybe im hallucinating

mystes
May 31, 2006

Arcteryx Anarchist posted:

wasn’t there something in the mailing lists recently about better multiprocessing/threading support coming to cpython finally? maybe im hallucinating
It's about to get subinterpreters in the next release, so maybe that's what you're thinking of?

Asleep Style
Oct 20, 2010

here's the pep for gil removal
https://peps.python.org/pep-0703/

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

the GIL removal is a heroic project, just amazing persistence and thoroughness

mystes
May 31, 2006

Maybe they should just write a new language instead. They could call it (shaggar voice) c#

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

there was a Python implementation on top of the CLR, but it didn’t have compatibility with the world of C extensions so nobody took it seriously. I think it was IronPython?

akadajet
Sep 14, 2003

mystes posted:

Maybe they should just write a new language instead. They could call it (shaggar voice) c#

shaggar’s not wrong about it

mystes
May 31, 2006

Subjunctive posted:

there was a Python implementation on top of the CLR, but it didn’t have compatibility with the world of C extensions so nobody took it seriously. I think it was IronPython?
both ironpython and jython were pretty neat honestly

but yeah without extension compatibility there isn't much point

pseudorandom name
May 6, 2007

wasn't there an ActiveScripting version of Python, for your IE4 web page needs?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

pseudorandom name posted:

wasn't there an ActiveScripting version of Python, for your IE4 web page needs?

we had the ability to use Python to write components for Mozilla, but we never exposed it to the web because Jesus Christ would that be bad

I assumed the ActivePython stuff didn’t work in IE either but maybe if the page had enough privileges. if they can load ActiveX the game is over anyway

redleader
Aug 18, 2005

Engage according to operational parameters

mystes posted:

Maybe they should just write a new language instead. They could call it (shaggar voice) c#

p#

Subjunctive
Sep 12, 2006

✨sparkle and shine✨


see a doctor, buddy

mystes
May 31, 2006

Subjunctive posted:

see a doctor, buddy

Adbot
ADBOT LOVES YOU

susan b buffering
Nov 14, 2016

Subjunctive posted:

see a doctor, buddy

lol

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply