[GHC] #13966: Skip-less stream fusion: a missed opportunity
GHC
ghc-devs at haskell.org
Wed Sep 27 13:24:36 UTC 2017
#13966: Skip-less stream fusion: a missed opportunity
-------------------------------------+-------------------------------------
Reporter: jmspiewak | Owner: mpickering
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1-rc3
Resolution: | Keywords: JoinPoints,
| StaticArgumentTransformation
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #14067 #14068 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by mpickering):
Implementing this leads to:
{{{
benchmarking Skip-less
time 632.2 ms (532.7 ms .. 835.8 ms)
0.988 R² (0.976 R² .. 1.000 R²)
mean 1.187 s (1.044 s .. 1.308 s)
std dev 191.0 ms (0.0 s .. 207.9 ms)
variance introduced by outliers: 46% (moderately inflated)
benchmarking Skip
time 904.3 ms (904.1 ms .. 904.8 ms)
1.000 R² (1.000 R² .. 1.000 R²)
mean 1.230 s (1.130 s .. 1.306 s)
std dev 114.9 ms (0.0 s .. 130.3 ms)
variance introduced by outliers: 22% (moderately inflated)
}}}
And the core looks quite similar:
{{{
chain1
= \ (w_s9yo :: Int) ->
case w_s9yo of { GHC.Types.I# ww1_s9yr ->
joinrec {
$wsat_worker2_s9yn [InlPrag=NOUSERINLINE[0], Occ=LoopBreaker]
:: Int# -> Int# -> Int
[LclId[JoinId(2)], Arity=2, Str=<S,U><S,U>m, Unf=OtherCon []]
$wsat_worker2_s9yn (ww2_s9yh :: Int#) (ww3_s9yl :: Int#)
= join {
lvl_s9BD [Dmd=<L,U(U)>] :: Int
[LclId[JoinId(0)], Str=m, Unf=OtherCon []]
lvl_s9BD = GHC.Types.I# ww2_s9yh } in
joinrec {
$wsat_worker3_s9yc [InlPrag=NOUSERINLINE[0],
Occ=LoopBreaker]
:: Int# -> Int
[LclId[JoinId(1)], Arity=1, Str=<S,U>m, Unf=OtherCon []]
$wsat_worker3_s9yc (ww4_s9ya :: Int#)
= case ># ww4_s9ya ww1_s9yr of {
__DEFAULT ->
case remInt# ww4_s9ya 2# of {
__DEFAULT -> jump $wsat_worker3_s9yc (+# ww4_s9ya
1#);
0# ->
jump $wsat_worker2_s9yn (+# ww2_s9yh ww4_s9ya)
(+# ww4_s9ya 1#)
};
1# -> jump lvl_s9BD
}; } in
jump $wsat_worker3_s9yc ww3_s9yl; } in
jump $wsat_worker2_s9yn 0# 1#
}
}}}
{{{
chain2
= \ (w_s9xY :: Int) ->
case w_s9xY of { GHC.Types.I# ww1_s9y1 ->
joinrec {
$wsat_worker2_s9xX [InlPrag=NOUSERINLINE[0], Occ=LoopBreaker]
:: Int# -> Int# -> Int
[LclId[JoinId(2)], Arity=2, Str=<S,U><S,U>m, Unf=OtherCon []]
$wsat_worker2_s9xX (ww2_s9xR :: Int#) (ww3_s9xV :: Int#)
= case ># ww3_s9xV ww1_s9y1 of {
__DEFAULT ->
case remInt# ww3_s9xV 2# of {
__DEFAULT -> jump $wsat_worker2_s9xX ww2_s9xR (+#
ww3_s9xV 1#);
0# ->
jump $wsat_worker2_s9xX (+# ww2_s9xR ww3_s9xV) (+#
ww3_s9xV 1#)
};
1# -> GHC.Types.I# ww2_s9xR
}; } in
jump $wsat_worker2_s9xX 0# 1#
}
}}}
Still need to investigate the general impact more.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13966#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list