Message304807
Yes, I think it is partly convenience. I want to set ...
ndt_mallocfunc = PyMem_Malloc;
ndt_alignedallocfunc = PyMem_AlignedAlloc;
ndt_callocfunc = PyMem_Calloc;
ndt_reallocfunc = PyMem_Realloc;
ndt_freefunc = PyMem_Free;
... so I can always just call ndt_free(), because there's only one memory
allocator.
But the other part is that datashape allows to specify alignment regardless
of the size of the type. Example:
>>> from ndtypes import *
>>> from xnd import *
>>> t = ndt("{a: int64, b: uint64, align=16}")
>>> xnd(t, {'a': 111, 'b': 222})
<xnd.xnd object at 0x7f82750c2a30>
The xnd object essentially wraps a typed data pointer. In the above case, the
'align' keyword has the same purpose as gcc's __attribute__((aligned(16))).
There are several other cases in datashape where alignment can specified
explicitly.
For the convenience case it would already help if PyMem_AlignedAlloc() did
*not* use the fast allocator, but just delegated to _aligned_malloc() (MSVC)
or aligned_alloc() (C11), ... |
|
Date |
User |
Action |
Args |
2017-10-23 14:11:28 | skrah | set | recipients:
+ skrah, tim.peters, rhettinger, pitrou, vstinner, trent, njs, neologix, wscullin |
2017-10-23 14:11:28 | skrah | set | messageid: <1508767888.51.0.213398074469.issue18835@psf.upfronthosting.co.za> |
2017-10-23 14:11:28 | skrah | link | issue18835 messages |
2017-10-23 14:11:28 | skrah | create | |
|