[Dwarf-Discuss] Vector base types...

Relph, Richard Richard.Relph@amd.com
Mon Oct 31 18:44:03 GMT 2011

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.
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).
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@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