bd satish | 12 May 09:17

Fortress without JVM

Hi,

Is it possible to run Fortress without the Java Runtime Environment ? As of now, yes, JVM is needed, I know.  Are there any plans of making it "Java independent" in the future ? I would like Fortress to run natively on my hardware (and operating system) without depending on any external libraries or virtual machines.

David Chase | 12 May 13:22
Favicon

Re: Fortress without JVM

I can imagine a bare-metal Fortress, but right now we don't have  
plans to do that.
Reimplementing the useful stuff that a JVM provides would be quite a  
lot of work, and it's not at all clear that we'd benefit much from  
doing it.

David

On 2008-05-12, at 3:20 AM, bd satish wrote:

> Hi,
>
> Is it possible to run Fortress without the Java Runtime  
> Environment ? As of now, yes, JVM is needed, I know.  Are there any  
> plans of making it "Java independent" in the future ? I would like  
> Fortress to run natively on my hardware (and operating system)  
> without depending on any external libraries or virtual machines.

Jan-Willem Maessen | 12 May 13:57
Favicon

Re: Fortress without JVM


On May 12, 2008, at 3:20 AM, bd satish wrote:

> Hi,
>
> Is it possible to run Fortress without the Java Runtime  
> Environment ? As of now, yes, JVM is needed, I know.  Are there any  
> plans of making it "Java independent" in the future ? I would like  
> Fortress to run natively on my hardware (and operating system)  
> without depending on any external libraries or virtual machines.

I'm curious to know what you're actually seeking here.  Do you just  
want to compile to a static binary (and if so, why do you think that  
will be helpful?)?  Do you want a binary for distribution purposes?   
Do you want static linking so that you can guarantee that you're  
running the same code everywhere (we hope to guarantee something like  
this, but not using static linking in the usual sense)?

-Jan-Willem Maessen

Akhilesh Mritunjai | 12 May 15:47

Re: Fortress without JVM


On Mon, May 12, 2008 at 5:27 PM, Jan-Willem Maessen <Janwillem.Maessen-xsfywfwIY+M@public.gmane.org> wrote:

On May 12, 2008, at 3:20 AM, bd satish wrote:

Hi,

Is it possible to run Fortress without the Java Runtime Environment ? As of now, yes, JVM is needed, I know.  Are there any plans of making it "Java independent" in the future ? I would like Fortress to run natively on my hardware (and operating system) without depending on any external libraries or virtual machines.

I'm curious to know what you're actually seeking here.  Do you just want to compile to a static binary (and if so, why do you think that will be helpful?)?  Do you want a binary for distribution purposes?  Do you want static linking so that you can guarantee that you're running the same code everywhere (we hope to guarantee something like this, but not using static linking in the usual sense)?


I think the issue here is that Fortress is being aimed at scientific computing. That domain is currently being dominated by FORTRAN, C, C++, MATLAB and Mathematica. There are other libraries useful too like OpenMP, MPI, BLAS and LAPACK.

As of now, JVM is quite limited when it comes to high performance computing and especially floating point performance due to restrictions posed by Java Language Specification. This has been detailed at http://math.nist.gov/javanumerics/. Additionally, it's quite cumbersome to interface Java with existing (well tested and excellent) code out there.

So, people are interested in how the project (eventually?) will pan out. A thing like project "vision" or roadmap will be helpful. As I understand - the current implementation is more of a proof-of-concept and "reference" implementation - not really meant to be used for "real" use. It is supposed to be followed by an implementation that would probably address those concerns and needs.

So, a sort of a "vision statement" (if there is any) will be helpful. eg. Is Fortress being envisioned as a JVM language ? If so then are there JVM spec changes being investigated that would allow things like MPI (or something superior), superior floating point performance, easier linking with LAPACK, BLAS, and tons of stuff already available in FORTRAN (and may be C/C++ stuff too). Keep in mind that HPC crowd already deals with things like optimizing cache access, coding parts of code in SSE etc which are impossible to do with JVM. So some quite radical changes will be needed in JVM if Fortress is being envisaged as a JVM language.

- Akhilesh
dmitrey | 12 May 16:43
Favicon

Re: Fortress without JVM

