[Cython] memory view creation during cascaded assignments

2014-07-05 Thread Stefan Behnel
Hi,

I started optimising cascaded assignments a little to reduce the
unnecessary duplication of coercions. While doing that, I found this test
in memslice.pyx:

'''
def cascaded_buffer_assignment(obj):
"""
>>> A = IntMockBuffer("A", range(6))
>>> cascaded_buffer_assignment(A)
acquired A
acquired A
released A
released A
"""
cdef int[:] a, b
a = b = obj
'''

It's explicitly tested for that we create two independent memory views in
this case. Is there an actual reason for this? As long as the types of a
and b are identical, I don't see why we would want to request the buffer twice.

Stefan
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] memory view creation during cascaded assignments

2014-07-05 Thread Mark Florisson
Hi Stefan,

On 5 July 2014 11:34, Stefan Behnel  wrote:
> Hi,
>
> I started optimising cascaded assignments a little to reduce the
> unnecessary duplication of coercions. While doing that, I found this test
> in memslice.pyx:
>
> '''
> def cascaded_buffer_assignment(obj):
> """
> >>> A = IntMockBuffer("A", range(6))
> >>> cascaded_buffer_assignment(A)
> acquired A
> acquired A
> released A
> released A
> """
> cdef int[:] a, b
> a = b = obj
> '''
>
> It's explicitly tested for that we create two independent memory views in
> this case. Is there an actual reason for this? As long as the types of a
> and b are identical, I don't see why we would want to request the buffer 
> twice.

I think it's mostly for simplicity, since any reaching definition is
cleared at the end of the function. Are you thinking to generally
implement this? I suppose you could assign the coercion to a new
variable and replace all use sites (e.g. all the coercions in the
cascaded assignment) with that variable.

 obj = ...
 a = coerce obj int[:]
 b = coerce obj int[:]

->

obj = ...
tmp = coerce obj int[:]
a = tmp
b = tmp

These transformations may be easier on a three-address code-like
representation, where this sort of replacement can be more effective
in SSA form or by first applying copy propagation. Perhaps if the
coercion was explicit a CSE pass could even eliminate any duplicates.

Cheers,
Mark

> Stefan
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Travis-ci builds of OSX wheels

2014-07-05 Thread Robert Bradshaw
On Fri, Jul 4, 2014 at 3:04 PM, Matthew Brett  wrote:
> On Fri, Jul 4, 2014 at 5:51 AM, Robert Bradshaw  wrote:
>> Sure!
>>
>> On Thu, Jul 3, 2014 at 3:49 AM, Matthew Brett  
>> wrote:
>>> Hi,
>>>
>>> We just got scikit-image OSX wheel builds more or less fully automated
>>> on travis-ci :
>>>
>>> https://travis-ci.org/scikit-image/scikit-image-wheels
>>> https://github.com/scikit-image/scikit-image-wheels
>>>
>>> Any interest in getting the same thing working for Cython?
>>>
>>> Cheers,
>>>
>>> Matthew
>
> Done:
>
> https://github.com/matthew-brett/cython-wheels
> https://travis-ci.org/matthew-brett/cython-wheels
> http://wheels.scikit-image.org
>
> When y'all have permission, you should be able to click on the refresh
> button on the travis page and get built wheels in the http directory,
> after 20 minutes or so.  It's set up to checkout and build the latest
> tag'ed commit.
>
> Feel free to just clone this repo and push to the Cython organization.
> I can then send you a PR updating the rackspace credentials to match
> the new repo.

Forked at https://github.com/cython/cython-wheels
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Travis-ci builds of OSX wheels

2014-07-05 Thread Matthew Brett
Hi,

On Sun, Jul 6, 2014 at 1:31 AM, Robert Bradshaw  wrote:
> On Fri, Jul 4, 2014 at 3:04 PM, Matthew Brett  wrote:
>> On Fri, Jul 4, 2014 at 5:51 AM, Robert Bradshaw  wrote:
>>> Sure!
>>>
>>> On Thu, Jul 3, 2014 at 3:49 AM, Matthew Brett  
>>> wrote:
 Hi,

 We just got scikit-image OSX wheel builds more or less fully automated
 on travis-ci :

 https://travis-ci.org/scikit-image/scikit-image-wheels
 https://github.com/scikit-image/scikit-image-wheels

 Any interest in getting the same thing working for Cython?

 Cheers,

 Matthew
>>
>> Done:
>>
>> https://github.com/matthew-brett/cython-wheels
>> https://travis-ci.org/matthew-brett/cython-wheels
>> http://wheels.scikit-image.org
>>
>> When y'all have permission, you should be able to click on the refresh
>> button on the travis page and get built wheels in the http directory,
>> after 20 minutes or so.  It's set up to checkout and build the latest
>> tag'ed commit.
>>
>> Feel free to just clone this repo and push to the Cython organization.
>> I can then send you a PR updating the rackspace credentials to match
>> the new repo.
>
> Forked at https://github.com/cython/cython-wheels

OK - then I will try deleting my repo and see what happens.

Can you activate travis testing for that repo?  Then I'll set the credentials.

Cheers,

Matthew
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Travis-ci builds of OSX wheels

2014-07-05 Thread Robert Bradshaw
On Sat, Jul 5, 2014 at 6:27 PM, Matthew Brett  wrote:
> Hi,
>
> On Sun, Jul 6, 2014 at 1:31 AM, Robert Bradshaw  wrote:
>> On Fri, Jul 4, 2014 at 3:04 PM, Matthew Brett  
>> wrote:
>>> On Fri, Jul 4, 2014 at 5:51 AM, Robert Bradshaw  wrote:
 Sure!

 On Thu, Jul 3, 2014 at 3:49 AM, Matthew Brett  
 wrote:
> Hi,
>
> We just got scikit-image OSX wheel builds more or less fully automated
> on travis-ci :
>
> https://travis-ci.org/scikit-image/scikit-image-wheels
> https://github.com/scikit-image/scikit-image-wheels
>
> Any interest in getting the same thing working for Cython?
>
> Cheers,
>
> Matthew
>>>
>>> Done:
>>>
>>> https://github.com/matthew-brett/cython-wheels
>>> https://travis-ci.org/matthew-brett/cython-wheels
>>> http://wheels.scikit-image.org
>>>
>>> When y'all have permission, you should be able to click on the refresh
>>> button on the travis page and get built wheels in the http directory,
>>> after 20 minutes or so.  It's set up to checkout and build the latest
>>> tag'ed commit.
>>>
>>> Feel free to just clone this repo and push to the Cython organization.
>>> I can then send you a PR updating the rackspace credentials to match
>>> the new repo.
>>
>> Forked at https://github.com/cython/cython-wheels
>
> OK - then I will try deleting my repo and see what happens.
>
> Can you activate travis testing for that repo?  Then I'll set the credentials.

Done.
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel