400 likes | 599 Views
Understanding Bloom Filter Intersection for Lazy Address-Set Disambiguation. Mark Jeffrey and J. Gregory Steffan ECE, University of Toronto June 6, 2011. Parallel Programming is Hard. Tools offload some burden of managing data accesses: Memory Race Replay Atomicity Violation Survival
E N D
Understanding Bloom Filter Intersection for Lazy Address-Set Disambiguation Mark Jeffrey and J. Gregory Steffan ECE, University of Toronto June 6, 2011
Parallel Programming is Hard Tools offload some burden of managing data accesses: • Memory Race Replay • Atomicity Violation Survival • Transactional Memory • Speculative Optimizations T1 T3 T2 Rd(a) Rd(a) Rd(x) Rd(b) Wr(c) Rd(a) Wr(a) Rd(a) Many tools are using Bloom filters Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filter & • Bit-vector-based data structure [1970] • offers fast set operations • in exchange for some imprecision • Recently used to compare memory accesses • With unconventional practices: Intersection • We show new practices are inefficient! (in theory) Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filters in Concurrency Tools We provide new theory to guide tool designers! Mark Jeffrey and Greg Steffan, U of Toronto
Tracking Address-Set Conflicts Mark Jeffrey and Greg Steffan, U of Toronto
Address-Sets Read Set: • memory locations read • RT1={ , } Write Set: • memory locations written • WT1={a} T1 T3 T2 a Rd(a) Rd(x) Rd(a) Rd(b) Wr(c) b Wr(a) Rd(a) Rd(a) Mark Jeffrey and Greg Steffan, U of Toronto
Burden: Address-Set Conflicts Conflicts • address accesses are dependent • independence -> parallelism! • address conflicts -> no parallelism Conflict Detection requires • read and write set comparison • runtime address disambiguation T1 T3 T2 Rd(a) Rd(x) Rd(a) Rd(b) Wr(c) Wr(a) Rd(a) Rd(a) Mark Jeffrey and Greg Steffan, U of Toronto
Conflict Detection – When? • Eager • Detect conflicts at the time of memory access • Lazy • Detect conflicts at the end of an arbitrary epoch Thread1 Thread2 -Rd(a) Wr(b)- Wr‘b’ OK? Thread1 Thread2 -Rd(a) Rd(a)- -Rd(b) Wr(b)- Rd(c)- {a,b,c} OK? Mark Jeffrey and Greg Steffan, U of Toronto
Conflict Detection – When? • Eager = Set Membership • Query for that single address in the access sets • Lazy = Set Overlap • Compare access sets for non-empty intersections Thread1 Thread2 -Rd(a) Wr(b)- Thread1 Thread2 “When” determines the set operation -Rd(a) Rd(a)- -Rd(b) Wr(b)- Rd(c)- Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filters (BF) Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filter Background x = [x31, …,x3,x2,x1,x0] • Bloom filter is a compact set representation • Bit vector - much smaller than address space h() [x4,x3,x2,x1] Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filter Background y Query for an address, y h() [y4,y3,y2,y1] {Yes, No} Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filter False Positives (FPs) x • Encode a large address space into a bit-vector • Response to query is actually No or Maybe • False Positives – when “maybe” is wrong ? is y in y Mark Jeffrey and Greg Steffan, U of Toronto
Partitioned Bloom Filter x h1() h2() … hk() … • Insert an address, x: • k hash functions encode k bit indices to set Mark Jeffrey and Greg Steffan, U of Toronto
Partitioned Bloom Filter Query for an address, y: y h1() h2() … hk() … {Maybe, No} Probability of False Positives is well understood Mark Jeffrey and Greg Steffan, U of Toronto
Unconventional Practices for Bloom Filters Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filter for Set Overlaps Lazy systems perform set intersections Two common approaches: • build a Queue of Queries (QoQ) • batch queries into distinct Bloom filter • replace many queries with 1 intersection! a1 ? a5 a4 a3 a2 Mark Jeffrey and Greg Steffan, U of Toronto
Partitioned BF Intersection Do two sets share any elements? & … … … {Disjoint, Maybe Not} Mark Jeffrey and Greg Steffan, U of Toronto
Unpartitioned BF Intersection Any asserted bits indicate set overlap … … & … {Disjoint, Maybe Not} Mark Jeffrey and Greg Steffan, U of Toronto
False Set Overlap with BF Intersection • Bloom filter was intended for fast Querying • Recent systems use filter for Intersection • Imprecision can produce False Set Overlaps (FSO) • Limited study of Bloom filter intersection • Our goal is to Demystify Bloom filter Intersection Mark Jeffrey and Greg Steffan, U of Toronto
Important Questions When using BFs for address Set Overlaps: • how do BF Intersection and QoQ compare? • Empirical Study • what is the exact FSO probability? • Theoretical Study • what are the theoretical implications? Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filters for Set Overlap How do BF Intersection and QoQ compare? Mark Jeffrey and Greg Steffan, U of Toronto
Methodology For many trials: • Create sets A = {a1,a2,…,an} B = {b1,b2,…,bm}- A and B are disjoint // Measure Intersects with FSOs • count # trials with a FSO // Measure Queues of Queries with FSOs • For each bi in B: count # trials with at least one FP is biϵ A→ B→ ∩ Mark Jeffrey and Greg Steffan, U of Toronto
Queue of Queries vs. Intersection For equivalent FSO rate, Intersection requires ≥ 4x more bits! 4x 4x 4x Better Mark Jeffrey and Greg Steffan, U of Toronto
Queue of Queries vs. Intersection Doubling address set from 32 to 64 => Doubling size from 4x to 8x 8x 8x Better Mark Jeffrey and Greg Steffan, U of Toronto
Empirical Study Summary • BF Intersection requires > bits for == FSO rate • Space overhead increases with set size • Partitioned intersect is better than Unpartitioned Mark Jeffrey and Greg Steffan, U of Toronto
Bloom Filters for Set Overlap What is the exact probability of False Set Overlap (FSO)? Mark Jeffrey and Greg Steffan, U of Toronto
Definitions Mark Jeffrey and Greg Steffan, U of Toronto
Definitions h1() h2() … hk() … Mark Jeffrey and Greg Steffan, U of Toronto
Probability of FSO • Unpartitioned BF Intersection • Partitioned BF Intersection • Queue of BF Queries b1 ϵ? b5 b4 b3 b2 h1 h2 … hk h1 h2 … hk Mark Jeffrey and Greg Steffan, U of Toronto
Theorem: BF(A)∩BF(B) vs. BF(A∩B) Theorem [Guo et al. TKDE ‘10]: BF(A)∩BF(B) & A∩B BF(A) BF(B) h1 h2 … hk BF(A∩B) Mark Jeffrey and Greg Steffan, U of Toronto
Bloom filters for Set Overlap What are the Theoretical Implications? Mark Jeffrey and Greg Steffan, U of Toronto
False Conflicts: QoQ vs. Intersections For any length m, and k > 1 hash functions, Better • Queue of Queries gives fewer false conflicts • Partitioned intersection improves on Unpartitioned Mark Jeffrey and Greg Steffan, U of Toronto
Space: QoQ vs. Intersection For equivalent Pr[FSO], when mPartitioned≥|A||B|, k > 1, Mark Jeffrey and Greg Steffan, U of Toronto
Space: QoQ vs. Intersection For equivalent Pr[FSO], when mPartitioned≥|A||B|, k > 1, intersection requires at least square root factor more space. Mark Jeffrey and Greg Steffan, U of Toronto
Single Hash: QoQ vs. Intersection For a single hash function, k = 1, Better exploit the speed of intersection instead of queries! Mark Jeffrey and Greg Steffan, U of Toronto
Conclusion Mark Jeffrey and Greg Steffan, U of Toronto
Summary Conflict detection often applies Bloom filters • for fast set operations: y ϵ S and S1∩S2 • Many new systems use BF intersect Our recommendations (in order of preference) • strongly consider querying before intersection • intersect partitioned Bloom filters • if single hash is required, exploit intersection! Mark Jeffrey and Greg Steffan, U of Toronto
Current Work: Implementations • Analyze the effects of partitioning in RingSTM • Analyze the effects of QoQ in RingSTM • Develop a compromise in space and time • Reduce sqrt space overhead of BF Intersect • Reduce linear time complexity of Queue of Query Mark Jeffrey and Greg Steffan, U of Toronto
Understanding Bloom Filter Intersection for Lazy Address-Set Disambiguation Thank you! markj@eecg.toronto.edu