Akhilesh Mritunjai wrote:
> If so then are there JVM spec changes being investigated that would 
> allow things like MPI (or something superior), superior floating point 
> performance, easier linking with LAPACK, BLAS, and tons of stuff 
> already available in FORTRAN (and may be C/C++ stuff too). 
There is a nice powerful tool that I had already used: f2py (fortran to 
Python bridge, auto compile+link).
http://cens.ioc.ee/projects/f2py2e/

Lots of soft, including BLAS, LAPACK is connected to scipy/numpy (Python 
language code) via f2py.

So, f2py author thinks about creating f2* (i.e. for all (afaik 
preferably script) languages), that is mentioned in first 3 messages 
from top here:
http://comments.gmane.org/gmane.comp.python.scientific.devel/7796

Regards, D.

Michael Spiegel | 12 May 17:16

Re: Fortress without JVM

One possibility for long-term goals is to implement a runtime for Fortress using the Low Level Virtual Machine (LLVM) compiler infrastructure: http://llvm.org/.  However, I am quite ignorant in my virtual machine knowledge and so there are probably reasons why this is a bad suggestion.

--Michael

On Mon, May 12, 2008 at 9:47 AM, Akhilesh Mritunjai <mritun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

On Mon, May 12, 2008 at 5:27 PM, Jan-Willem Maessen <Janwillem.Maessen-xsfywfwIY+M@public.gmane.org> wrote:

On May 12, 2008, at 3:20 AM, bd satish wrote:

Hi,

Is it possible to run Fortress without the Java Runtime Environment ? As of now, yes, JVM is needed, I know.  Are there any plans of making it "Java independent" in the future ? I would like Fortress to run natively on my hardware (and operating system) without depending on any external libraries or virtual machines.

I'm curious to know what you're actually seeking here.  Do you just want to compile to a static binary (and if so, why do you think that will be helpful?)?  Do you want a binary for distribution purposes?  Do you want static linking so that you can guarantee that you're running the same code everywhere (we hope to guarantee something like this, but not using static linking in the usual sense)?


I think the issue here is that Fortress is being aimed at scientific computing. That domain is currently being dominated by FORTRAN, C, C++, MATLAB and Mathematica. There are other libraries useful too like OpenMP, MPI, BLAS and LAPACK.

As of now, JVM is quite limited when it comes to high performance computing and especially floating point performance due to restrictions posed by Java Language Specification. This has been detailed at http://math.nist.gov/javanumerics/. Additionally, it's quite cumbersome to interface Java with existing (well tested and excellent) code out there.

So, people are interested in how the project (eventually?) will pan out. A thing like project "vision" or roadmap will be helpful. As I understand - the current implementation is more of a proof-of-concept and "reference" implementation - not really meant to be used for "real" use. It is supposed to be followed by an implementation that would probably address those concerns and needs.

So, a sort of a "vision statement" (if there is any) will be helpful. eg. Is Fortress being envisioned as a JVM language ? If so then are there JVM spec changes being investigated that would allow things like MPI (or something superior), superior floating point performance, easier linking with LAPACK, BLAS, and tons of stuff already available in FORTRAN (and may be C/C++ stuff too). Keep in mind that HPC crowd already deals with things like optimizing cache access, coding parts of code in SSE etc which are impossible to do with JVM. So some quite radical changes will be needed in JVM if Fortress is being envisaged as a JVM language.

- Akhilesh

Jan-Willem Maessen | 15 May 21:54
Favicon

Re: Fortress without JVM


On May 12, 2008, at 11:16 AM, Michael Spiegel wrote:

> One possibility for long-term goals is to implement a runtime for  
> Fortress using the Low Level Virtual Machine (LLVM) compiler  
> infrastructure: http://llvm.org/.  However, I am quite ignorant in  
> my virtual machine knowledge and so there are probably reasons why  
> this is a bad suggestion.

The simple reason: LLVM does not support garbage collection so far as  
I understand.  Supporting GC on top of a non-GC-aware compiler is  
painful and slows code down, as anyone who's bootstrapped a GC'd  
language on top of C can tell you.

-Jan-Willem Maessen

Edson Tadeu | 15 May 22:35

Re: Fortress without JVM

