From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 154CDBC37 for ; Wed, 27 Jan 2010 18:20:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8BAEMFYEvRVdvakGdsb2JhbACRQIlYPQEBAQEJCQwHEwOuH4FChSyINwEBAwWENAQ X-IronPort-AV: E=Sophos;i="4.49,355,1262559600"; d="scan'208";a="50381583" Received: from mail-ew0-f218.google.com ([209.85.219.218]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Jan 2010 18:20:48 +0100 Received: by ewy10 with SMTP id 10so1495987ewy.3 for ; Wed, 27 Jan 2010 09:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=LMoDW6UU/nlIY/NXisZrm0O7VolhanAb0/GbJZ0fymc=; b=AeIDWld0MlUvrBVzcPO/NpjkuXyMY4Zgk2lEV70ENB4oIxYmJ7VrEwAJbV4LMNgMWM jczZNwpvk7RBw2EbZ2p/c52EhYWRH9lugnRH1IM3HZAoyNn1KzzBwaH6Sd5z6uUBvhb1 L5PsPXWDEnjVzW01bY6xIaCtDtK/0t6suuO5w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=RUsnkxdHUFX/SVXFlpjYFk41wlbXeqMAG0S63vXUe2F27TrYfhGsKm7ifUE30ct3Hr +q3ucnpy7yLey7Fp2T1LHZ3874C98NJ04xmdYHJkxhI7N7XtZf3BwZ56lLjXd1m3P0a1 YLn72yiarzTz0NloO+aff7uYDqP+Y1Og6ng6k= Received: by 10.213.97.78 with SMTP id k14mr227391ebn.45.1264612848013; Wed, 27 Jan 2010 09:20:48 -0800 (PST) Received: from ?192.168.0.10? (lau06-2-82-234-138-87.fbx.proxad.net [82.234.138.87]) by mx.google.com with ESMTPS id 23sm253195eya.35.2010.01.27.09.20.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 27 Jan 2010 09:20:46 -0800 (PST) Message-Id: From: Christophe Papazian To: caml-list@yquem.inria.fr In-Reply-To: <4B6066AB.5010907@inria.fr> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: [Caml-list] Alignment of data Date: Wed, 27 Jan 2010 18:20:44 +0100 References: <5876A229-025E-47CE-B02F-4B00CD26BFAB@gmail.com> <4B6066AB.5010907@inria.fr> X-Mailer: Apple Mail (2.936) X-Spam: no; 0.00; christophe:01 christophe:01 alignment:01 alignment:01 ocamlopt:01 aligned:01 aligned:01 powerpc:01 word-aligned:01 allocator:01 ocaml:01 powerpc:01 ocaml:01 cuoq:01 rewriting:01 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