From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id AD2F2BB9A for ; Mon, 26 Sep 2005 18:30:38 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8QGUcQA016809 for ; Mon, 26 Sep 2005 18:30:38 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10990 for ; Mon, 26 Sep 2005 18:30:37 +0200 (MET DST) Received: from conn.mc.mpls.visi.com (conn.mc.mpls.visi.com [208.42.156.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8QGUaqq016806 for ; Mon, 26 Sep 2005 18:30:37 +0200 Received: from [192.168.42.2] (bhurt.dsl.visi.com [208.42.141.66]) by conn.mc.mpls.visi.com (Postfix) with ESMTP id B96058284; Mon, 26 Sep 2005 11:30:35 -0500 (CDT) Date: Mon, 26 Sep 2005 11:30:55 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Stefan Monnier Cc: caml-list Subject: Re: [Caml-list] Re: Ant: Efficiency of let/and In-Reply-To: <87hdc724wo.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> Message-ID: References: <20050926043240.24009.qmail@web26809.mail.ukl.yahoo.com> <87hdc724wo.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 4338222E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4338222C.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 semantically:01 ocamlopt:01 compiler:01 compiler:01 parallelism:01 parallelism:01 foo:01 infeasible:01 prefetching:01 reordering:01 reordering:01 itanium:01 2005,:98 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Mon, 26 Sep 2005, Stefan Monnier wrote: >> Syntactically and semantically there is no difference. I was wondering if >> the ocamlopt compiler took advatange of the implicit paralellism at all. > > If someone tries to use such things as `and' or > unspecified-argument-evaluation-order in the hopes that the compiler will > extract some imagined parallelism is simply deluding himself. > In some cases, the freedom to execute in any order does lead to better > code, but that code rarely if ever uses any kind of parallelism. I was thinking of instruction-level parallelism- the ability of the compiler to reorder instructions to better use the available functional units, not thread-level parallelism. Sorry for not being clear there. I'm not even sure how much extra efficiency is there to be had. Obviously it'd be hard "thread" calls to complex functions, so code like: let foo lst1 lst2 = let len1 = List.length lst1 and len2 = List.length lst2 in ... wouldn't be helped- it'd be computationally infeasible for the compiler to interleave the two different calls to List.length. So you'd pretty obviously be limited to "simple" expressions, at which point the CPU's own prefetching and reordering is likely to do the work for you wether the compiler does it or not. In fact, the CPU's reordering can start executing the code to List.length lst2 speculatively before the call to List.length lst1 is complete, and in that sense the CPU's reordering is more capable then what the compiler can do (this, BTW, is the fundamental problem with the Itanium). Brian