Replies: 5 comments 10 replies
-
The WAM is the best documented of the Prolog abstract machines by far and has a wealth of literature on extending it with garbage collection, continuations, tabling, exceptions, compressing reference chains, lots of things. I did initially want to start with the WAM and in time refine it down to the BAM, but I was warned against doing that I believe because the BAM doesn't support ISO Prolog semantics as consistently and solidly as the WAM does. I think I was told Aquarius Prolog was impressively quick but had persistent semantics problems. Scryer prioritizes correctness and reliability over performance (performance is still very important as our #2 priority). Besides all that, our ultimate goal is to compile WAM code to native code. The global benchmark of Prolog performance is currently SICStus and it runs on a WAM-based JIT compiler, so this certainly seems doable using the WAM even if it is not strictly the fastest abstract machine. I was never really aware of the VAM. The WAM got almost all of the publication ink in the area of Prolog abstract machines. |
Beta Was this translation helpful? Give feedback.
-
First, a bit of historical context. At the time of the development of the WAM, cheaper workstations became popular. Just to give an order-of-magnitude impression, there were 3 classes of machines: IBM hosts, then for a 10th of their price Vaxen, and for again a 10th of that, workstations. The idea was to provide more LIPS per $ with workstations like Apollo and later SUN which were Motorola 680x0 based. While the address space was flat and (for that time) virtually unlimited, real memory was quite expensive, and thus a compact emulator was seen as the primary option. That is, direct threaded decoding. In that context, the claim for improvement of the VAM must be seen. It effectively decoded head and goal simultaneously at practically the price of a single decode in the WAM (exploiting some 68k-specifica). With increasing real memory and RISCs, compilation options became more attractive, but all required some extra work for the programmer. It is only since SICStus' Jitter that completely transparent machine code generation has become available lowering carbon footprint. There are still clever developments on the abstract machine level. Like jumbo-instructions. And there is still no implementation that efficiently supports |
Beta Was this translation helpful? Give feedback.
-
Oh ok good - came across this paper today called "Global Optimizations in a Prolog Compiler for the TOAM" and wanted to do a search here to make sure this community was aware of it. Looks like you are. Even if we're sticking to the WAM over BAM because we're prioritizing correctness over performance (an approach which I agree with!), wanted to run this paper up the flag pole to see if perhaps there are some ideas in there that could be implemented in the WAM to its benefit. |
Beta Was this translation helpful? Give feedback.
-
I agree with any ISO conforming approach, for that matter. Regardless of the internal implementation decisions taken. What I can say for the moment for Scryer, is that its term representation is very close to SICStus performance-wise. This in turn means that there does not seem to be any inherent limitations in that direction. Not sure how Rust can be used as a jitter, but if it can be used, then things look quite brite. |
Beta Was this translation helpful? Give feedback.
-
Maybe another implementation question, do we take advantage of the optimizations recommended in this paper - "Improving Efficiency of Prolog Programs by Fully Automated Unfold/Fold Transformation" From their concluding remarks:
so looks like their technique is a matter of tradeoffs depending on the program but perhaps worth a look. |
Beta Was this translation helpful? Give feedback.
-
Hello colleagues,
I am very new to Prolog, only started learning it in the past month and it's been a fascinating journey which I have enjoyed immensely. I've started learning about Prolog implementations and read some papers about various techniques and virtual machines.
I recently learned about Berkeley Abstract Machine (BAM) from reading Can Logic Programming Execute
as Fast as Imperative Programming? and Vienna Abstract Machine (VAM), along with Zip, TOAM, and others, which stimulated my curiosity about Scryer's implementation choices. The papers describing BAM and VAM claimed that they are an improvement over WAM. So I'm wondering why Scryer chose to use WAM to implement Prolog versus BAM or VAM or even Zip or TOAM?
I did notice that BAM seems to be encumbered with rather restrictive licensing terms which may explain why it's not found elsewhere in other Prologs (other than Aquarius). What about VAM? It seems it's not used anywhere, though please correct me if I'm mistaken!
I would love to learn more if you have any information to share regarding why one machine model was chosen versus others?
Beta Was this translation helpful? Give feedback.
All reactions