[GHC] #9350: Consider using xchg instead of mfence for CS stores

#9350: Consider using xchg instead of mfence for CS stores -------------------------------------+------------------------------------- Reporter: tibbe | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 | Type of failure: hour) | None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- To get sequential consistency for `atomicWriteIntArray#` we use an `mfence` instruction. An alternative is to use an `xchg` instruction (which has an implicit `lock` prefix), which might have lower latency. We should check what other compilers do. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9350 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9350: Consider using xchg instead of mfence for CS stores -------------------------------------+------------------------------------- Reporter: tibbe | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by tibbe): Herb Sutter argues for using `xchg` over `mfence` in [http://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb- Sutter-atomic-Weapons-2-of-2 C++ and Beyond 2012: Herb Sutter - atomic<> Weapons, 2 of 2], around 0:38:20. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9350#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9350: Consider using xchg instead of mfence for CS stores
-------------------------------------+-------------------------------------
Reporter: tibbe | Owner:
Type: feature | Status: new
request | Milestone:
Priority: normal | Version: 7.9
Component: Compiler | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Easy (less than 1
Unknown/Multiple | hour)
Type of failure: | Blocked By:
None/Unknown | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by tibbe):
GCC 4.9.1 does use `mfence`. This code
{{{
#include

#9350: Consider using xchg instead of mfence for CS stores -------------------------------------+------------------------------------- Reporter: tibbe | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Compiler | Keywords: (NCG) | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * cc: simonmar (added) * failure: None/Unknown => Runtime performance bug * component: Compiler => Compiler (NCG) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9350#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC