C++ Logo

SG12

Advanced search

Subject: Re: [ub] C provenance semantics proposal
From: charleyb123 (charleyb123_at_[hidden])
Date: 2019-04-11 08:35:15


>
> >> It seems odd to desire support for equality comparisons, but not
>> >> relational ones.
>> >
>> > Why would that be odd? Relational comparison is much more complex, it
>> > assumes a totally ordered address space. Not all architecture have
>> > that naturally.
>>
>> So, let's talk about segmented 16-bit mode of Intel 8086, where
>> an object is at most 64 KB (one segment).
>>
>
> Arthur O'Dwyer respondeth:

> Intel still has a completely linear address-space; it just represents
> those addresses in a weird redundant way at the bit level.
>
> When we talk about an address-space that is not "totally ordered," I
> picture an address space something like what Cerberus displays graphically:
> it's just a bunch of boxes floating in space, some of which are guaranteed
> to be vertically contiguous (that is, ordered) and some of which aren't.
> Does my mental model correspond to some real-world
> heterogeneous/distributed/associative memory that actually exists, or will
> exist in the next 40 years? I honestly don't know. But the "bunch of boxes
> floating in space" addressing model is really easy to imagine and draw on a
> whiteboard, so I think I understand why it's the model that C and C++ use.
>

I think the non-linear, disjointed address space is increasing with
heterogeneous computing, and will continue to do so.

Current device drivers for CPU/GPU and other "local" compute devices
provide a mechanism to "map" the (separate) address-spaces for the several
local devices into the host memory address space to hide this issue
(presenting an illusion of universal host-linear address space). But, that
is only workable "to-a-point". We already deal with "host-visible" and
"host-non-visible" device memory for local devices that make this
linear-mapping-to-host somewhat problematic.

And, distributed nodes fundamentally *cannot* share an address space, nor
map to a host linear address space. Of course, for distributed address
spaces we have other mechanisms (content-hashing to an identifier like a
UUID, or semantic handles that behave as pointers to include comparison or
relational ordering).

Mostly, I'm hoping that address compare-or-relational operations for the
language are sufficiently rich that algorithms can be authored that happen
to accept in their stead my "fancy pointer" that happens to support these
rich relational operations. If only equality is supported, that's fine,
I'll probably just write different algorithms that use the "fancy pointer"
that happens to support the richer relational form.

--charley



SG12 list run by herb.sutter at gmail.com