[FRIAM] deployable and open source ABMs
Marcus G. Daniels
mgd at santafe.edu
Sat Nov 25 16:24:29 EST 2006
Here is one weakness of native code ahead-of-time compilers relative to
just-in-time compilers embedded in runtimes. I think it is relevant to
HPC applications.
Consider a program made up of some source code which references a third
party library providing a wide variety of features. The third party and
the program author are at different organizations and are not sharing
source code.
Few non-local dynamics of a program can be deduced by an ahead-of-time
compiler, just because it is hard to do that. Without tolerating huge
code bloat and stressing caches, the compiler can't just inline
everything. Worse, it can't even see everything because the libraries
are separately compiled and then linked. (Most compiled object code
just advertises a vector of opaque entry points to the linker, which
itself is dumb.)
Now imagine that certain callers in the program result in a predictable
complement of internal routines in the library always being called, and
that there is an public interface intermediate between the two (e.g. a
message dispatch). The compiler would need to see all of that context
to ensure that the native code would be generated such that branch
prediction on the CPU would never get confused, but it cannot due to the
organization of the typical HPC toolchain.
A CLR or JVM runtime, however, can watch the dynamics of the program and
make experiments on code generation strategies as the code runs. The
ones that pay off can be cached & reused. Here, cross-module inlining
is the desired optimization.
Given the other disadvantages of Java for HPC, I'm not arguing that this
makes up for them, but it's possibly worth thinking about how to learn
from Java approaches in HPC applications.
One way to try that is using a package like Dynamo. What Dynamo does is
treat the non-branching sequences of real instructions as chunks to
thread together into native code. These cached native code chunks can
be selected-for as in a JVM.
http://www.cag.lcs.mit.edu/dynamorio
(Dynamo worked for me in Fedora 5 x86, no luck in Windows, maybe due to
data execution prevention.)
More information about the Friam
mailing list