Logo by mauxuam - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. March 29, 2024, 04:51:44 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2] 3   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Writing formula using gcc (Re: Blobby)  (Read 14546 times)
Description: Learining how to use gcc for writing MB3D formulas
0 Members and 1 Guest are viewing this topic.
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #15 on: December 01, 2015, 09:52:38 PM »

Yes! unfortunatly there are not a lot of lightweight fast JIT libraries out there.

From what I've seen of this Pascal JIT library used in next MB3D that Andreas showed, it's extremely weak at optimising, besides being commercial closed source (!!). No idea why anyone would choose this over the legendary LuaJIT, for example.
Logged

quaz0r
Fractal Molossus
**
Posts: 652



« Reply #16 on: December 01, 2015, 09:59:57 PM »

Quote
luajit
+1
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #17 on: December 01, 2015, 10:18:29 PM »

Luajit is a tracing JIT. AFAIU, one can't call luajit functions directly as one can do in c or pascal. Yes, it is more than excellent. A talented (and excperienced) programmer could extract the part that do actual compilation (SSA, optimizations, register allocation, code generation...) and add support for calling conventions. That would be the PERFECT solution. Writing a simple language adapted for fractal formulas would then be a piece of cake... sort of...
Anyone?
Dreaming about an "unified" language and a common library for fractal formulas that could be used not only by MB3D but also Mandelbulber, Chaotica, apophysis...
Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #18 on: December 01, 2015, 10:23:19 PM »

Glare Technologies (company making Chaotica and Indigo Renderer, i.e. me and 2 other dudes) plans to opensource our language, Winter, at some point.

You can for example look at the code for the Chaotica 2 transform library here (not final, but it will be opensourced): https://dl.dropboxusercontent.com/u/3038174/standard_transforms.xml

This compiles to code that beats C/C++ in performance, and is *proven* to be safe before compilation. It's possible because it's quite a restricted (pure functional) language, yet it has a lot of power - the whole of Indigo 4 and Chaotica 2 rendering engine are written in it.

It's (unfortunately?) not the case that assembly language beats high level languages, mainly because of the complexity of modern processors, and the ability of optimising compilers to just throw combinatorial optimisation at the the problem. You really have to be best-in-the-world at low level optimisation to beat a modern compiler, and even then your chances are not good; plus, that's just no way to live/program smiley
Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #19 on: December 01, 2015, 10:41:36 PM »

That's what I was dreaming about! I hope it doesn't use LLVM as a back end.

It's (unfortunately?) not the case that assembly language beats high level languages, mainly because of the complexity of modern processors, and the ability of optimising compilers to just throw combinatorial optimisation at the the problem. You really have to be best-in-the-world at low level optimisation to beat a modern compiler, and even then your chances are not good; plus, that's just no way to live/program smiley
(...) This compiles to code that beats C/C++ in performance, and is *proven* to be safe before compilation. It's possible because it's quite a restricted (pure functional) language, yet it has a lot of power - the whole of Indigo 4 and Chaotica 2 rendering engine are written in it. (...)
especially:
(...) It's possible because it's quite a restricted (pure functional) language, yet it has a lot of power (...)


Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #20 on: December 01, 2015, 10:44:11 PM »

I hope it doesn't use LLVM as a back end.

Why not? LLVM is awesome, and exactly the tool for the job if you want fast code for your domain specific language.

Winter does use LLVM for codegen. BTW, you can find some more info on my boss' blog if you're curious: http://www.forwardscattering.org/
Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #21 on: December 01, 2015, 11:06:19 PM »

Last time I took a look at LLVM. Its JIT wasn't working on windows.
Thank you for the link.  smiley
Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #22 on: December 01, 2015, 11:09:23 PM »

Yeah that used to be the case a number of years ago (~2012) for Win64 only, Win32 worked fine. But since then they have fixed it and it's 102% awesome, no other way to even begin approaching modern compiler performance without it.

If you'd like to use Winter we should talk smiley
Logged

thargor6
Fractal Molossus
**
Posts: 789



WWW
« Reply #23 on: December 01, 2015, 11:44:21 PM »

No idea why anyone would choose this over the legendary LuaJIT, for example.
Simple answer: appropriateness. It works, is stable and does not need much time to integrate it. On the other side, MB3D is technically based on a dead plattform.
A large invest into some fancy compiler-solution (in the context of the current code-base) does not make much sense for me.
No doubt, that this is on "greenfield-projects" like Chaotica 2 a different thing, but I think, this discussion does not help much.
 