It actually does provides some support to GC:

    http://llvm.org/docs/GarbageCollection.html

It can even be used as a JIT compiler, but I don't know how mature it is as compared to JVM JIT, for example.
Maybe JVM with some good optimizing JIT compiler and better support for numerics can do better.


On Thu, May 15, 2008 at 4:54 PM, Jan-Willem Maessen <Janwillem.Maessen-xsfywfwIY+M@public.gmane.org> wrote:

On May 12, 2008, at 11:16 AM, Michael Spiegel wrote:

One possibility for long-term goals is to implement a runtime for Fortress using the Low Level Virtual Machine (LLVM) compiler infrastructure: http://llvm.org/.  However, I am quite ignorant in my virtual machine knowledge and so there are probably reasons why this is a bad suggestion.

The simple reason: LLVM does not support garbage collection so far as I understand.  Supporting GC on top of a non-GC-aware compiler is painful and slows code down, as anyone who's bootstrapped a GC'd language on top of C can tell you.

-Jan-Willem Maessen


Jon Harrop | 16 May 00:24
Favicon

Re: Fortress without JVM

On Thursday 15 May 2008 20:54:32 Jan-Willem Maessen wrote:
> On May 12, 2008, at 11:16 AM, Michael Spiegel wrote:
> > One possibility for long-term goals is to implement a runtime for
> > Fortress using the Low Level Virtual Machine (LLVM) compiler
> > infrastructure: http://llvm.org/.  However, I am quite ignorant in
> > my virtual machine knowledge and so there are probably reasons why
> > this is a bad suggestion.
>
> The simple reason: LLVM does not support garbage collection so far as
> I understand.  Supporting GC on top of a non-GC-aware compiler is
> painful and slows code down, as anyone who's bootstrapped a GC'd
> language on top of C can tell you.

Actually, LLVM does facilitate garbage collection and even bundles two 
different rudimentary but accurate collectors (shadow stack and semi-space):

  http://llvm.org/docs/GarbageCollection.html

There are also projects like the Python implementation PyPy that use garbage 
collectors with LLVM.

However, a parallel functional language needs a performant concurrent GC and 
tail calls but Microsoft's CLR is the only VM to offer both of those features 
together.

--

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

Jan-Willem Maessen | 16 May 15:53
Favicon

Re: Fortress without JVM

On May 15, 2008, at 6:24 PM, Jon Harrop wrote:

> On Thursday 15 May 2008 20:54:32 Jan-Willem Maessen wrote:
>> On May 12, 2008, at 11:16 AM, Michael Spiegel wrote:
>>> One possibility for long-term goals is to implement a runtime for
>>> Fortress using the Low Level Virtual Machine (LLVM) compiler
>>> infrastructure: http://llvm.org/.  However, I am quite ignorant in
>>> my virtual machine knowledge and so there are probably reasons why
>>> this is a bad suggestion.
>>
>> The simple reason: LLVM does not support garbage collection so far as
>> I understand.  Supporting GC on top of a non-GC-aware compiler is
>> painful and slows code down, as anyone who's bootstrapped a GC'd
>> language on top of C can tell you.
>
> Actually, LLVM does facilitate garbage collection and even bundles two
> different rudimentary but accurate collectors (shadow stack and semi- 
> space):
>
>  http://llvm.org/docs/GarbageCollection.html

I stand corrected (thanks to all who pointed me at this page).  I was  
apparently mis-remembering a year-and-a-half-old email discussion.   
Having dusted it off a bit and done a bit of web surfing, I now  
realize that what I was remembering was really Jon's point below:

> However, a parallel functional language needs a performant  
> concurrent GC and
> tail calls but Microsoft's CLR is the only VM to offer both of those  
> features
> together.

Developing a fast parallel GC (for low overhead) or concurrent GC (for  
low and predictable pauses) requires programmer-years of investment.   
I didn't see any sign of such a project for LLVM back then, and quick  
surfing doesn't turn up any promising leads now.  There are multiple  
JVM implementations with GC implementations that scale well (indeed,  
I'd argue that for scalable multiprocessor GC the JVM is presently the  
only game in town).

By the by, there are concrete proposals for tail call support in the  
JVM:

     http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm

[And really, tail call support is relatively easy compared to writing  
a full GC.]  There are a number of things we'd like out of a VM  
infrastructure that the JVM doesn't provide to us directly. Tail calls  
are one, but I'm optimistic that this problem is all but solved.   
Support for unboxing is another, and there is some sign that this is a  
concern for other JVM languages as well.  Finally, we'll need to  
address floating point.  This isn't nearly as bad as it sounds---the  
really tricky issues involve things like inlining strict FP code into  
a context with relaxed FP at JIT time, and more generally respecting  
precise semantics when they're required and using more permissive  
semantics when they're not.  And of course we'd need to provide access  
to things like FP rounding modes and exception flags---though the way  
this is done in IEEE FP is astonishingly poorly suited to fine-grained  
parallel execution, all protestations of W. Kahan (whose indictment of  
Java FP basically says we ought to do what C does) notwithstanding.

I'll mention in passing that Guy Steele recently completed a package  
that does directed FP rounding using pure Java code, which can be  
found in the Fortress distribution in package com.sun.fortress.numerics:

http://projectfortress.sun.com/Projects/Community/browser/trunk/ProjectFortress/src/com/sun/fortress/numerics

These operations can be used from within Fortress programs using the  
_UP and _DOWN forms of the various operators.  Note that the package  
doesn't support full transcendental support---only the four basic  
operations and SQRT are implemented.  Nonetheless, it should permit  
programmers to experiment a bit, and it wouldn't be hard to wrap RR64  
(in the spirit of the CaseInsensitiveString wrapper) to provide a  
floating-point type that rounds all operations in a particular  
direction.

-Jan

-Jan

> -- 
> Dr Jon D Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/products/?e

Jon Harrop | 16 May 19:10
Favicon

Re: Fortress without JVM

On Friday 16 May 2008 14:53:23 Jan-Willem Maessen wrote:
> realize that what I was remembering was really Jon's point below:
>
> On May 15, 2008, at 6:24 PM, Jon Harrop wrote:
> > However, a parallel functional language needs a performant
> > concurrent GC and
> > tail calls but Microsoft's CLR is the only VM to offer both of those
> > features
> > together.
>
> Developing a fast parallel GC (for low overhead) or concurrent GC (for
> low and predictable pauses) requires programmer-years of investment.

Yes.

> I didn't see any sign of such a project for LLVM back then, and quick
> surfing doesn't turn up any promising leads now.

Jane St. Capital are funding a summer project to implement a simple parallel 
GC for OCaml and the authors were keen to support LLVM when I spoke to them.

There does not seem to be a concerted effort to create anything comparable to 
Microsoft's CLR though.

> There are multiple JVM implementations with GC implementations that scale
> well (indeed, I'd argue that for scalable multiprocessor GC the JVM is
> presently the only game in town).

.NET?

> By the by, there are concrete proposals for tail call support in the
> JVM:
>
>      http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm
>
> [And really, tail call support is relatively easy compared to writing
> a full GC.]. There are a number of things we'd like out of a VM 
> infrastructure that the JVM doesn't provide to us directly. Tail calls
> are one, but I'm optimistic that this problem is all but solved.

I do not share your optimism. Users have been demanding tail calls for years. 
Sun have been proposing tail calls for years. I'm sure they have even had 
meeting to discuss the proposals but they haven't actually done anything.

I suspect the problem is that Sun have massively prematurely optimized their 
JVM implementation in ways that depend upon not having tail calls, structs 
and other basic features.

> Support for unboxing is another, and there is some sign that this is a
> concern for other JVM languages as well.

Absolutely. This would make complex numbers usable in Java, if nothing else.

> Finally, we'll need to 
> address floating point.  This isn't nearly as bad as it sounds---the
> really tricky issues involve things like inlining strict FP code into
> a context with relaxed FP at JIT time, and more generally respecting
> precise semantics when they're required and using more permissive
> semantics when they're not.  And of course we'd need to provide access
> to things like FP rounding modes and exception flags---though the way
> this is done in IEEE FP is astonishingly poorly suited to fine-grained
> parallel execution, all protestations of W. Kahan (whose indictment of
> Java FP basically says we ought to do what C does) notwithstanding.

I am actually completely agnostic about strict FP like rounding modes. I think 
the market for that is tiny compared to the market for structs or tail calls.

In the meantime, Microsoft are years ahead and are due to productize their 
next generation language F# later this year (which is their answer to 
Fortress in a way). I doubt Sun will even release basic tail call support 
before then.

--

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

David Chase | 16 May 20:14
Favicon

Re: Fortress without JVM


On 2008-05-16, at 1:10 PM, Jon Harrop wrote:
> On Friday 16 May 2008 14:53:23 Jan-Willem Maessen wrote:
>> By the by, there are concrete proposals for tail call support in the
>> JVM:
>>
>>      http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm
>>
>> [And really, tail call support is relatively easy compared to writing
>> a full GC.]. There are a number of things we'd like out of a VM
>> infrastructure that the JVM doesn't provide to us directly. Tail  
>> calls
>> are one, but I'm optimistic that this problem is all but solved.
>
> I do not share your optimism. Users have been demanding tail calls  
> for years.
> Sun have been proposing tail calls for years. I'm sure they have  
> even had
> meeting to discuss the proposals but they haven't actually done  
> anything.

> I suspect the problem is that Sun have massively prematurely  
> optimized their
> JVM implementation in ways that depend upon not having tail calls,  
> structs
> and other basic features.

That is hardly the reason.  Tail call is generally easy to add to a  
compiler.

The problem is that in Java-the-Programming-Language-TM, it is possible
for a program to observe the names of the frames on its stack, AND in  
certain
cases (that I no longer precisely recall, but I did do the exercise  
while working
on a not-at-Sun, Brand-X JVM) security depends upon this.  As long as  
Java
is the main client of the JVM, tail call's not that useful, because  
(at least in the
previous millenium) Java had no use for it.  Two things have happened
since then:

1) different languages are being (seriously) supported on the JVM.
2) different people are making these decisions.

Different conditions, different people, you're likely to get  
different results.

yours,

David Chase

Jon Harrop | 17 May 00:29
Favicon

Re: Fortress without JVM

On Friday 16 May 2008 19:14:37 David Chase wrote:
> On 2008-05-16, at 1:10 PM, Jon Harrop wrote:
> > I suspect the problem is that Sun have massively prematurely
> > optimized their
> > JVM implementation in ways that depend upon not having tail calls,
> > structs
> > and other basic features.
>
> That is hardly the reason.  Tail call is generally easy to add to a
> compiler.

That changes when you have a concurrent GC that needs to keep track of return 
locations and a bytecode verifier that wants to statically enforce 
constraints (e.g. you cannot tail call into a different security context) and 
a debugger that believes loops and recursion are somehow inherently 
different.

Indeed, if it were easy Sun would surely have already done it given the high 
demand and competition.

> The problem is that in Java-the-Programming-Language-TM, it is possible
> for a program to observe the names of the frames on its stack, AND in
> certain cases (that I no longer precisely recall, but I did do the exercise
> while working on a not-at-Sun, Brand-X JVM) security depends upon this.  As
> long as Java is the main client of the JVM, tail call's not that useful,
> because (at least in the previous millenium) Java had no use for it.  Two
> things have happened since then:
>
> 1) different languages are being (seriously) supported on the JVM.
> 2) different people are making these decisions.
>
> Different conditions, different people, you're likely to get
> different results.

We stopped holding our breath a year ago and ditched our ideas of building 
upon the JVM entirely because those results never materialized. They still 
have not materialized and, in fact, there is no indication that work is even 
continuing in this area.

My bets are on Microsoft releasing their productized next-generation 
functional programming language for technical computing before Sun even get 
around to implementing tail calls in the JVM.

--

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

Doug Lea | 17 May 12:44

Re: Fortress without JVM

David Chase wrote:
  > That is hardly the reason.  Tail call is generally easy to add to a compiler.
>  Two things have happened since then:
> 
> 1) different languages are being (seriously) supported on the JVM. 2)
> different people are making these decisions.
> 
> Different conditions, different people, you're likely to get different 
> results.
> 

Right. Most people working on the platform (JVM and core JDK libraries)
are very much focused these days on improving performance of all
languages running on JVMs. This includes the lightweight parallelism
library support I've been working on, that will (likely) be a Java7
core library, but probably used more via Fortress, X10, Scala, etc
than Java, and designed accordingly. (Fortress is using a preliminary
version now.)

The same for tail calls, continuations, and especially
{packed, embedded, colocated} {objects, values, structs, tuples},
which are a high priority for multicore parallelism. Getting
these in place is mainly an issue in gathering people to help do it and
coordinating efforts. John Rose has sketched out some plans
for some of these at http://blogs.sun.com/jrose/ (see also discussion
of tail calls by Cliff Click at http://blogs.azulsystems.com/cliff/).
Now that the Sun JVM is open source (similarly for Harmony
if you don't want to work on hotspot), it would be great to
see other people working on such things.

(Short version: Stop whining and get to work!)

-Doug

Konrad Hinsen | 17 May 11:53
Favicon

Re: Fortress without JVM

On 16.05.2008, at 19:10, Jon Harrop wrote:
> On Friday 16 May 2008 14:53:23 Jan-Willem Maessen wrote:

> There does not seem to be a concerted effort to create anything  
> comparable to Microsoft's CLR though.
>
>> There are multiple JVM implementations with GC implementations  
>> that scale
>> well (indeed, I'd argue that for scalable multiprocessor GC the  
>> JVM is
>> presently the only game in town).
>
> .NET?

.NET is a very limited environment in that it is tied to Windows. Do  
you know if Mono has anything similar, or if there are plans to go  
that way?

>> Support for unboxing is another, and there is some sign that this  
>> is a
>> concern for other JVM languages as well.
>
> Absolutely. This would make complex numbers usable in Java, if  
> nothing else.

The lack of unboxing is what has made me avoid JVM-based languages in  
the past, and I was very surprised to find out on this list that  
Fortress is meant to stay JVM-bound in the foreseeable future for  
this reason. There are lots of small-and-immutable objects in  
scientific computing (vectors for geometry are another example), so I  
don't see how a language/implementation that imposes a significant  
overhead on them can claim to be suitable for scientific applications.

Konrad.

Jan-Willem Maessen | 17 May 16:00
Favicon

Re: Fortress without JVM


On May 17, 2008, at 5:53 AM, Konrad Hinsen wrote:
>>> ...
>>> Support for unboxing is another, and there is some sign that this  
>>> is a
>>> concern for other JVM languages as well.
>>
>> Absolutely. This would make complex numbers usable in Java, if  
>> nothing else.
>
> The lack of unboxing is what has made me avoid JVM-based languages  
> in the past, and I was very surprised to find out on this list that  
> Fortress is meant to stay JVM-bound in the foreseeable future for  
> this reason. There are lots of small-and-immutable objects in  
> scientific computing (vectors for geometry are another example), so  
> I don't see how a language/implementation that imposes a significant  
> overhead on them can claim to be suitable for scientific applications.

Note that there are ways of doing unboxing within the JVM, but they  
require doing something akin to C++ template instantiation when a  
polymorphic type is instantiated with a value type---but note that  
this is no different than what the underlying VM would do on our  
behalf if it supported unboxing.  The chief benefits of doing it at  
the VM level are:
   * Native unboxed arrays (otherwise we need to roll something rather  
special).  For HPC this is big, though arrays-containing-pointers are  
the tricky problem here and HPC codes tend not to have very many of  
those.
   * Unboxed return (or equivalently multiple value return); we have  
to fake this without VM support.
   * Integrated with the VM's idea of the type hierarchy (a problem in  
general if you don't design the language around the VM's type system;  
arguably Scala and the .Net languages start with the VM type system  
and figure out how to glue a sensible language on top).
   * We wouldn't have to roll the support ourselves.

Note that building on the VM type system can be viewed as a virtue,  
particularly if the VM type system is sufficiently flexible.  One of  
our goals in Fortress was to see where we'd end up if we *didn't*  
impose that constraint up front.

-Jan-Willem Maessen

>
>
> Konrad.
>

Jon Harrop | 17 May 16:50
Favicon

Re: Fortress without JVM

