Re: symmetric toeplitz hashing

2020-06-15 Thread David Gwynne
> On 13 Jun 2020, at 3:20 pm, Theo Buehler wrote: > > On Sat, Jun 13, 2020 at 11:35:42AM +1000, David Gwynne wrote: >> On Fri, Jun 12, 2020 at 03:37:59PM +0200, Theo Buehler wrote: >>> I finally found the time to think about the mathematics of this some >>> more and I'm now convinced that

Re: symmetric toeplitz hashing

2020-06-14 Thread David Gwynne
> On 14 Jun 2020, at 10:59 pm, Miod Vallat wrote: > > >>> Others have pointed out off-list that one can use __builtin_popcount(), >>> but __builtin_parity() is exactly what I want. Is it available on all >>> architectures? >> >> I don't think it is available on gcc 3.x for m88k but someone

Re: symmetric toeplitz hashing

2020-06-14 Thread Miod Vallat
>> Others have pointed out off-list that one can use __builtin_popcount(), >> but __builtin_parity() is exactly what I want. Is it available on all >> architectures? > > I don't think it is available on gcc 3.x for m88k but someone with > an m88k should confirm. __builtin_popcount() does not

Re: symmetric toeplitz hashing

2020-06-13 Thread Aisha Tammy
On 6/13/20 2:47 PM, Theo Buehler wrote: >>> Yes. The thing is that you need to convince yourself that this is still >>> uniformly distributed over the wanted numbers. But it's correct. In >>> fact, it's enough to flip a fixed bit, so you can get away with one call >>> to arc4random(). >> >> Its

Re: symmetric toeplitz hashing

2020-06-13 Thread Aisha Tammy
On 6/13/20 9:19 AM, Theo Buehler wrote: > On Sat, Jun 13, 2020 at 08:46:13AM -0400, David Higgs wrote: >> On Fri, Jun 12, 2020 at 9:41 AM Theo Buehler wrote: >> >>> I finally found the time to think about the mathematics of this some >>> more and I'm now convinced that it's a sound construction.

Re: symmetric toeplitz hashing

2020-06-13 Thread Theo Buehler
On Sat, Jun 13, 2020 at 07:10:50PM -, Christian Weisgerber wrote: > On 2020-06-13, Theo Buehler wrote: > > > Others have pointed out off-list that one can use __builtin_popcount(), > > but __builtin_parity() is exactly what I want. Is it available on all > > architectures? > > The standard

Re: symmetric toeplitz hashing

2020-06-13 Thread Christian Weisgerber
On 2020-06-13, Theo Buehler wrote: > Others have pointed out off-list that one can use __builtin_popcount(), > but __builtin_parity() is exactly what I want. Is it available on all > architectures? The standard implementation will be perfectly fine, no need to resort to magic compiler

Re: symmetric toeplitz hashing

2020-06-13 Thread Theo Buehler
> > Yes. The thing is that you need to convince yourself that this is still > > uniformly distributed over the wanted numbers. But it's correct. In > > fact, it's enough to flip a fixed bit, so you can get away with one call > > to arc4random(). > > Its not immediately obvious because this is not

Re: symmetric toeplitz hashing

2020-06-13 Thread Todd C . Miller
On Sat, 13 Jun 2020 15:19:28 +0200, Theo Buehler wrote: > Others have pointed out off-list that one can use __builtin_popcount(), > but __builtin_parity() is exactly what I want. Is it available on all > architectures? I don't think it is available on gcc 3.x for m88k but someone with an m88k

Re: symmetric toeplitz hashing

2020-06-13 Thread Theo Buehler
On Sat, Jun 13, 2020 at 08:46:13AM -0400, David Higgs wrote: > On Fri, Jun 12, 2020 at 9:41 AM Theo Buehler wrote: > > > I finally found the time to think about the mathematics of this some > > more and I'm now convinced that it's a sound construction. I hope that > > one or the other

Re: symmetric toeplitz hashing

2020-06-13 Thread David Higgs
On Fri, Jun 12, 2020 at 9:41 AM Theo Buehler wrote: > I finally found the time to think about the mathematics of this some > more and I'm now convinced that it's a sound construction. I hope that > one or the other observation below will be useful for you. > > The hash as it is now can be proved

Re: symmetric toeplitz hashing

2020-06-12 Thread Theo Buehler
On Sat, Jun 13, 2020 at 11:35:42AM +1000, David Gwynne wrote: > On Fri, Jun 12, 2020 at 03:37:59PM +0200, Theo Buehler wrote: > > I finally found the time to think about the mathematics of this some > > more and I'm now convinced that it's a sound construction. I hope that > > one or the other

Re: symmetric toeplitz hashing

2020-06-12 Thread David Gwynne
On Fri, Jun 12, 2020 at 03:37:59PM +0200, Theo Buehler wrote: > I finally found the time to think about the mathematics of this some > more and I'm now convinced that it's a sound construction. I hope that > one or the other observation below will be useful for you. Yes, I read everything below

Re: symmetric toeplitz hashing

2020-06-12 Thread Theo Buehler
I finally found the time to think about the mathematics of this some more and I'm now convinced that it's a sound construction. I hope that one or the other observation below will be useful for you. The hash as it is now can be proved to produce values in the full range of uint16_t, so that's

Re: symmetric toeplitz hashing

2020-05-31 Thread Theo Buehler
> At the end of this loop, key[b] contains two copies of the cyclically > permuted skey next to each other. When building the cache, you scan > through the bits of val, xor the corresponding keys in if they're set > and then throw away half of the 32 bits when assigning > scache->bytes[val] = res;

Re: symmetric toeplitz hashing

2020-05-31 Thread Theo Buehler
On Fri, May 29, 2020 at 02:41:07PM +1000, David Gwynne wrote: > This is another bit of the puzzle for supporting multiple rx rings > and receive side scaling (RSS) on nics. It borrows heavily from > DragonflyBSD, but I've made some tweaks on the way. > > For background on the dfly side, I

symmetric toeplitz hashing

2020-05-28 Thread David Gwynne
This is another bit of the puzzle for supporting multiple rx rings and receive side scaling (RSS) on nics. It borrows heavily from DragonflyBSD, but I've made some tweaks on the way. For background on the dfly side, I recommend having a look at