Invyswell: A HyTM for Haswell RTM
Irina Calciu, Justin Gottschlich, Tatiana Shpeisman, Gilles Pokam, Maurice Herlihy
Invyswell: A HyTM for Haswell RTM Irina Calciu, Justin Gottschlich, - - PowerPoint PPT Presentation
Invyswell: A HyTM for Haswell RTM Irina Calciu, Justin Gottschlich, Tatiana Shpeisman, Gilles Pokam, Maurice Herlihy Multicore Performance Scaling u Problem: Locking u Solution: HTM? u IBM BG/Q, zEC12, POWER u Intel Haswell TSX
Irina Calciu, Justin Gottschlich, Tatiana Shpeisman, Gilles Pokam, Maurice Herlihy
2
Source: embedded.com
u Problem: Locking u Solution: HTM?
u IBM BG/Q, zEC12,
POWER
u Intel Haswell TSX
3
xbegin() xend() Atomic region called transaction Execute optimistically, without any locks Read and Write Sets Abort on memory conflict: programmer defined behavior
4
if (xbegin() == XBEGIN_STARTED) xend() Execute Transaction else Execute Fallback Path
Source: Anand Tech
5
0 ¡ 0.5 ¡ 1 ¡ 1.5 ¡ 2 ¡ 2.5 ¡ 3 ¡ 3.5 ¡ 4 ¡ 4.5 ¡ 1 ¡ 2 ¡ 4 ¡ 8* ¡ Speedup ¡ Threads ¡ NorecSTM ¡ NorecHy ¡ HLE ¡
Labyrinth
u [Gottschlich et al., CGO 2010] u Scalable u Good for large transactions u Conflict detection using bloom filters
7
SW Txn
Time Commit Invalidation
8
update memory Main body of SW txn On read: Add to read Bfilter On write: Add to write Bfilter Add writes to hash table If can_commit() Invalidation Else restart
9
Committing Transaction Inflight Transactions Contention Manager
Can I commit? C
f l i c t s ? ( u s i n g b l
f i l t e r s )
10
Committing Transaction Inflight Transactions
no yes no A B O R T
Contention Manager
11
Aborted Inflight Transactions Contention Manager
12
Committing Transaction Inflight Transactions
no yes no C O M M I T
Contention Manager
13
Committed Inflight Transactions
I N V A L I D A T E
Contention Manager
SW Txn
Time Commit Invalidation
14
HW Txn
Commit Invalidation
15
Time
HW Txn
Commit (Check BF) Invalidation
Already committed, can’t abort
16
Time
SW Txn
Commit Invalidation
17
Time
18
Time
z = 1/0!!!
19
Time
Check BF Check BF
20
SW
Time
Commit
Acquire commit_lock Validate If can_commit() update memory Else release lock and restart Main body of SW txn On read: Validate and add to read Bfilter On write: Add to write Bfilter Add writes to hash table
Post- Commit
Invalidation Decrement sw_cnt, release lock Begin SW txn, increment sw_cnt
21
HW Commit
if (commit_lock) if (BF conflict()) xabort() xend() Main body of HW txn. On Read: add to read Bfilter On Write: add to write Bfilter
Post- Commit
Invalidation Time xbegin()
22
Time
z = 1/0!!!
23
Time
Check BF Check BF
24
HW Commit
if (commit_lock) if (BF_conflict()) xabort() ++hw_post_commit; xend() Main body of HW txn. On Read: add to read Bfilter On Write: add to write Bfilter
Post- Commit
Invalidation
Time xbegin()
25
Time
Wait for hw_post_commit == 0 Wait for hw_post_commit == 0
26
HW Commit Post- Commit
Time
SW Commit Post- Commit
On Read: add to read Bfilter On Write: add to write Bfilter Invalidation
Expensive! Expensive!
27
HW Commit
if (sw_cnt) xabort(); else xend() Main body of HW txn. Time xbegin()
28
Committing SW Transaction Contention Manager Inflight Transactions
29
Committing SW Transaction Inflight Transactions Committing HW Transaction Contention Manager
30
SW
Acquire commit lock, increment sw_cnt
Commit
Do nothing (Changes are already committed) Main body of SW txn. On Read: add to read Bfilter On Write: add to write Bfilter Use direct updates
Post- Commit
Invalidation Decrement sw_cnt, release lock Time
Expensive! Expensive! Does not abort – Guarantees Progress
31
SW
Acquire commit lock, increment sw_cnt ++commit_sequence
Commit
Do nothing (Changes are already committed) Main body of SW txn. Use direct updates
Post- Commit
++commit_sequence Decrement sw_cnt, release lock Time
LiteHW BFHW SpecSW IrrevocSW
retry retry retry conflict
SW txns running?
yes no retry threshold exceeded
SglSW
large txns with unsupported HTM instructions / overflow small txns with unsupported HTM instructions retry threshold exceeded retry threshold exceeded
Start
LiteHW BFHW SpecSW
retry retry retry
SW txns running? Fail-fast?
yes no
SglSW
large txns with unsupported HTM instructions / overflow small txns with unsupported HTM instructions / fail-fast retry threshold exceeded retry threshold exceeded no yes
Start
benchmarks % transactions
benchmarks % transactions
u HLE and RTM w/ SGL fallback are not enough u Invyswell is 35% faster than NOrec, 18% faster than
Hybrid NOrec and 25% faster than HLE across all STAMP benchmarks
u http://cs.brown.edu/~irina u irina@cs.brown.edu