flavors library of ai powered trie structures for fast
play

Flavors Library of AI Powered Trie Structures for Fast Parallel - PowerPoint PPT Presentation

Flavors Library of AI Powered Trie Structures for Fast Parallel Lookup Session ID S8401 Albert Wolant PwC, Warsaw University of Technology Krzysztof Kaczmarski, PhD. Warsaw University of Technology GTC Silicon Valley, 27 March 2018 1 What


  1. Flavors Library of AI Powered Trie Structures for Fast Parallel Lookup Session ID S8401 Albert Wolant PwC, Warsaw University of Technology Krzysztof Kaczmarski, PhD. Warsaw University of Technology GTC Silicon Valley, 27 March 2018 1

  2. What we will talk about? • What is Flavors and how it came to be? • Overview of algorithms • Experimental results and benchmarks • Customization using machine learning 2

  3. From where it came? Session on GTC 2016: Session on GTC Europe 2017: 3

  4. What it can do? • Flavors provides algorithm to build and search radix-tree with confjgurable bit stride on the GPU. • Values can be of constant length or can vary in length. • Search can be done to fjnd values exactly or perform longest-prefjx matching. 4

  5. Tree for constant key length 5 Example of tree for bit strides sequence { 3 , 2 , 1 } .

  6. Tree for constant key length - searching example 6 Example search for key 010 − 01 − 1

  7. Tree for constant key length - searching example 7 Example search for key 010 − 01 − 1

  8. Tree for constant key length - searching example 8 Example search for key 010 − 01 − 1

  9. Tree for constant key length - searching example 9 Example search for key 010 − 01 − 1

  10. Tree for constant key length - searching example 10 Example search for key 010 − 01 − 1

  11. Tree for constant key length - searching example 11 Example search for key 010 − 01 − 1

  12. Tree for constant key length - searching example 12 Example search for key 010 − 01 − 1

  13. Tree for constant key length - searching example 13 Example search for key 010 − 01 − 1

  14. Tree for constant key length - searching example 14 Example search for key 010 − 01 − 1

  15. Tree for constant key length - searching example 15 Example search for key 010 − 01 − 1

  16. Tree for constant key length - node structure In practice, cells hold indexes of nodes on next level instead of pointers. Last level keeps original indexes of keys. 16

  17. Tree for constant key length - node structure In practice, cells hold indexes of nodes on next level instead of pointers. Last level keeps original indexes of keys. 17

  18. Tree construction - input data 18

  19. Tree construction - data sorting 19

  20. Tree construction - values 20

  21. Tree construction - nodes borders 21

  22. Tree construction - nodes borders 22

  23. Tree construction - nodes borders 23

  24. Tree construction - nodes borders 24

  25. Tree construction - nodes borders 25

  26. Tree construction - nodes indexes 26

  27. Tree construction - nodes indexes 27

  28. Tree construction - nodes indexes 28

  29. Tree construction - nodes allocation Last row of nodesIndexes array has node counts for each level. Since size of node on level is known (based on bit stride), memory for all nodes can be allocated. Values in arrays above can also be used to link nodes between levels. 29

  30. Tree construction - nodes allocation Last row of nodesIndexes array has node counts for each level. Since size of node on level is known (based on bit stride), memory for all nodes can be allocated. Values in arrays above can also be used to link nodes between levels. 29

  31. Tree construction - nodes allocation Last row of nodesIndexes array has node counts for each level. Since size of node on level is known (based on bit stride), memory for all nodes can be allocated. Values in arrays above can also be used to link nodes between levels. 29

  32. Tree construction - linking nodes Let V be values array, B be nodes borders , and N be nodes indexes . Let’s consider Let v V key level and n N key level and b B key level . Let C be 2D array of pointers to all of the nodes (for example C 1 2 points to the beginning of second node on fjrst level, since indexing is done from 1). Then: C level n v N key level 1 To avoid multiple writes to the same cell, above is done only, if b is equal to 1. 30 one cell of this arrays, in row ′ key ′ and column ′ level ′ .

  33. Tree construction - linking nodes Let V be values array, B be nodes borders , and N be nodes indexes . Let’s consider Let C be 2D array of pointers to all of the nodes (for example C 1 2 points to the beginning of second node on fjrst level, since indexing is done from 1). Then: C level n v N key level 1 To avoid multiple writes to the same cell, above is done only, if b is equal to 1. 30 one cell of this arrays, in row ′ key ′ and column ′ level ′ . Let v = V [ key ][ level ] and n = N [ key ][ level ] and b = B [ key ][ level ] .

  34. Tree construction - linking nodes Let V be values array, B be nodes borders , and N be nodes indexes . Let’s consider beginning of second node on fjrst level, since indexing is done from 1). Then: C level n v N key level 1 To avoid multiple writes to the same cell, above is done only, if b is equal to 1. 30 one cell of this arrays, in row ′ key ′ and column ′ level ′ . Let v = V [ key ][ level ] and n = N [ key ][ level ] and b = B [ key ][ level ] . Let C be 2D array of pointers to all of the nodes (for example C [ 1 ][ 2 ] points to the

  35. Tree construction - linking nodes Let V be values array, B be nodes borders , and N be nodes indexes . Let’s consider beginning of second node on fjrst level, since indexing is done from 1). Then: To avoid multiple writes to the same cell, above is done only, if b is equal to 1. 30 one cell of this arrays, in row ′ key ′ and column ′ level ′ . Let v = V [ key ][ level ] and n = N [ key ][ level ] and b = B [ key ][ level ] . Let C be 2D array of pointers to all of the nodes (for example C [ 1 ][ 2 ] points to the C [ level ][ n ][ v ] ← − N [ key ][ level + 1 ]

  36. Tree construction - linking nodes Let V be values array, B be nodes borders , and N be nodes indexes . Let’s consider beginning of second node on fjrst level, since indexing is done from 1). Then: To avoid multiple writes to the same cell, above is done only, if b is equal to 1. 30 one cell of this arrays, in row ′ key ′ and column ′ level ′ . Let v = V [ key ][ level ] and n = N [ key ][ level ] and b = B [ key ][ level ] . Let C be 2D array of pointers to all of the nodes (for example C [ 1 ][ 2 ] points to the C [ level ][ n ][ v ] ← − N [ key ][ level + 1 ]

  37. Tree construction - linking nodes On last level, we do: where P is permutation containing original indexes of keys. This operation is done for every key. 31 C [ level ][ n ] + v ← − P [ key ]

  38. Tree construction - linking nodes On last level, we do: where P is permutation containing original indexes of keys. This operation is done for every key. 31 C [ level ][ n ] + v ← − P [ key ]

  39. Tree construction - linking nodes example 32

  40. Tree construction - linking nodes example v 0, n 4, b 1 33 level = 2, key = 8,

  41. Tree construction - linking nodes example 33 level = 2, key = 8, v = 0, n = 4, b = 1

  42. Tree construction - linking nodes example 34 level = 2, key = 8, v = 0, n = 4, b = 1 C [ level ][ n ] + v = C [ 2 ][ 4 ]

  43. Tree construction - linking nodes example 35 level = 2, key = 8, v = 0, n = 4, b = 1 C [ level ][ n ] + v = C [ 2 ][ 4 ]

  44. Tree construction - what about varying lengths? 36

  45. Tree construction - what about varying lengths? 37

  46. Tree construction - removing empty nodes Some of the nodes are no longer needed, because masks that would occupy them were shorter. How to allocate memory and link nodes together? 38

  47. Tree construction - removing empty nodes Some of the nodes are no longer needed, because masks that would occupy them were shorter. How to allocate memory and link nodes together? 38

  48. Tree construction - removing empty nodes Some of the nodes are no longer needed, because masks that would occupy them were shorter. How to allocate memory and link nodes together? 38

  49. Tree construction - removing empty nodes 39

  50. Tree construction - removing empty nodes After calculating nodesIndexes array, cells are cleared (values set to 0), if mask does not reach level. 40

  51. Tree construction - removing empty nodes 41 Then ′ 1 ′ in nodesBorders representing no longer needed nodes are cleared.

  52. Tree construction - removing empty nodes After that, nodesIndexes can be recalculated and nodes allocated and linked exactly as before. 42

  53. Tree construction - containers For bit stride {3, 2, 1}, masks: land in the same place in the tree. Solution is attaching containers for masks to each node. Since masks are kept in this containers, last tree level, holding original indexes, is no longer needed. On this level we only need containers. 43 010 − 0 X − X 010 − 00 − X

  54. Tree construction - containers For bit stride {3, 2, 1}, masks: land in the same place in the tree. Solution is attaching containers for masks to each node. Since masks are kept in this containers, last tree level, holding original indexes, is no longer needed. On this level we only need containers. 43 010 − 0 X − X 010 − 00 − X

  55. Tree construction - containers For bit stride {3, 2, 1}, masks: land in the same place in the tree. Solution is attaching containers for masks to each node. Since masks are kept in this containers, last tree level, holding original indexes, is no longer needed. On this level we only need containers. 43 010 − 0 X − X 010 − 00 − X

Recommend


More recommend