Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagercon.com>
To: Jim Blandy <jimb@codesourcery.com>
Cc: gdb@sources.redhat.com
Subject: Re: Non-uniform address spaces
Date: Mon, 25 Jun 2007 20:04:00 -0000	[thread overview]
Message-ID: <46801FDD.4020408@eagercon.com> (raw)
In-Reply-To: <m3zm2n6ejt.fsf@codesourcery.com>

Jim Blandy wrote:
> Michael Eager <eager@eagercon.com> writes:
>> This is the problem:  the pervasive assumption in GDB is that a CORE_ADDR
>> is a simple, linear value.   In a NUMA architecture, this is not true.
>> Actual pointers on the hardware may be simple addresses, but they may be
>> in arbitrary address spaces.  The translation to a target address is OK,
>> but the operations on CORE_ADDR are incorrect.
> 
> Can you show me a specific example?

An address on a multiprocessor system can have the following structure:
   <processor, thread, offset>

(Thread may or may not be a real thread of execution -- it represents an
entity that has a certain memory allocation.)

An array can occupy an extent which is distributed across several different
threads or processors.  For example, an array may be split into four
pieces, with each piece allocated to four different processors.  Indexing
an array involves determining which <processor,thread> a subscript is
in, then computing the correct offset within that memory.

> (I think using a 128-bit CORE_ADDR is probably the way to go.)
> 
>> Operations as simple as array indexing may require a computation that
>> is more complex than a simple multiplication.  An array may be split
>> between multiple address spaces.  The computation may not be complex,
>> but it is not as simple as a multiply and addition.
> 
> This, I'd really like to learn more about.

For an example, the SPEs in a Cell processors could be configured
to distribute pieces of an array over different SPEs.

> How do you declare such an array?  How do you index it?  What code is
> generated for an array access?  How does it relate to C's rules for
> pointer arithmetic?

In UPC (a parallel extension to C) there is a new attribute "shared"
which says that data is (potentially) distributed across multiple processors.

In UPC, pointer arithmetic works exactly the same as in C: you can
compare pointers, subtract them to get a difference, and add integers.
The compiler generates code which does the correct computation.

>>> I think you'll find that the operations on CORE_ADDR itself will all
>>> be harmless.  GDB shouldn't be walking off the end of an object
>>> anyway, so if objects don't overlap address space boundaries, then GDB
>>> won't either.
>> The assumption that objects don't cross address space boundaries
>> is not valid.  Multiprocessor systems split data across multiple
>> processors, each of which has a separate data space.
> 
> There I'm using 'object' in the sense the C standard uses it.  If you
> can answer my questions above, I think I'll understand this better.

The C standard doesn't require objects to be contiguous or to be
stored entirely in a single memory space.  Objects can be partially
in memory and partially in registers, for example.  Or an array
can be distributed across multiple address ranges.  (The C standard
[working from an old draft] says "region of data storage", but it
doesn't expand on this definition.)

The only relevant requirement in the C standard is that when you
increment a pointer in an array that the result points to the next
element.  Whether that's a simple addition of a constant or something
more involved is not part of the standard.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


  parent reply	other threads:[~2007-06-25 20:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-23 16:31 Michael Eager
2007-06-23 21:25 ` Daniel Jacobowitz
2007-06-23 21:47   ` Michael Eager
2007-06-23 23:09     ` Daniel Jacobowitz
2007-06-25 17:46     ` Jim Blandy
2007-06-25 18:08       ` Michael Eager
2007-06-25 19:05         ` Jim Blandy
2007-06-25 19:09           ` Daniel Jacobowitz
2007-06-25 20:04           ` Michael Eager [this message]
2007-06-25 22:23             ` Jim Blandy
2007-06-25 22:55               ` Michael Eager
2007-06-25 23:08                 ` basic gdb usage question Matt Funk
     [not found]                   ` <655C3D4066B7954481633935A40BB36F041415@ussunex02.svl.access-company.com>
2007-06-25 23:36                     ` Matt Funk
2007-06-26  1:25                       ` Michael Eager
2007-06-26  3:12                   ` Eli Zaretskii
2007-06-26 16:13                     ` Matt Funk
2007-06-27  3:29                       ` Eli Zaretskii
2007-06-26 16:56                 ` Non-uniform address spaces Jim Blandy
2007-06-26 17:22                   ` Michael Eager
2007-06-26 17:55                     ` Jim Blandy
2007-06-26 18:08                     ` Jim Blandy
2007-06-26 23:08                       ` Michael Eager
2007-06-26 23:39                         ` Jim Blandy

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=46801FDD.4020408@eagercon.com \
    --to=eager@eagercon.com \
    --cc=gdb@sources.redhat.com \
    --cc=jimb@codesourcery.com \
    /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