On Saturday 17 May 2008 15:00:55 Jan-Willem Maessen wrote:
> On May 17, 2008, at 5:53 AM, Konrad Hinsen wrote:
> >>> ...
> >>> Support for unboxing is another, and there is some sign that this
> >>> is a
> >>> concern for other JVM languages as well.
> >>
> >> Absolutely. This would make complex numbers usable in Java, if
> >> nothing else.
> >
> > The lack of unboxing is what has made me avoid JVM-based languages
> > in the past, and I was very surprised to find out on this list that
> > Fortress is meant to stay JVM-bound in the foreseeable future for
> > this reason. There are lots of small-and-immutable objects in
> > scientific computing (vectors for geometry are another example), so
> > I don't see how a language/implementation that imposes a significant
> > overhead on them can claim to be suitable for scientific applications.
>
> Note that there are ways of doing unboxing within the JVM, but they
> require doing something akin to C++ template instantiation when a
> polymorphic type is instantiated with a value type---but note that
> this is no different than what the underlying VM would do on our
> behalf if it supported unboxing.

You cannot dynamically link templated code. Hence, unboxing needs to be in the 
VM.

--

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

Jon Harrop | 17 May 18:21
Favicon

Re: Fortress without JVM

On Saturday 17 May 2008 10:53:04 Konrad Hinsen wrote:
> On 16.05.2008, at 19:10, Jon Harrop wrote:
> > On Friday 16 May 2008 14:53:23 Jan-Willem Maessen wrote:
> >
> > There does not seem to be a concerted effort to create anything
> > comparable to Microsoft's CLR though.
> >
> >> There are multiple JVM implementations with GC implementations
> >> that scale
> >> well (indeed, I'd argue that for scalable multiprocessor GC the
> >> JVM is
> >> presently the only game in town).
> >
> > .NET?
>
> .NET is a very limited environment in that it is tied to Windows. Do
> you know if Mono has anything similar, or if there are plans to go
> that way?

Mono leaks like a sieve, runs like a dog and hasn't improved at all in either 
respect for a long time. Reimplementing the CLR is an incredibly difficult 
task after all and, at the end of the day, you get what you pay for.

> >> Support for unboxing is another, and there is some sign that this
> >> is a
> >> concern for other JVM languages as well.
> >
> > Absolutely. This would make complex numbers usable in Java, if
> > nothing else.
>
> The lack of unboxing is what has made me avoid JVM-based languages in
> the past, and I was very surprised to find out on this list that
> Fortress is meant to stay JVM-bound in the foreseeable future for
> this reason.

Well, that is desperation due to a complete lack of options. Fortress requires 
the same foundation that F# does but that foundation is simply not available 
outside the Microsoft-only world of .NET.

> There are lots of small-and-immutable objects in 
> scientific computing (vectors for geometry are another example), so I
> don't see how a language/implementation that imposes a significant
> overhead on them can claim to be suitable for scientific applications.

I actually did some fairly extensive benchmarking of the value of unboxing in 
F# for a variety of different tasks (everything from signal processing to 
graphics) and found that only unboxed complex numbers represent a significant 
performance improvement. Unboxed vectors (even 2D ones!) show insignificant 
performance differences.

So I would endorse simply augmenting the JVM with a complex number primitive.

Incidentally, a boxed complex FFT is ~6x slower than a float-based FFT but an 
unboxed struct complex FFT on .NET is currently ~2-3x slower. So their struct 
implementation has a lot of room for improvement.

--

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

HeikoWengler | 16 May 09:27

Re: Fortress without JVM

Hi!
-------- Original-Nachricht --------
> Datum: Thu, 15 May 2008 15:54:32 -0400
> Von: Jan-Willem Maessen <Janwillem.Maessen@...>
> An: language@...
> Betreff: Re: Fortress without JVM

> 
> On May 12, 2008, at 11:16 AM, Michael Spiegel wrote:
> 
> > One possibility for long-term goals is to implement a runtime for  
> > Fortress using the Low Level Virtual Machine (LLVM) compiler  
> > infrastructure: http://llvm.org/.  However, I am quite ignorant in  
> > my virtual machine knowledge and so there are probably reasons why  
> > this is a bad suggestion.
> 
> The simple reason: LLVM does not support garbage collection so far as  
> I understand.  Supporting GC on top of a non-GC-aware compiler is  
> painful and slows code down, as anyone who's bootstrapped a GC'd  
> language on top of C can tell you.

