From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA07344 for caml-redistribution; Wed, 13 Nov 1996 13:58:11 +0100 (MET) 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 PAA16237 for ; Tue, 12 Nov 1996 15:38:44 +0100 (MET) Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id PAA13088 for ; Tue, 12 Nov 1996 15:38:44 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.7.6/8.7.3) with ESMTP id PAA03601 for ; Tue, 12 Nov 1996 15:38:43 +0100 (MET) Received: from rs1.hrz.th-darmstadt.de (rs1.hrz.th-darmstadt.de [130.83.22.60]) by concorde.inria.fr (8.7.6/8.7.1) with SMTP id PAA13073 for ; Tue, 12 Nov 1996 15:38:16 +0100 (MET) Received: from crunch (crunch.ikp.physik.th-darmstadt.de [130.83.24.4]) by rs1.hrz.th-darmstadt.de (8.6.12/8.6.12.0ms) with SMTP id PAA24033 for ; Tue, 12 Nov 1996 15:37:46 +0100 Received: by crunch (AIX 3.2/UCB 5.64/Client-1.5/HRZ-THD) id AA13126; Tue, 12 Nov 1996 15:37:45 +0100 Date: Tue, 12 Nov 1996 15:37:45 +0100 Message-Id: <9611121437.AA13126@crunch> From: Thorsten Ohl To: caml-list@margaux.inria.fr Subject: partial evaluation anyone? Sender: weis [ Sorry, no french version .... ] Continuing the thread on optimizations for numerical code: Is it possible to find out (at run-time) whether some components of a function's return value are discarded by the caller? Example (pseudo code, in real life this is an interface to LAPACK): let diagonalize matrix = (* Compute real and imaginary parts of the eigenvalues and the left and right eigenvectors of MATRIX. *) (wr,wi,vl,vr) Sometimes, one wants the eigenvalues only let (wr,wi,_,_) = diagonalize some_really_big_matrix but since diagonalize doesn't know that the eigenvectors will be thrown away, it will calculate them anyway, which can be substantial overhead for large matrices. One way out would be to clutter the namespace with many different functions, one for each (likely) combination of return values, or to pass this information as a seperate argument (like LAPACK does in Fortran). IMHO, both approaches are ugly kludges and it would be much nicer, if a function could find out which parts of its return value are being thrown away instantly. (Note that I'm not asking for a complete dependency analysis. One level of function invocation would be sufficient to allow the programmers to give the proper hints.) Is there a trick to do this now? Or is there a chance to get the implementors interestet? Cheers, -Thorsten Thorsten Ohl, Physics Department, TH Darmstadt --- PGP: AF 38 FF CE 03 8A 2E A7 http://crunch.ikp.physik.th-darmstadt.de/~ohl/ -------- 8F 2A C1 86 8C 06 32 6B