Quantcast

join points and stream fusion?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

join points and stream fusion?

Christian Höner zu Siederdissen-3
Dear all,

have some of you experienced bad code generation in ghc-8.2-rc1 in
combination with stream fusion from the vector package?

Unfortunately, the problem occurs with ADPfusion code which means no
simple example, but I'm asking because of the following core below.

In ghc-8.0 I have nice core, here however constructor specialization has
not happened, neither with the Left/Right nor with the SPEC.

The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds.

Best,
Christian

joinrec {
  $wfoldlM'_loop2_s1uf4
  $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ
    = case w_s1ueX of { __DEFAULT ->
      case w1_s1ueZ of {
        Left sa_au90 ->
          case sa_au90 of {
            Left sa1_XuNq ->
              case sa1_XuNq of {
                Left sa2_XuNe ->
                  case sa2_XuNe of {
                    SL s2_alTo k_alTp ->
                      case k_alTp of {
                        __DEFAULT ->
                          jump $wfoldlM'_loop2_s1uf4
                            SPEC ww1_s1uf2 lvl211_s1IDG;
                        1# ->
                          jump $wfoldlM'_loop2_s1uf4
                            SPEC ww1_s1uf2 (Left (Left (Left (SR s2_alTo))))

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: join points and stream fusion?

Christian Höner zu Siederdissen-3
As an addendum,

I think what causes this is the following. I have a function
(|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij
xs and ys are two stream-generating functions and (Stream.++)
concatenates streams. In the example I have four streams:
xs_1 ||| xs_2 ||| xs_3 ||| xs_4

However, here I end up with a join point on (++). Further evidenced (?)
by the curious occurance of s1uf4 ... (Left (Left (Left ...))).
Additional calls then are (Left (Left (Right ))) and so on.

It would be really good if (|||) is *not* turned into a join point.

Best,
Christian

* Christian Höner zu Siederdissen <[hidden email]> [27.04.2017 23:30]:

> Dear all,
>
> have some of you experienced bad code generation in ghc-8.2-rc1 in
> combination with stream fusion from the vector package?
>
> Unfortunately, the problem occurs with ADPfusion code which means no
> simple example, but I'm asking because of the following core below.
>
> In ghc-8.0 I have nice core, here however constructor specialization has
> not happened, neither with the Left/Right nor with the SPEC.
>
> The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds.
>
> Best,
> Christian
>
> joinrec {
>   $wfoldlM'_loop2_s1uf4
>   $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ
>     = case w_s1ueX of { __DEFAULT ->
>       case w1_s1ueZ of {
>         Left sa_au90 ->
>           case sa_au90 of {
>             Left sa1_XuNq ->
>               case sa1_XuNq of {
>                 Left sa2_XuNe ->
>                   case sa2_XuNe of {
>                     SL s2_alTo k_alTp ->
>                       case k_alTp of {
>                         __DEFAULT ->
>                           jump $wfoldlM'_loop2_s1uf4
>                             SPEC ww1_s1uf2 lvl211_s1IDG;
>                         1# ->
>                           jump $wfoldlM'_loop2_s1uf4
>                             SPEC ww1_s1uf2 (Left (Left (Left (SR s2_alTo))))
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: join points and stream fusion?

Haskell - Glasgow-haskell-users mailing list
I'm afraid I don't have enough context to understand this thread.

Could you offer a concrete example (as small as possible), and explain how to reproduce the problem you are seeing.  Don't forget to give the compiler version you are using, and any libraries you depend on (as few as poss).

Is this a regression? I.e. did some earlier version of GHC do better on the exact same code?

Maybe open a Trac ticket.

Thanks

Simon

| -----Original Message-----
| From: Glasgow-haskell-users [mailto:glasgow-haskell-users-
| [hidden email]] On Behalf Of Christian Höner zu Siederdissen
| Sent: 27 April 2017 23:10
| To: [hidden email]
| Subject: Re: join points and stream fusion?
|
| As an addendum,
|
| I think what causes this is the following. I have a function
| (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are two
| stream-generating functions and (Stream.++) concatenates streams. In the
| example I have four streams:
| xs_1 ||| xs_2 ||| xs_3 ||| xs_4
|
| However, here I end up with a join point on (++). Further evidenced (?)
| by the curious occurance of s1uf4 ... (Left (Left (Left ...))).
| Additional calls then are (Left (Left (Right ))) and so on.
|
| It would be really good if (|||) is *not* turned into a join point.
|
| Best,
| Christian
|
| * Christian Höner zu Siederdissen <[hidden email]>
| [27.04.2017 23:30]:
| > Dear all,
| >
| > have some of you experienced bad code generation in ghc-8.2-rc1 in
| > combination with stream fusion from the vector package?
| >
| > Unfortunately, the problem occurs with ADPfusion code which means no
| > simple example, but I'm asking because of the following core below.
| >
| > In ghc-8.0 I have nice core, here however constructor specialization
| > has not happened, neither with the Left/Right nor with the SPEC.
| >
| > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds.
| >
| > Best,
| > Christian
| >
| > joinrec {
| >   $wfoldlM'_loop2_s1uf4
| >   $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ
| >     = case w_s1ueX of { __DEFAULT ->
| >       case w1_s1ueZ of {
| >         Left sa_au90 ->
| >           case sa_au90 of {
| >             Left sa1_XuNq ->
| >               case sa1_XuNq of {
| >                 Left sa2_XuNe ->
| >                   case sa2_XuNe of {
| >                     SL s2_alTo k_alTp ->
| >                       case k_alTp of {
| >                         __DEFAULT ->
| >                           jump $wfoldlM'_loop2_s1uf4
| >                             SPEC ww1_s1uf2 lvl211_s1IDG;
| >                         1# ->
| >                           jump $wfoldlM'_loop2_s1uf4
| >                             SPEC ww1_s1uf2 (Left (Left (Left (SR
| > s2_alTo))))
| >
| > _______________________________________________
| > Glasgow-haskell-users mailing list
| > [hidden email]
| > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h
| > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-users&data
| > =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba157d%
| > 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sdata=
| > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
| _______________________________________________
| Glasgow-haskell-users mailing list
| [hidden email]
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask
| ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-
| users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48d
| ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd
| ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: join points and stream fusion?

Christian Höner zu Siederdissen-3
Sorry,

with the addendum, I have constructed a very small example:
https://ghc.haskell.org/trac/ghc/ticket/13623

This is new with ghc 8.2-rc1 and does not show up earlier.

Viele Gruesse,
Christian

* Simon Peyton Jones <[hidden email]> [28.04.2017 00:35]:

> I'm afraid I don't have enough context to understand this thread.
>
> Could you offer a concrete example (as small as possible), and explain how to reproduce the problem you are seeing.  Don't forget to give the compiler version you are using, and any libraries you depend on (as few as poss).
>
> Is this a regression? I.e. did some earlier version of GHC do better on the exact same code?
>
> Maybe open a Trac ticket.
>
> Thanks
>
> Simon
>
> | -----Original Message-----
> | From: Glasgow-haskell-users [mailto:glasgow-haskell-users-
> | [hidden email]] On Behalf Of Christian Höner zu Siederdissen
> | Sent: 27 April 2017 23:10
> | To: [hidden email]
> | Subject: Re: join points and stream fusion?
> |
> | As an addendum,
> |
> | I think what causes this is the following. I have a function
> | (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are two
> | stream-generating functions and (Stream.++) concatenates streams. In the
> | example I have four streams:
> | xs_1 ||| xs_2 ||| xs_3 ||| xs_4
> |
> | However, here I end up with a join point on (++). Further evidenced (?)
> | by the curious occurance of s1uf4 ... (Left (Left (Left ...))).
> | Additional calls then are (Left (Left (Right ))) and so on.
> |
> | It would be really good if (|||) is *not* turned into a join point.
> |
> | Best,
> | Christian
> |
> | * Christian Höner zu Siederdissen <[hidden email]>
> | [27.04.2017 23:30]:
> | > Dear all,
> | >
> | > have some of you experienced bad code generation in ghc-8.2-rc1 in
> | > combination with stream fusion from the vector package?
> | >
> | > Unfortunately, the problem occurs with ADPfusion code which means no
> | > simple example, but I'm asking because of the following core below.
> | >
> | > In ghc-8.0 I have nice core, here however constructor specialization
> | > has not happened, neither with the Left/Right nor with the SPEC.
> | >
> | > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds.
> | >
> | > Best,
> | > Christian
> | >
> | > joinrec {
> | >   $wfoldlM'_loop2_s1uf4
> | >   $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ
> | >     = case w_s1ueX of { __DEFAULT ->
> | >       case w1_s1ueZ of {
> | >         Left sa_au90 ->
> | >           case sa_au90 of {
> | >             Left sa1_XuNq ->
> | >               case sa1_XuNq of {
> | >                 Left sa2_XuNe ->
> | >                   case sa2_XuNe of {
> | >                     SL s2_alTo k_alTp ->
> | >                       case k_alTp of {
> | >                         __DEFAULT ->
> | >                           jump $wfoldlM'_loop2_s1uf4
> | >                             SPEC ww1_s1uf2 lvl211_s1IDG;
> | >                         1# ->
> | >                           jump $wfoldlM'_loop2_s1uf4
> | >                             SPEC ww1_s1uf2 (Left (Left (Left (SR
> | > s2_alTo))))
> | >
> | > _______________________________________________
> | > Glasgow-haskell-users mailing list
> | > [hidden email]
> | > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h
> | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-users&data
> | > =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba157d%
> | > 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sdata=
> | > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
> | _______________________________________________
> | Glasgow-haskell-users mailing list
> | [hidden email]
> | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask
> | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-
> | users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48d
> | ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd
> | ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: join points and stream fusion?

Haskell - Glasgow-haskell-users mailing list
Thank you!

|  -----Original Message-----
|  From: Christian Höner zu Siederdissen [mailto:[hidden email]-
|  leipzig.de]
|  Sent: 28 April 2017 00:14
|  To: Simon Peyton Jones <[hidden email]>
|  Cc: [hidden email]
|  Subject: Re: join points and stream fusion?
|  
|  Sorry,
|  
|  with the addendum, I have constructed a very small example:
|  https://ghc.haskell.org/trac/ghc/ticket/13623
|  
|  This is new with ghc 8.2-rc1 and does not show up earlier.
|  
|  Viele Gruesse,
|  Christian
|  
|  * Simon Peyton Jones <[hidden email]> [28.04.2017 00:35]:
|  > I'm afraid I don't have enough context to understand this thread.
|  >
|  > Could you offer a concrete example (as small as possible), and
|  explain how to reproduce the problem you are seeing.  Don't forget to
|  give the compiler version you are using, and any libraries you depend
|  on (as few as poss).
|  >
|  > Is this a regression? I.e. did some earlier version of GHC do better
|  on the exact same code?
|  >
|  > Maybe open a Trac ticket.
|  >
|  > Thanks
|  >
|  > Simon
|  >
|  > | -----Original Message-----
|  > | From: Glasgow-haskell-users [mailto:glasgow-haskell-users-
|  > | [hidden email]] On Behalf Of Christian Höner zu Siederdissen
|  > | Sent: 27 April 2017 23:10
|  > | To: [hidden email]
|  > | Subject: Re: join points and stream fusion?
|  > |
|  > | As an addendum,
|  > |
|  > | I think what causes this is the following. I have a function
|  > | (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are
|  > | two stream-generating functions and (Stream.++) concatenates
|  > | streams. In the example I have four streams:
|  > | xs_1 ||| xs_2 ||| xs_3 ||| xs_4
|  > |
|  > | However, here I end up with a join point on (++). Further
|  evidenced
|  > | (?) by the curious occurance of s1uf4 ... (Left (Left (Left
|  ...))).
|  > | Additional calls then are (Left (Left (Right ))) and so on.
|  > |
|  > | It would be really good if (|||) is *not* turned into a join
|  point.
|  > |
|  > | Best,
|  > | Christian
|  > |
|  > | * Christian Höner zu Siederdissen <[hidden email]>
|  > | [27.04.2017 23:30]:
|  > | > Dear all,
|  > | >
|  > | > have some of you experienced bad code generation in ghc-8.2-rc1
|  in
|  > | > combination with stream fusion from the vector package?
|  > | >
|  > | > Unfortunately, the problem occurs with ADPfusion code which
|  means
|  > | > no simple example, but I'm asking because of the following core
|  below.
|  > | >
|  > | > In ghc-8.0 I have nice core, here however constructor
|  > | > specialization has not happened, neither with the Left/Right nor
|  with the SPEC.
|  > | >
|  > | > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9
|  seconds.
|  > | >
|  > | > Best,
|  > | > Christian
|  > | >
|  > | > joinrec {
|  > | >   $wfoldlM'_loop2_s1uf4
|  > | >   $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ
|  > | >     = case w_s1ueX of { __DEFAULT ->
|  > | >       case w1_s1ueZ of {
|  > | >         Left sa_au90 ->
|  > | >           case sa_au90 of {
|  > | >             Left sa1_XuNq ->
|  > | >               case sa1_XuNq of {
|  > | >                 Left sa2_XuNe ->
|  > | >                   case sa2_XuNe of {
|  > | >                     SL s2_alTo k_alTp ->
|  > | >                       case k_alTp of {
|  > | >                         __DEFAULT ->
|  > | >                           jump $wfoldlM'_loop2_s1uf4
|  > | >                             SPEC ww1_s1uf2 lvl211_s1IDG;
|  > | >                         1# ->
|  > | >                           jump $wfoldlM'_loop2_s1uf4
|  > | >                             SPEC ww1_s1uf2 (Left (Left (Left (SR
|  > | > s2_alTo))))
|  > | >
|  > | > _______________________________________________
|  > | > Glasgow-haskell-users mailing list
|  > | > [hidden email]
|  > | >
|  https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fma
|  > | > il.h
|  > | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-
|  users&
|  > | > data
|  > | >
|  =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba1
|  > | > 57d%
|  > | >
|  7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd
|  > | > ata=
|  > | > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
|  > | _______________________________________________
|  > | Glasgow-haskell-users mailing list
|  > | [hidden email]
|  > |
|  https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail
|  > | .hask
|  > | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-
|  > |
|  users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a0
|  > | 8d48d
|  > |
|  ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6362892777560708
|  > | 00&sd
|  > | ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Loading...