LLVM supports GC. http://llvm.org/docs/GarbageCollection.html

Heiko

--

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf <at> gmx

David Chase | 13 May 20:49
Favicon

Re: Fortress without JVM

> I think the issue here is that Fortress is being aimed at  
> scientific computing. That domain is currently being dominated by  
> FORTRAN, C, C++, MATLAB and Mathematica. There are other libraries  
> useful too like OpenMP, MPI, BLAS and LAPACK.

> So, a sort of a "vision statement" (if there is any) will be  
> helpful. eg. Is Fortress being envisioned as a JVM language ?

I think that Fortress is envisioned as a programming language, but in  
the short-to-medium term, we plan to be hosted on the JVM.  If/when  
that is the largest cause of performance difficulties, then I think  
we reconsider.  That's years out, and, given that the JVM has largely  
been open-sourced who knows where it will be by then.

See, for instance, John Rose's blog: http://blogs.sun.com/jrose/ .   
Right now they're making changes for dynamic languages, but that's  
more change than I recall seeing in the VM for quite a few years.   
Some of those changes (interface injection, in particular) will make  
it much, much easier to host Fortress on the JVM.

If you look at the full suite of functionality provided by a JVM,  
it's a minimum of 25 person-years of hard work (some of this is based  
on personal experience, some of this is based on history of other  
similar projects) if you include all the features that make a VM  
interesting, and that estimate may be low by a factor of 4 or 10, if  
you include QA, etc.  That's a lot of work we'd like to avoid  
duplicating.

> If so then are there JVM spec changes being investigated that would  
> allow things like MPI (or something superior), superior floating  
> point performance, easier linking with LAPACK, BLAS, and tons of  
> stuff already available in FORTRAN (and may be C/C++ stuff too).

Yes, no, maybe.

The short answer is, you don't always need VM changes, but maybe  
instead you need a motivated compiler-writer.  The mapping from  
source code to object code is sometimes convoluted in ways that  
surprise normal humans.  The best interfaces to Fortran might use  
some of the unsafe Java extensions.  Best FP probably does require VM  
changes, but by the time we get to that being the most important  
performance problem for Fortress, perhaps those changes will already  
have happened.  One option is to change the JVM in ways that would  
allow it to run Fortran directly (Fortran's cleaner than C, at least  
to a compiler writer, so that is an easier job) and thus there would  
be no native translation barrier.

> Keep in mind that HPC crowd already deals with things like  
> optimizing cache access, coding parts of code in SSE etc which are  
> impossible to do with JVM. So some quite radical changes will be  
> needed in JVM if Fortress is being envisaged as a JVM language.

I think that there's "impossible", and merely tricky.  If the SSE  
semantics can be described in standard Java/bytecodes, or if their  
behavior can be defined in an "intrinsic" or "native" function, it is  
entirely likely that a (dynamic) compiler could recognize the idiom/ 
intrinsic/native and perform inline substitution.  The advantage of  
doing it like this is that the resulting code is still portable to  
machines that lack SSE hardware -- if you use the C trick of  
including inline assembly language, that code just plain won't port.   
Recognizing idioms/intrinsics is standard tech in compilers, given  
motivated compiler writers.  For example, in (32-bit) C, you might write

   long long int xy =
      ((long long int) x << 32) +
      ((long long int) y & 0xffffffffLL)

and get it compiled into register moves (or perhaps it is all done in  
the register allocator).

Or, if you needed a 32x32 into 64 multiplication, you might write

   unsigned long long int xy =
     ((unsigned long long int) x & 0xffffffffLL) *
     ((unsigned long long int) y & 0xffffffffLL)

The code generator contains patterns for the "obvious" ways to say  
this, and all the widening and masking vanishes, to be replaced by a  
simple (on Sparc v8, including mandated nops) UMUL x, y, xylo; nop;  
nop; nop; rdy xyhi.

These are not contrived examples -- I wrote recognizers for these  
very patterns in a compiler developed 15 years ago.  That same  
compiler had a delightful facility for "inline intrinsics" that would  
probably deal with SSE.

David


Gmane