
Hi Folks, Now that the float16 type is in I was wondering if we should do anything to support it in the PEP 3118 buffer interface. This would probably affect the Cython folks as well as the people working on fixing up the structure module <http://bugs.python.org/issue3132>for Python 3.x. There is a fairly long thread about the latter and it also looks like what the Python folks are doing with structure alignment isn't going to be compatible with Numpy structured arrays. Thoughts? Chuck

Thu, 02 Dec 2010 10:20:27 -0700, Charles R Harris wrote:
Now that the float16 type is in I was wondering if we should do anything to support it in the PEP 3118 buffer interface. This would probably affect the Cython folks as well as the people working on fixing up the structure module <http://bugs.python.org/issue3132>for Python 3.x.
Before introducing a PEP 3118 type code for half floats in the PEP, one would need to argue the Python people to add it to the struct module. Before that, the choices probably are: - refuse to export buffers containing half floats - export half floats as two bytes
There is a fairly long thread about the latter and it also looks like what the Python folks are doing with structure alignment isn't going to be compatible with Numpy structured arrays. Thoughts?
I think it would be useful for the Python people to have feedback from us here. AFAIK, the native-aligned mode that was discussed there is compatible with what dtype(..., align=True) produces: Numpy aligns structs as given by the maximum alignment of its fields. -- Pauli Virtanen

On Thu, Dec 2, 2010 at 10:16 AM, Pauli Virtanen <pav@iki.fi> wrote:
Before introducing a PEP 3118 type code for half floats in the PEP, one would need to argue the Python people to add it to the struct module.
Before that, the choices probably are:
- refuse to export buffers containing half floats
I think this is the better option, code that needs to do this can create an int16 view for the time being.
- export half floats as two bytes
This would throw away the byte-order, a problem much harder to track down for the user than the other option. -Mark

Fri, 03 Dec 2010 09:23:15 -0800, Mark Wiebe wrote: [clip]
- refuse to export buffers containing half floats
I think this is the better option, code that needs to do this can create an int16 view for the time being.
That's also easier to implement -- no changes are needed :) Pauli
participants (3)
-
Charles R Harris
-
Mark Wiebe
-
Pauli Virtanen