Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: perllVm: A start.

by BrowserUk (Pope)
on Sep 03, 2012 at 16:33 UTC ( #991471=note: print w/ replies, xml ) Need Help??


in reply to Re: perllVm: A start.
in thread perllVm: A start.

Thanks.

  • it looks like you didn't use any of CPAN LLVM modules.

    Correct. Those modules are for use from an existing Perl installation to compile C code to speed up small functions. Much in the vain of using XS or Inline::C.

    The exercise here is to (first) build Perl itself using LLVM.

  • How did you get/compile 'clang.exe'?

    You pull the source code and then build it :) see http://clang.llvm.org/get_started.html.

    It can be built with gcc (mingw on win), or MSVC.

    Once built (on *nix) clang 'claims' (or perhaps just 'aims') to be a "drop-in replacement for gcc".

    (I'm not in a position to verify that, but superficially from the docs and examples I can find, it looks fairly true.

  • Or maybe once you have 'clang.exe' you can get a faster version by compiling 'clang.exe' with 'clang'. Completely guessing :-)

    I've no idea if you can bootstrap clang using clang.

    Update: it can and does on *nix. (Apparently their build bots re-build themselves regularly.)

For now, my target is to work out how to build (a) working perl -- that is compatible with modules built for that perl using the normal mechanisms -- using clang.

A simple, standalone sandbox in which to play.

Then I can compare that to the standard build and see what if any improvements are available using LLVM as just another C compiler.

Then I can explore what differences/improvements are bought about by which of LLVMs many optimisation passes. Ie. which give the best bang for the buck.

Then move on to exploring the possibility of bolting LLVM JIT into the mix at runtime.

But baby steps. The clang docs are sparse and despite that they are targeting windows compatibility -- and have already added lots of support -- there are few windows people involved from who to curry expertise.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


Comment on Re^2: perllVm: A start.
Re^3: perllVm: A start.
by flexvault (Vicar) on Sep 03, 2012 at 17:28 UTC

    BrowserUk,

    I just checked if Debian had clang/LLVM, and interestingly: http://clang.debian.net/

    It included a link with actual compile times: http://gcc.gnu.org/ml/gcc/2012-02/msg00134.html

    See the full report for explanation, but the following looks good.

    These are the average compile times for compiling a file in a set of 100 randomly selected files: (time values in seconds) gcc 4.4 gcc 4.6 gcc 4.7 clang 3.0 clang 3.1 -fs-o -O0 0.450 0.458 0.501 0.449 0.439 -O0 0.624 0.631 0.684 0.504 0.494 -O0 -g 0.722 0.727 0.781 0.661 0.653 -O2 0.811 0.803 0.874 0.603 0.597 -O2 -g 0.916 0.979 1.06 0.809 0.809 These are the average compile times for compiling a file in the set of the 10 files that are slowest (as when compiled with gcc 4.4 using -O2) to compile: gcc 4.4 gcc 4.6 gcc 4.7 clang 3.0 clang 3.1 -fs-o -O0 2.18 1.70 1.86 1.70 1.66 -O0 5.87 5.33 5.71 2.90 2.85 -O0 -g 6.71 6.19 6.61 4.00 4.08 -O2 11.9 10.8 12.0 6.72 6.80 -O2 -g 13.2 13.6 15.1 9.57 9.78
    I usually compile with '-O2' which looks very good.

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

Re^3: perllVm: A start.
by rurban (Scribe) on Sep 04, 2012 at 11:24 UTC
    BrowserUK: Please see https://www.socialtext.net/perl5/LLVM

    Yuval has no time and tuits to follow his proposal, but I might do so.

    I'm also trying to target nqp to LLVM (vmkit, really) to get away from parrot's performance problems.

      Reini,

      So far we have based most of our Perl5-on-LLVM ideas on Yuval's original writeup you have linked.

      Thanks,
      ~ Will

      Thanks for the link Reini.

      I can see that I am duplicating some of Yuval's efforts, but I think it will be worth it.

      Beyond simply using llvm as an alternate C compiler -- though if doing so recovered (some of) the 15% to 30% loss of performance that has come about since perl5.6.1 with the additions of threading and Unicode support, that alone would be worth something -- I also want to explore what benefits (or not) are derived from the passes of the individual optimisers in llvm, on a the various groups of the perl core.

      For now, my chosen task of having llvm-built binaries (perl.exe/perl5x.dll) that inter-operate with an otherwise standard distribution and modules -- including XS modules -- built using the normal compiler for the platform is (cautiously) going well. Most of the problems I've encountered so far result from my choosing to use MSVC rather than a gcc-compatible compiler to build the distribution I am inter-operating with. Simple reasoning: if I can make LLVM inter-operate with MSVC, gcc/mingw should be a doddle; but more importantly, inter-operation on other more obscure platforms should also be possible.

      One of the bits of using LLVM that has gone completely unmentioned in all of the discussion I've seen so far, is the benefits of using its (frankly amazing) analysis & tracing tools. I've learnt more about the structure (and cruft) of the perl internals in the last 100 hours than in the previous 5 years.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

        One of the bits of using LLVM that has gone completely unmentioned in all of the discussion I've seen so far, is the benefits of using its (frankly amazing) analysis & tracing tools. I've learnt more about the structure (and cruft) of the perl internals in the last 100 hours than in the previous 5 years.

        Can you please point a camera at your computer screen and vocalize your thoughts?

        Then upload this recording somewhere?

        Thank you :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2014-04-18 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (465 votes), past polls