9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Paul Lalonde <plalonde@telus.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] speaking of kenc
Date: Fri,  4 May 2007 15:27:00 -0700	[thread overview]
Message-ID: <F3A6ED51-A07D-4A9F-9D31-22C68D11DE80@telus.net> (raw)
In-Reply-To: <9959.1178315907@lunacy.ugrad.cs.cmu.edu>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On May 4, 2007, at 2:58 PM, Dave Eckhardt wrote:
> One possible goal might be a language in which you could
> describe high-level algorithms of a certain class which
> could then be compiled to run well on a Cell (and, to be
> a cool result, on some other thing).  This would probably
> handle not just computation but also the necessary DMA
> to get the data ready.

FWIW, the C++ template goop that I use in my SPU code is all about  
masking the data movements - you don't want virtual-function call  
overhead in cache-lookup functions, nor do you want a different  
version of the code for each data type you want to transfer.  There  
is a relatively limited number of buffer usage patterns.  In  
approximate best to worst performance order these are double-buffered  
input and output, block-random access, struct-sized random access,  
and general pointer-chasing.  I can easily wrap a small language  
around these operations (and have in the past - it's just more  
convenient right now to let GCC maintain it for me).

> Failing that, it seems like what people will be doing for
> a while is writing code carefully tuned to run well on
> exactly one or two particular models of Cell, which seems
> to me likely to look like carefully optimized "inner loop"
> stuff wrapped by glue code which matters less.

Only partly true; the SPU architecture defines the latencies and  
stalls of the various instructions fairly well.  Given my experience  
optimizing SPU code, the 40:1 to 100:1 improvements from data  
restructuring and selective SIMD conversions are worth doing, while  
the per-cycle stall management isn't - there might be another factor  
of 2, or there might not - it's a difficult space for a small reward.

> I have to
> wonder whether it would be less painful to learn the hardware
> and write the optimized code in assembly language or to learn
> the hardware *and* learn how to cajole a complicated compiler
> into emitting the assembly language you know it should be
> emitting.

Doing the streaming/caching/DMA code in assembly is a non-starter.   
It's just that increment of too complicated.  And fortunately, IBM  
went and defined the C language extensions as part of the SPU  
architecture, which means it's not too hard to learn to use.  The  
restrict keyword does gall me though.

> With respect to kencc, I wonder how far you could get if
> each Cell vector instruction were a C-callable .s function
> of a few instructions and the SPU linker routinely inlined
> all small-instruction-count functions and had an optimizer
> explicitly designed for the SPU.

I think this could work quite well; I'm not sure how this interferes  
with register allocation though.  I'll give it some thought.  The  
harder part will be the data movement operations from my first  
paragraph.

Paul

>
> Dave Eckhardt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFGO7M1pJeHo/Fbu1wRAmFvAKDUlDdofVlXv30Lcf3xYPHN6ubX4QCfclYB
te5F+PL5KW2BiF+CvXzyuDQ=
=HTyI
-----END PGP SIGNATURE-----


  reply	other threads:[~2007-05-04 22:27 UTC|newest]

