build ghc with make (ghc-boot-th broken deps)
Ben Gamari
ben at smart-cactus.org
Thu May 21 03:31:00 UTC 2020
Daneel Yaitskov <dyaitskov at gmail.com> writes:
> Hi Ben,
>
> Thanks for bothering.
> I solved issue.
> That was ancient cabal.
> I build ghc successfully once I installed Cabal-3.
> I thought that configure script will warn me about incompatible cabal :)
>
Hmm, interesting. I'm actually rather surprised that the problem was
cabal-install. Afterall, GHC's build system doesn't use cabal-install
apart from building Hadrian.
> Btw could you shed some light on RTS locking?
>
> I am interested in:
>
> ccall traceUserBinaryMsg(MyCapability() "ptr", msg "ptr", len);
>
> because it looks slower on smaller chunks.
> Writing data in 64 bytes chunks vs 4k (ghc 8.11) is twice slower.
>
> https://github.com/yaitskov/eventslog-benchmark
> benchmark [ LoadWithBinary-b1048576-t001-c0064] lasted for cpu
> 4.23 ms real 4.24 ms
> benchmark [ LoadWithBinary-b1048576-t001-c0128] lasted for cpu
> 3.97 ms real 3.91 ms
> benchmark [ LoadWithBinary-b1048576-t001-c1024] lasted for cpu
> 2.73 ms real 2.61 ms
> benchmark [ LoadWithBinary-b1048576-t001-c2048] lasted for cpu
> 2.34 ms real 2.23 ms
> benchmark [ LoadWithBinary-b1048576-t001-c4096] lasted for cpu
> 2.16 ms real 2.20 ms
>
> Eventlog messages tend to be small.
>
> So application developer has to think about bufferization to speed up.
> OpenTelemetry gains 6x speed improvement with following hack.
>
...
Interesting. Please do open a GitLab ticket to track this. You might
also be interested in #17949, which is covers the case of traceEvent
being expensive when tracing is disabled.
> I see that some EventLog methods use mutexes, but user message function don't.
> It just appends to buffer and can flush if it is full.
> So I don't see where locking happening.
> MyCapability is just arithmetic
>
> #define MyCapability() (BaseReg - OFFSET_Capability_r)
>
> I guess capability locking happens somewhere upper - before C.
>
There is no locking necessary. Capabilities are owned by a particular
operating system thread. The capability is held until the program yields
it (which generally only happens during a GC or foreign function call)
and during this time the program has full access to all of the state in
the Capability structure without the need for a lock. This is why each
Capability has its own eventlog buffer; it allows lock-free tracing.
Cheers,
- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200520/6d6969b2/attachment.sig>
More information about the ghc-devs
mailing list