1. 16 Apr, 2025 6 commits
  2. 15 Apr, 2025 4 commits
  3. 14 Apr, 2025 2 commits
  4. 11 Apr, 2025 4 commits
    • Jesse Gross's avatar
      ggml: Fix memory leak on input tensors · f50d6912
      Jesse Gross authored
      For every forward pass through the model, we need to allocate input
      tensors: tokens, images, positions, outputs and masks. These get
      allocated in system memory.
      
      However, when we close the context that the tensors were allocated
      through, the metadata gets freed but the actual backend memory does
      not. This results in a significant memory leak.
      
      This makes it so that all the memory allocated through a context
      gets freed when it is closed.
      
      Fixes #10040
      f50d6912
    • Jesse Gross's avatar
      ggml: Don't allocate CPU buffers as CUDA Host buffers · 34c3b68f
      Jesse Gross authored
      Allocating (and in particular, freeing) memory from CUDA host buffers
      is expensive and can cause a significant performance hit if we do
      it for every token. Using normal system memory avoids this issue
      and also gives the OS more flexibility to manage it.
      
      There is no performance impact from this patch directly (either
      positive or negative) but it makes a difference once we start
      freeing memory correctly.
      34c3b68f
    • Jesse Gross's avatar
      ggml: Use pointer receivers for Context · f33ccd5d
      Jesse Gross authored
      Context is currently mixed between pointer and value receivers. Change
      this to be all pointer receivers so don't have to reason about whether
      the things we are updating in the struct will be retained.
      f33ccd5d
    • Jesse Gross's avatar
      ggml: Log filesystem errors · bc108b9a
      Jesse Gross authored
      Sometimes loading the GGUF file fails with:
      panic: context canceled
      
      This is probably a filesystem error but it doesn't provide any
      information about what happened.
      bc108b9a
  5. 10 Apr, 2025 1 commit
  6. 09 Apr, 2025 2 commits
  7. 08 Apr, 2025 7 commits
  8. 07 Apr, 2025 6 commits
  9. 05 Apr, 2025 1 commit
  10. 03 Apr, 2025 4 commits
  11. 02 Apr, 2025 3 commits
    • Jeffrey Morgan's avatar
    • jmorganca's avatar
      kvcache: Add check for values that fall out of sliding window cache · b4297006
      jmorganca authored
      
      
      The sliding window cache trims entries that are outside the window for
      the latest token. This works when we are extending the cache, such as
      when the conversation continues. However, if we have a partial overlap
      in conversation (including the BOS tokens), then we resume from a past
      point in the conversation and the needed tokens are no longer stored
      in memory. This verifies that the new window overlaps with the old one
      before reusing the cache.
      Co-authored-by: default avatarJesse Gross <jesse@ollama.com>
      b4297006
    • Jesse Gross's avatar
      ollamarunner: Don't truncate a SameBatch · 493385eb
      Jesse Gross authored
      When truncating inputs to the the context window at the beginning of
      a sequence, we remove the minimum amount possible. However, this
      may cause us to truncate to the middle of a set of inputs that
      the model specified should not be split up. To avoid this, we
      need to remove the rest of the partial batch.
      493385eb