Thread overview: 149+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27  3:08 erik quanstrom
2007-04-27  3:44 ` David Leimbach
2007-04-27  4:56   ` Bruce Ellis
2007-04-27  6:21     ` Skip Tavakkolian
2007-04-27  4:54 ` Joel C. Salomon
2007-04-27  4:58   ` Bruce Ellis
2007-04-27 11:00   ` Charles Forsyth
2007-04-27 13:49     ` David Leimbach
2007-04-27 16:23       ` Douglas A. Gwyn
2007-04-29  2:02         ` erik quanstrom
2007-04-29  2:55           ` Tim Wiess
2007-04-29  6:42             ` Uriel
2007-04-29 20:47           ` Charles Forsyth
2007-04-30  8:29           ` Douglas A. Gwyn
2007-04-30 13:08             ` Uriel
2007-05-01  0:22             ` erik quanstrom
2007-05-01 14:45               ` Jon Snader
2007-05-01 14:56                 ` Devon H. O'Dell
2007-05-01 15:12                   ` erik quanstrom
2007-05-01 15:29                     ` Devon H. O'Dell
2007-05-01 21:32                   ` Jon Snader
2007-05-02  0:04                   ` Derek Fawcus
2007-05-02  8:44                     ` Charles Forsyth
2007-05-01 15:51                 ` Anthony Sorace
2007-05-02  8:32                   ` Douglas A. Gwyn
2007-05-02  9:00                     ` Steve Simon
2007-05-03  1:32                       ` David Arnold
2007-05-03  3:39                         ` Adrian Tritschler
2007-05-03  3:57                           ` Paul Lalonde
2007-05-03  4:11                             ` Federico Benavento
2007-05-03 13:34                               ` Anthony Sorace
2007-05-03 22:04                               ` LiteStar numnums
2007-05-04  1:45                               ` Roman Shaposhnick
2007-05-04  1:51                                 ` Lyndon Nerenberg
2007-05-04  2:00                                 ` erik quanstrom
2007-05-04  2:08                                   ` Roman Shaposhnick
2007-05-04  2:12                                     ` Lyndon Nerenberg
2007-05-04  2:20                                       ` Roman Shaposhnick
2007-05-04  2:35                                         ` Lyndon Nerenberg
2007-05-04  6:53                                           ` Bruce Ellis
2007-05-05  4:49                                             ` Roman Shaposhnick
2007-05-05  5:11                                           ` Roman Shaposhnick
2007-05-05  5:14                                             ` Bruce Ellis
2007-05-05 18:52                                               ` erik quanstrom
2007-05-05 19:13                                                 ` lucio
2007-05-05 23:09                                                   ` Bruce Ellis
2007-05-06  1:24                                                     ` Rogelio Serrano
2007-05-06  4:08                                                   ` erik quanstrom
2007-05-06  4:53                                                     ` W B Hacker
2007-05-06  5:01                                                     ` lucio
2007-05-06  5:01                                                     ` Rogelio Serrano
2007-05-06  5:07                                                       ` Rogelio Serrano
2007-05-06  5:15                                                         ` lucio
2007-05-06  5:37                                                           ` Bruce Ellis
2007-05-06  6:30                                                           ` Rogelio Serrano
2007-05-06  6:46                                                             ` lucio
2007-05-06  6:49                                                             ` lucio
2007-05-06  7:35                                                               ` Rogelio Serrano
2007-05-06  6:51                                                             ` W B Hacker
2007-05-06 10:25                                                               ` Rogelio Serrano
2007-05-06  6:04                                                         ` Skip Tavakkolian
2007-05-06  7:24                                                           ` lucio
2007-05-06 11:47                                                             ` Bruce Ellis
2007-05-07  1:55                                                           ` Roman Shaposhnik
2007-05-06  5:12                                                       ` lucio
2007-05-06 13:18                                                         ` Richard Miller
2007-05-06 20:23                                                           ` Roman Shaposhnik
2007-05-07  1:57                                                         ` Roman Shaposhnik
2007-05-07  4:29                                                           ` W B Hacker
2007-05-07 15:08                                                             ` Tim Wiess
2007-05-06  5:15                                                       ` W B Hacker
2007-05-06  7:43                                                         ` Rogelio Serrano
2007-05-06  8:02                                                           ` W B Hacker
2007-05-06  8:12                                                             ` Rogelio Serrano
2007-05-06  9:00                                                               ` W B Hacker
2007-05-06  8:03                                                           ` lucio
2007-05-06  8:42                                                             ` Rogelio Serrano
2007-05-06 10:20                                                               ` matt
2007-05-06 10:29                                                                 ` Rogelio Serrano
2007-05-06  9:09                                                             ` W B Hacker
2007-05-06  5:10                                                     ` W B Hacker
2007-05-06  5:32                                                       ` lucio
2007-05-06  6:18                                                         ` Rogelio Serrano
2007-05-06  6:30                                                           ` W B Hacker
2007-05-06  6:21                                                         ` W B Hacker
2007-05-07  1:47                                                     ` Roman Shaposhnik
2007-05-06  1:13                                               ` Rogelio Serrano
2007-05-06  3:31                                                 ` W B Hacker
2007-05-06  4:10                                                 ` erik quanstrom
2007-05-06  4:55                                                   ` Rogelio Serrano
2007-05-06  5:10                                                     ` lucio
2007-05-06  6:05                                                       ` W B Hacker
2007-05-06  8:45                                                         ` matt
2007-05-06  6:45                                                       ` Rogelio Serrano
2007-05-06  6:52                                                         ` lucio
2007-05-06  7:09                                                           ` W B Hacker
2007-05-06  7:34                                                             ` Rogelio Serrano
2007-05-06  7:49                                                               ` W B Hacker
2007-05-06  7:54                                                               ` lucio
2007-05-06  8:35                                                                 ` Rogelio Serrano
2007-05-06  7:40                                                             ` lucio
2007-05-06  8:59                                                               ` W B Hacker
2007-05-06  7:03                                                         ` W B Hacker
2007-05-06  5:21                                                 ` Bruce Ellis
2007-05-06  7:01                                                   ` Rogelio Serrano
2007-05-05  5:30                                             ` lucio
2007-05-04  2:16                                     ` erik quanstrom
2007-05-04  9:24                                       ` C H Forsyth
2007-05-04 11:18                                         ` erik quanstrom
2007-05-04 16:19                                         ` Paul Lalonde
2007-05-04 21:58                                           ` Dave Eckhardt
2007-05-04 22:27                                             ` Paul Lalonde [this message]
2007-05-04  8:46                                 ` Douglas A. Gwyn
2007-05-05  4:47                                   ` Roman Shaposhnick
2007-05-02  8:33                 ` Douglas A. Gwyn
2007-05-02 11:25                   ` Jon Snader
2007-05-02  8:33               ` Douglas A. Gwyn
2007-05-02 11:30                 ` erik quanstrom
2007-04-27 16:21     ` Douglas A. Gwyn
2007-04-27 11:12   ` Charles Forsyth
2007-04-27 11:46   ` erik quanstrom
2007-04-27 14:21     ` Joel C. Salomon
2007-04-27 14:26       ` erik quanstrom
2007-04-27 14:41         ` Rob Pike
2007-04-27 14:55         ` Joel C. Salomon
2007-04-27 15:24           ` erik quanstrom
2007-04-27 15:53           ` C H Forsyth
2007-04-28  9:09   ` ron minnich
2007-04-28  9:17     ` Lucio De Re
2007-04-28 13:48       ` Eric Van Hensbergen
2007-04-28 13:57         ` Lucio De Re
2007-04-28 14:15         ` LiteStar numnums
2007-04-28 21:21         ` Roman Shaposhnik
2007-04-28 21:54           ` ron minnich
2007-04-28 22:33             ` Steve Simon
2007-04-28 15:45     ` Charles Forsyth
2007-04-28 17:58       ` Rodrigo Miranda
2007-04-28 20:12         ` Eric Van Hensbergen
2007-04-28 21:10           ` Roman Shaposhnik
2007-04-28 18:15       ` Lluís Batlle i Rossell
2007-04-29  2:39       ` Joel C. Salomon
2007-04-29 12:41         ` erik quanstrom
2007-04-29 16:00           ` Joel C. Salomon
2007-04-28 21:24     ` Roman Shaposhnik
2007-05-06 12:36 erik quanstrom
2007-05-06 15:18 ` lucio
2007-05-06 16:23   ` W B Hacker
2007-05-06 17:53     ` Benn Newman
2007-05-06 17:56       ` Francisco J Ballesteros

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=F3A6ED51-A07D-4A9F-9D31-22C68D11DE80@telus.net \
    --to=plalonde@telus.net \
    --cc=9fans@cse.psu.edu \
    /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).