2025/01/08

Newest at the top

2025-01-08 21:37:43 +0100 <Leary> Perhaps artificially introduce a loop breaker: `bar = ... bar ...` --> `foo = bar; {-# INLINE bar #-}; bar = ... foo ...`
2025-01-08 21:36:28 +0100 <c_wraith> But that means you need to cooperate at the call site. eww.
2025-01-08 21:36:14 +0100 <c_wraith> Further reading of the docs suggests you might be able to do it with INLINEABLE *and* the magic inline function. https://hackage.haskell.org/package/base-4.21.0.0/docs/GHC-Base.html#v:inline
2025-01-08 21:35:00 +0100 <c_wraith> within a single module, GHC will do a worker-wrapper transform to inline directly recursive definitions at -O2. But making that optimization fire across modules seems hard.
2025-01-08 21:32:56 +0100Digit(~user@user/digit) Digit
2025-01-08 21:32:09 +0100Digit(~user@user/digit) (Read error: Connection reset by peer)
2025-01-08 21:32:08 +0100l_k(~student@213.24.133.217) (Ping timeout: 244 seconds)
2025-01-08 21:29:32 +0100l__k(~student@217.107.126.148)
2025-01-08 21:27:12 +0100 <c_wraith> it is.
2025-01-08 21:26:25 +0100 <EvanR> wait a minute, isn't that what loop unrolling is
2025-01-08 21:26:03 +0100 <EvanR> I guess that makes sense on multiple levels
2025-01-08 21:25:58 +0100 <EvanR> a self recursive function can't be inlined
2025-01-08 21:21:58 +0100 <c_wraith> So yeah... When *that* is the issue I'm trying to demonstrate, INLINE is useless.
2025-01-08 21:21:40 +0100 <c_wraith> Oh, right. "GHC tries not to select a function with an INLINE pragma as a loop breaker, but when there is no choice even an INLINE function can be selected, in which case the INLINE pragma is ignored. For example, for a self-recursive function, the loop breaker can only be the function itself, so an INLINE pragma is always ignored."
2025-01-08 21:18:43 +0100weary-traveler(~user@user/user363627) user363627
2025-01-08 21:17:46 +0100 <c_wraith> And, yeah. OPTIONS_GHC -O2 does in fact override cabal's global optimization level. It just wasn't visible because of the cross-module stuff
2025-01-08 21:17:39 +0100cjay(cjay@nerdbox.nerd2nerd.org) cjay
2025-01-08 21:17:00 +0100tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
2025-01-08 21:15:58 +0100tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-01-08 21:14:40 +0100JuanDaugherty(~juan@user/JuanDaugherty) JuanDaugherty
2025-01-08 21:12:59 +0100gorignak(~gorignak@user/gorignak) gorignak
2025-01-08 21:11:05 +0100 <c_wraith> And while it can do that in a single module with -O2, it does not appear to do it cross-module with -O2
2025-01-08 21:10:38 +0100 <c_wraith> It needs a worker/wrapper transform for GHC to inline it at all
2025-01-08 21:10:21 +0100 <c_wraith> I think the INLINE pragma is being ignored because the definition it would need to apply to is directly recursive
2025-01-08 21:09:51 +0100ash3en(~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Client Quit)
2025-01-08 21:09:51 +0100 <c_wraith> Oh. No, I think this idea just doesn't work.
2025-01-08 21:07:00 +0100ash3en(~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en
2025-01-08 21:04:40 +0100visilii(~visilii@213.24.125.237) (Ping timeout: 265 seconds)
2025-01-08 21:03:50 +0100hseg(~gesh@46.120.21.249) (Ping timeout: 272 seconds)
2025-01-08 21:00:44 +0100caconym(~caconym@user/caconym) caconym
2025-01-08 21:00:35 +0100visilii_(~visilii@188.254.110.9)
2025-01-08 21:00:04 +0100caconym(~caconym@user/caconym) (Quit: bye)
2025-01-08 20:55:56 +0100rvalue(~rvalue@user/rvalue) rvalue
2025-01-08 20:55:26 +0100rvalue(~rvalue@user/rvalue) (Read error: Connection reset by peer)
2025-01-08 20:53:50 +0100 <c_wraith> I might need to compile it as a sublibrary
2025-01-08 20:53:26 +0100 <c_wraith> Huh. Looks like cabal might override the -O2 in an OPTIONS_GHC pragma
2025-01-08 20:52:07 +0100weary-traveler(~user@user/user363627) (Remote host closed the connection)
2025-01-08 20:41:28 +0100raym(~ray@user/raym) raym
2025-01-08 20:35:57 +0100 <tomsmeding> which sounds like what you want here
2025-01-08 20:35:51 +0100 <tomsmeding> > So GHC guarantees to inline precisely the code that you wrote, no more and no less.
2025-01-08 20:35:44 +0100 <tomsmeding> but the GHC user's guide says: ( https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/pragmas.html#inline-and-noinline-pr… )
2025-01-08 20:35:15 +0100 <tomsmeding> yeah this may be too much trickery
2025-01-08 20:33:15 +0100 <c_wraith> Huh. Not sure how INLINE interacts with this.
2025-01-08 20:30:11 +0100ljdarj(~Thunderbi@user/ljdarj) ljdarj
2025-01-08 20:28:16 +0100 <tomsmeding> ctrl-D is often faster than typing "exit" ... oh too late
2025-01-08 20:28:10 +0100mari41300(~mari-este@user/mari-estel) (Remote host closed the connection)
2025-01-08 20:28:06 +0100 <mari41300> sorry i'm tired. See you all o/
2025-01-08 20:27:55 +0100 <mari41300> :P
2025-01-08 20:27:51 +0100 <mari41300> exit
2025-01-08 20:27:37 +0100 <tomsmeding> c_wraith: is it just one function? mark them as INLINE, use them (trivially, in a wrapper function) in two separate modules, compile those two modules with different options?