Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmultithreading #343

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Commits on Sep 11, 2023

  1. Remove unneeded memset for clearing state

    We can get rid of uneeded memsets when clearing state, since
    the count is always reset.
    
    We can clear the hasher state on init if we need to start from
    zeroes.
    
    Signed-off-by: Pantelis Antoniou <[email protected]>
    pantoniou committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    aa77300 View commit details
    Browse the repository at this point in the history
  2. Introduce C multi-threading

    This is a minimal thread-pool implementation for BLAKE3.
    
    As part of the commit a very simple file mmap-ing example is
    introduced that providing file checksuming.
    
    At least on my machines (x86-64 linux boxes) the C implementation
    is within a 1% point in performance of the rust b3sum tool.
    
    > $ ls -l ggml-vicuna-7b-1.1-q4_0.bin
    -rw-rw-r-- 1 panto panto 3791725184 Ιουν 17 13:34 ggml-vicuna-7b-1.1-q4_0.bin
    
    > $ time b3sum ggml-vicuna-7b-1.1-q4_0.bin
    > fe87fecc4427c4661aa46f52a7e286ecd6dd7f5f788564abb2c46d2ed5341584  ggml-vicuna-7b-1.1-q4_0.bin
    >
    > real	0m0,190s
    > user	0m1,583s
    > sys	0m0,196s
    
    > $ time ./example-mmap ggml-vicuna-7b-1.1-q4_0.bin
    > fe87fecc4427c4661aa46f52a7e286ecd6dd7f5f788564abb2c46d2ed5341584  ggml-vicuna-7b-1.1-q4_0.bin
    >
    > real	0m0,204s
    > user	0m1,525s
    > sys	0m0,247s
    
    At my local copy of BLAKE3 with more extensive changes I can get the C
    implementation to be slightly faster than the rust one.
    But those require more extensive changes which will have to come much
    later.
    
    Signed-off-by: Pantelis Antoniou <[email protected]>
    pantoniou committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    b8ef7c2 View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2023

  1. Fix expected zeroes at output

    When buffer sizes are small in streaming mode the partial output
    must have the rest of the buffer filled with zeroes.
    
    Signed-off-by: Pantelis Antoniou <[email protected]>
    pantoniou committed Sep 12, 2023
    Configuration menu
    Copy the full SHA
    7973cc5 View commit details
    Browse the repository at this point in the history