Unaligning ghc
Alexander Kjeldaas
alexander.kjeldaas at gmail.com
Thu Aug 18 12:43:58 CEST 2011
On 18 August 2011 12:29, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Thu, Aug 18, 2011 at 12:22 PM, Alexander Kjeldaas
> <alexander.kjeldaas at gmail.com> wrote:
> > The Nehalem micro-architecture has made unaligned loads very cheap, as
> long
> > as they do not cross a cache line boundary.
> > I am thinking that this makes it possible for ghc to use 40-bit pointers,
> > and generally use "packed" structure layout. This again should improve
> > performance by increasing the effective CPU cache size.
> > Even given a packed structure layout, the memory allocator could be
> improved
> > to ensure that no object field will cross a cache line by moving the
> object
> > a few bytes in either direction.
> > Comments? How hard-coded is the ghc object layout?
>
> I believe there are lots of assumptions about the alignment of heap
> objects i.e. we use word sized loads which would fail on some
> architectures if allocated memory wasn't word aligned.
>
>
Unaligned word-sized loads work fine on x86, and this would be x86-64 only,
or even Nehalem (and later) only. Or, from a cost perspective, it could
be interesting for non-Nehalem as well, as RAM is (usually) the most
expensive component when running a server. (But anyways, developing
features for pre-Nehalem is slightly pointless IMHO).
So I guess the alignment would be per-architecture or a flag. If it is
currently hardcoded, it would have to be configurable.
Alexander
-- Johan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/cvs-ghc/attachments/20110818/5ef10437/attachment-0001.htm>
More information about the Cvs-ghc
mailing list