caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pal-Kristian Engstad <engstad@naughtydog.com>
To: caml-list@inria.fr
Subject: [Caml-list] Pointers needed for optimization problem.
Date: Wed, 21 Aug 2002 19:33:21 -0700	[thread overview]
Message-ID: <200208211933.21915.engstad@naughtydog.com> (raw)

Hi,

I'm interested in solving a problem I have with automatically generating 
optimal (vector) floating point code. In other words, I want to code a caml 
program that transforms the input description into assembly instructions. For 
regular floating point operations, a good compiler should be able to optimize 
the code:
	
	r := A * x * x + B * x + C

into (if multiplication is more expensive than adds):

	t := A * x
	t := t + B
	t := t * x
	t := t + B
since
	r := (A * x + B) * x + C

Now, this is fairly trivial to do, but if you have an architecture with SIMD 
vector floating point registers and opcodes, a whole range of new interesting 
optimizations can be done. With vector registers, I mean registers that have 
up to 4 floating point values. For instance, a 4-vector times a 4-by-4 matrix 
operation can be coded as:

	acc.xyzw := mtxrow[0].xyzw * vec.x
	acc.xyzw += mtxrow[1].xyzw * vec.y
	acc.xyzw += mtxrow[2].xyzw * vec.z
	res.xyzw = acc.xyzw + mtxrow[3].xyzw * vec.w

Here, each line represent one assembly instruction.

So, what I am looking for is basically pointers to literature that deal with 
issues like these, and since OCaml is a great language for language 
transformations I thought someone on this list would be able to point me in 
the right direction. I _have_ been searching on the net, but I guess I don't 
know the right keywords to search on.

PKE.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2002-08-22  2:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-22  2:33 Pal-Kristian Engstad [this message]
2002-08-23 11:46 ` Xavier Leroy
2002-08-23 12:18   ` Markus Mottl
2002-08-22  4:01 Gurr, David (MED, self)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208211933.21915.engstad@naughtydog.com \
    --to=engstad@naughtydog.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).