Anyone who has the time and power to help with some more fancy solution, is more than welcome. I'm open for any good ideas, and as stated before, some Lua-based alternative was already on the list.

Cheers!
Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #24 on: December 01, 2015, 11:51:26 PM »

Simple answer: appropriateness.

A closed-source JIT for open source project? That's really the first thing that struck me as a little inappropriate.

Anyone who has the time and power to help with some more fancy solution, is more than welcome. I'm open for any good ideas, and as stated before, some Lua-based alternative was already on the list.

I know it doesn't count for much, but I actually do wish I could work in opensource; I recently released my first opensource code since early LuxRender contributions (a silly small thing), and the experience was extremely positive for me with comments, suggestions and patches etc. It's almost certainly the future of programming. Maybe, hopefully, one day...
Logged

thargor6
Fractal Molossus
**
Posts: 789



WWW
« Reply #25 on: December 02, 2015, 12:29:21 AM »

A closed-source JIT for open source project?
This is not completely fair because the whole MB3D project is in fact bound to a commercial and expensive closed development environment.
Of course, to use a commercial JIT makes this not better, but it is in my opinion appropriate as a working solution.

Because I also see those problems, the integration of the Pax-Compiler is built in a way that it can be simply turned off by setting a compiler-directive (and pluggin in other stuff).


Logged
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #26 on: December 02, 2015, 12:45:02 AM »

Ah, yeah I see your point. Is there no chance to perhaps switch to the Lazarus IDE with Free Pascal Compiler? They recently had a major update: http://www.lazarus-ide.org/

From the feature list I see they support external C code and auto-conversion of .h headers, so maybe LuaJIT can also be integrated without too much pain? (I know it's a little late to make these suggestions/comments...)
Logged

thargor6
Fractal Molossus
**
Posts: 789



WWW
« Reply #27 on: December 02, 2015, 01:15:45 AM »

Is there no chance to perhaps switch to the Lazarus IDE with Free Pascal Compiler?
Good point, I check the Lazarus project on a regular basis, because I work on other legacy projects, which are also aiming to get rid of the Delphi IDE.
Even it is great project, I was not really "blown away" yet, because usually, it is a lot of work, until it finally really works, because the "emulated" Delphi components are not working exactly as the original ones. Additionally, in the case of MB3D, we have much integrated ASM-stuff, I doubt that all of this will translate 1:1 to FreePascal.

I think, I would prefer to rewrite the application rather than converting it (but, I will not rewrite it, this goes far beyond my ressources).
But, this is only a first guess, when I find the time, I will grab the newest Lazarus and try to convert some simple part to make an estimation.


Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #28 on: August 21, 2016, 06:09:10 PM »

Is there an easy way to grab the binary/hex code from JIT formulas?

  Maybe an offset in M3D memspace, so we could grab it from a debugger... or a button to dump the code?

  I'd like to write formulas in the JIT, and optimize them outside of the JIT. 
Logged

thargor6
Fractal Molossus
**
Posts: 789



WWW
« Reply #29 on: August 21, 2016, 07:14:48 PM »

I think it would be easy to just dump it, but I'm not sure that the result has the quality you really want to optimize.
But, I can include such an option in the next build, and you may have a look by yourself :-)
Logged
Pages: 1 [2] 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Inner Writing I FractalForums.com Banner Logos Pauldelbrot 0 2107 Last post January 02, 2012, 04:57:34 AM
by Pauldelbrot
Inner Writing II FractalForums.com Banner Logos Pauldelbrot 0 2032 Last post January 02, 2012, 04:59:09 AM
by Pauldelbrot
Inner Writing III FractalForums.com Banner Logos Pauldelbrot 1 2250 Last post January 02, 2012, 02:21:09 PM
by cKleinhuis
Blobby (How to write simple m3f) Tutorials « 1 2 3 » visual.bermarte 39 10115 Last post April 20, 2015, 09:18:23 PM
by knighty
writing a mb3d formula (*directly* in Assembly) Tutorials « 1 2 » M Benesi 15 6841 Last post October 21, 2015, 11:34:49 PM
by M Benesi

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.231 seconds with 29 queries. (Pretty URLs adds 0.011s, 2q)