Browse thread
Alignment of data
-
Christophe Papazian
- Goswin von Brederlow
-
Xavier Leroy
- Christophe Papazian
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christophe Papazian <christophe.papazian@g...> |
| Subject: | [Caml-list] Alignment of data |
Dear Xavier Leroy, thank you for your answer >> I am working on some ppc architecture, and I realize that I have a >> (very) big slowdown due to bad alignment of data by ocamlopt. I >> need to have my data aligned in memory depending of the size of the >> data : floats are to be aligned on 8 bytes, int on 4 bytes, etc.... > > First, make sure that misalignment is really the source of your > slowdown. The PowerPC processors I'm familiar with can access > 4-aligned 8-byte floats with minimal overhead, while the penalty is > much bigger for other misalignments. I am sorry, but I am sure of that. I ran some tests to ensure that the problem is coming from that particular point. > Data allocated in the Caml heap is word-aligned, where a word is 4 > bytes on a 32-bit platform and 8 bytes on a 64-bit platform. This is > deeply ingrained in the Caml GC and allocator, so don't expect to > change this easily. I didn't expect to change myself such a deep feature in ocaml, but I hoped that you or somebody in your team could. Could it be possible to have everything 8 aligned on a 32-bit platform with minimum efforts ? Any help is welcomed ! > What you can do, however: > > 1- Use the 64-bit PowerPC port. Everything will be 8-aligned then. Is there a 64-bit PowerPC Linux (ELF) support in ocaml ? I thought it was only a 64-bit PowerPC OSX (Darwin) support... Thank you to Goswin von Brederlow and Pascal Cuoq for their answers, but I should say that I really prefer to use the GC as usual, without rewriting it :) Christophe