Tiled memory

Shankar Unni shankar@chromatic.com
Mon Mar 17 12:14:00 GMT 1997


root <root@jacob.remcomp.fr> wrote:

> > i.e. if you declare
> >       _tiled int vector1[1024],vector2[1024],vector3[1024];

and Chin Chee-Kai <cheekai@gen.co.jp> replied:

> This sort of special treatment should be included into some
> sort of optimizing flags, or parallelization flags to tell
> compiler to automatically process, or group instructions to
> process, them in parallel.

I sort of agree with you here. But it's always possible to treat this on
two levels. 

One is to say that we consider this "multimedia data" (for lack of a
better term: "vectors"?) as a special data kind, made up of streams of
packed 8, 16 or 32-bit quantities, and have a special kind for them,
with restrictions (i.e. cannot declare single _tiled int's, and so on). 

This makes it easier on the compiler writer to get off the ground, and
it is not terribly hard on the programmer, because it is usually clear
which variables are your media (or otherwise packed streams or vectors),
and where you are passing them around. 

While you (as a programmer) won't get the most general and powerful
optimizations for all of your character data, you'll get a substantial
benefit for a small expenditure of effort.

> On the other hand, the "_saturated" declarative is perhaps
> necessary as a type modifier (like "unsigned", "long long" etc).

Here, on the other hand, I strongly disagree.  

Saturatedness is not a feature of the data per se, but a feature of the
operation you perform on them. I.e. there will be occasions on which you
want to perform saturating adds on vectors, and other times when you
want to perform non-saturating operations.

What you need for this case is some sort of operator or builtin function
to perform your saturating operations for you.  The most obvious way of
doing this is to add builtin functions for this:

  vector3 = __saturated_add(vector1, vector2)

or, if you want to play games, you can invent either inline operators
(+|, -|, etc.?) or some sort of functional notation like

  vector3 = __saturated(vector1 + vector2)

where __saturated(expression) is treated by the compiler as putting a
"__saturated" attribute on all the arithmetic operators contained
within, if applicable (and maybe error out if not applicable).

-- 
Shankar Unni                                  shankar@chromatic.com
Chromatic Research                            (408) 752-9488
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list