[Dwarf-Discuss] Vector base types...

Michael Eager eager at eagercon.com
Mon Oct 31 11:59:18 PDT 2011


On 10/31/2011 11:44 AM, Relph, Richard wrote:
> In OpenCL, of course. You can access a variable (v) of vector type (float16) in several different
> ways, subsetting the members of the vector being accessed. v.s0 is the first element (as is v.x),
> v.lo is the first 8 elements, v.hi is the last 8 elements, v.odd is elements 1,3,5, etc. and
> v.even is the even elements.

I'm not familiar with OpenCL.  If these operations are not permitted on arrays,
then an attribute flag would tell the debugger whether to interpret v.s0 as a
reference to v[0] or to issue an error message.

 > In memory, there are alignment restrictions that apply to float16
> that don't apply to an array of floats. The required alignment of the latter is the same as for
> float (4 bytes), while the alignment of the former could be as bad as the size of a single
> float16 (64 bytes).

Allocation restrictions are usually only known to the compiler and not represented in DWARF.

 > Other than that, no differences that I can think of. The debugger is looking
> for a way (short of name recognition) to know which access methods apply to a variable...
> DW_AT_GNU_vector may be an interesting 'flag' to differentiate an array from a vector. Does the
> value mean anything? I tried googling it, but haven't stumbled across the answer to that just
> yet.
>
> -----Original Message----- From: Michael Eager [mailto:eager at eagercon.com] Sent: Monday, October
> 31, 2011 11:18 AM To: Relph, Richard Cc: dwarf-discuss at lists.dwarfstd.org Subject: Re:
> [Dwarf-Discuss] Vector base types...
>
> On 10/31/2011 10:30 AM, Relph, Richard wrote:
>> Is there a convention for representing vector base types in a language?
>>
>> Our language (OpenCL) has 2, 3, 4, 8, and 16 element vectors of each of the normal C base types
>> and we’re currently representing them in an ad hoc way. We’d like to follow whatever convention
>> exists for doing this, but we haven’t figured out what that is. Setting DW_AT_byte_size to the
>> size of one element begs the question of how many, and setting it to the size of the type
>> itself is ambiguous (unless you peek at the name… which we are resisting, though perhaps that
>> “right way”.) A char4, short2, and int all have 4 bytes and the same encoding.
>
> Is there a functional difference between an array and a vector?
>


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




More information about the Dwarf-Discuss mailing list