This page is no longer maintained — Please continue to the home page at www.scala-lang.org

What's the current status of type specialization?

9 replies
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Hi,
Today I tried to implement a demo for @specialized. The compiler did its job, but at runtime I got an AbstractMethodError.What's the current status of type specialization? Should it work?

Heiko

Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Iulian Dragos 2
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: What's the current status of type specialization?
Yes, it should work. Development has slowed down quite a bit since I am writing my thesis, and that's part of the reason specialization is still a -Y option (in other words, use on your own risk). It is for the most part feature-complete, so please file tickets with the bugs you find, that would help us a lot.
thanks,iulian

On Sat, Feb 20, 2010 at 4:40 PM, Heiko Seeberger <heiko.seeberger@googlemail.com> wrote:
Hi,
Today I tried to implement a demo for @specialized. The compiler did its job, but at runtime I got an AbstractMethodError. What's the current status of type specialization? Should it work?

Heiko

Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Re: What's the current status of type specialization?
Iulian,
Thanks for your quick response!

On 20 February 2010 17:20, Iulian Dragos <iulian.dragos@epfl.ch> wrote:
Yes, it should work.

Sounds good ;-) 
Development has slowed down quite a bit since I am writing my thesis, and that's part of the reason specialization is still a -Y option (in other words, use on your own risk). It is for the most part feature-complete, so please file tickets with the bugs you find, that would help us a lot.

Did it: https://lampsvn.epfl.ch/trac/scala/ticket/3085
Thanks,
Heiko
Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Re: What's the current status of type specialization?
Iulian,
You closed the ticket commenting "(In [20949]) Specialized types are not substituted inside type arguments.". I am not sure if I fully understand => Could you please explain?
Thank you,
Heiko
On 21 February 2010 10:05, Heiko Seeberger <heiko.seeberger@googlemail.com> wrote:
Iulian,
Thanks for your quick response!

On 20 February 2010 17:20, Iulian Dragos <iulian.dragos@epfl.ch> wrote:
Yes, it should work.

Sounds good ;-) 
Development has slowed down quite a bit since I am writing my thesis, and that's part of the reason specialization is still a -Y option (in other words, use on your own risk). It is for the most part feature-complete, so please file tickets with the bugs you find, that would help us a lot.

Did it: https://lampsvn.epfl.ch/trac/scala/ticket/3085
Thanks,
Heiko
Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: What's the current status of type specialization?

Hi Heiko,

On Mon, Feb 22, 2010 at 1:33 PM, Heiko Seeberger
wrote:
> Iulian,
> You closed the ticket commenting "(In [20949]) Specialized types are not
> substituted inside type arguments.".
> I am not sure if I fully understand => Could you please explain?

It means that Iulian fixed the bug in that changeset:

https://lampsvn.epfl.ch/trac/scala/changeset/20949

Best,
Ismael

hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Re: What's the current status of type specialization?
Ah, great!
Thanks,
Heiko

On 22 February 2010 14:38, Ismael Juma <mlists@juma.me.uk> wrote:
Hi Heiko,

On Mon, Feb 22, 2010 at 1:33 PM, Heiko Seeberger
<heiko.seeberger@googlemail.com> wrote:
> Iulian,
> You closed the ticket commenting "(In [20949]) Specialized types are not
> substituted inside type arguments.".
> I am not sure if I fully understand => Could you please explain?

It means that Iulian fixed the bug in that changeset:

https://lampsvn.epfl.ch/trac/scala/changeset/20949

Best,
Ismael

--
Heiko Seeberger

Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Iulian Dragos 2
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: What's the current status of type specialization?


On 22 February 2010 14:38, Ismael Juma <mlists@juma.me.uk> wrote:
Hi Heiko,

On Mon, Feb 22, 2010 at 1:33 PM, Heiko Seeberger
<heiko.seeberger@googlemail.com> wrote:
> Iulian,
> You closed the ticket commenting "(In [20949]) Specialized types are not
> substituted inside type arguments.".
> I am not sure if I fully understand => Could you please explain?

It means that Iulian fixed the bug in that changeset:

In short, yes. The problem was that specialized types were propagated too eagerly, so in your example the function literal was typed "Int => SpecializedPair$mcI$sp" instead of "Int => SpecializedPair[Int]". The AbstractMethodError appeared because the apply method in the Function1 trait was implemented at SpecializedPair$mcI$sp.
I ran you example and the speedup was not very impressive. I think that's because the running time was dominated by memory operations (on my system I got around 10.000 L2 cache misses). A better benchmark would be the matrix multiplication routine I checked in in the same commit, under test/files/run/spec-matrix.scala.
iulian

https://lampsvn.epfl.ch/trac/scala/changeset/20949

Best,
Ismael

--
Heiko Seeberger

Work: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: What's the current status of type specialization?

Hi Iulian,

On Mon, Feb 22, 2010 at 2:36 PM, Iulian Dragos wrote:
> I think that's
> because the running time was dominated by memory operations (on my system I
> got around 10.000 L2 cache misses).

Out of curiosity, what did you use to measure the L2 cache misses?

Thanks,
Ismael

Iulian Dragos 2
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: What's the current status of type specialization?


On Mon, Feb 22, 2010 at 3:45 PM, Ismael Juma <mlists@juma.me.uk> wrote:
Hi Iulian,

On Mon, Feb 22, 2010 at 2:36 PM, Iulian Dragos <iulian.dragos@epfl.ch> wrote:
> I think that's
> because the running time was dominated by memory operations (on my system I
> got around 10.000 L2 cache misses).

Out of curiosity, what did you use to measure the L2 cache misses?

Shark, a Mac OS X profiler can read hardware performance counters.
iulian 

Thanks,
Ismael



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: What's the current status of type specialization?

On Mon, Feb 22, 2010 at 4:14 PM, Iulian Dragos wrote:
> Shark, a Mac OS X profiler can read hardware performance counters.
> iulian

Cool, thanks.

Ismael

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland