1. 03 Dec, 2025 1 commit
    • Daniel Hiltgen's avatar
      CUDA: filter devices on secondary discovery (#13317) · 3f308367
      Daniel Hiltgen authored
      We now do a deeper probe of CUDA devices to verify the library version has
      the correct compute capability coverage for the device.  Due to ROCm also
      interpreting the CUDA env var to filter AMD devices, we try to avoid setting
      it which leads to problems in mixed vendor systems.  However without setting
      it for this deeper probe, each CUDA library subprocess discovers all CUDA GPUs
      and on systems with lots of GPUs, this can lead to hitting timeouts.  The fix is
      to turn on the CUDA visibility env var just for this deeper probe use-case.
      3f308367
  2. 02 Dec, 2025 1 commit
    • Jesse Gross's avatar
      llm: Don't always evict models on CPU-only systems · 5317202c
      Jesse Gross authored
      Model eviction happens when we have at least one other model
      loaded and are unable to load all layers into VRAM. However, on
      CPU-only systems we can never load layers into VRAM, so this
      constantly triggered eviction.
      
      Fixes #13227
      5317202c
  3. 11 Nov, 2025 4 commits
    • Jesse Gross's avatar
      llm: Prefer dedicated GPUs over iGPUs when allocating memory · 8bf38552
      Jesse Gross authored
      We currently assign model layers to GPUs according to free VRAM,
      which assumes that GPU performance is roughly equal. This does not
      work well for mixed dGPU and iGPU systems because iGPUs typically
      use system memory which is large but their performance is slow.
      This instead assigns layers to dGPUs first and then iGPUs.
      
      In the future, this could be generalized to have a more fine grained
      notion of GPU performance but dGPU vs. iGPU performance is the most
      extreme.
      8bf38552
    • Jesse Gross's avatar
      llm: Separate llamaServer and ollamaServer code paths · b13fbad0
      Jesse Gross authored
      Originally, llamaServer represented old memory estimates, which
      could be used with either the old or new engine. ollamaServer was
      used only for the new estimates and new engine. Since these
      implementations did not map directly to engine, there was engine-
      specific code in common code paths.
      
      Now that new estimates are always used for the new engine, there is
      a direct mapping between server type and engine. This separates out
      most of the engine-specific code into the correct implementation
      to make things easier to understand.
      b13fbad0
    • Jesse Gross's avatar
      llm: Use Ollama engine memory layouts for both old and new engines · f560bd07
      Jesse Gross authored
      Currently for both the old and new engines, there is code to
      calculate how much memory is required for a model and lay out
      the layers onto GPUs. This reuses the new engine's lay out code
      for the old engine as well, bringing them closer together. The
      old engine continues to use its current method of estimating
      required memory.
      
      This reduces maintainence effort and improves consistency, as new
      features only need to be implemented in one place. The newer code
      is also more accurate, especially with multiple GPUs.
      f560bd07
    • Baptiste Jamin's avatar
      server: add logprobs and top_logprobs support to Ollama's API (#12899) · 59241c5b
      Baptiste Jamin authored
      
      
      Adds logprobs support to Ollama's API including support for Ollama's
      OpenAI-compatible API. By specifying the new 'logprobs' boolean parameter
      in the API, Ollama will return the log probabilities for each token generated.
      'top_logprobs', an integer value can also be specified up to the value 20.
      When specified, the API will also provide the number of most likely tokens to
      return at each token position
      Co-authored-by: default avatarBaptiste Jamin <baptiste@crisp.chat>
      59241c5b
  4. 30 Oct, 2025 1 commit
  5. 28 Oct, 2025 1 commit
  6. 27 Oct, 2025 1 commit
    • nicole pardal's avatar
      server: Consolidate embedding truncation in runner (#12730) · 5d347f6d
      nicole pardal authored
      Currently, checking the length of prompts for embeddings to ensure
      they fit in the context window (and possible truncation) occurs in
      two places - the Ollama server and runner. This can lead to
      inconsistencies in both the checks and reported number of tokens
      processed. Since we have to do this processing in the runner, this
      consolidates all of the logic there.
      5d347f6d
  7. 23 Oct, 2025 2 commits
    • Jesse Gross's avatar
      llm: Change memory allocation backoff from exponential to incremental · ad6f6a1d
      Jesse Gross authored
      If we create a memory layout that should fit based on report free VRAM
      but allocation still fails, we start applying a backoff. This reduces
      free VRAM by an exponential percentage (1%, 2%, 4%...). However, the
      points chosen tend to be too dense at the beginning and too sparse at
      the end. Therefore, this switches to an incremental backoff (10%, 20%,
      30%...).
      ad6f6a1d
    • Daniel Hiltgen's avatar
      DRY out the runner lifecycle code (#12540) · 3258a89b
      Daniel Hiltgen authored
      * DRY out the runner lifecycle code
      
      Now that discovery uses the runners as well, this unifies the runner spawning code
      into a single place.  This also unifies GPU discovery types with the newer ml.DeviceInfo
      
      * win: make incremental builds better
      
      Place build artifacts in discrete directories so incremental builds don't have to start fresh
      
      * Adjust sort order to consider iGPUs
      
      * handle cpu inference oom scenarios
      
      * review comments
      3258a89b
  8. 15 Oct, 2025 1 commit
    • Jesse Gross's avatar
      llm: Perform eviction when num_gpu is set with new estimates · 3dcfd5f6
      Jesse Gross authored
      Currently, if you set num_gpu then this forces the model to
      load with that number of layers in the current configuration.
      This is done regardless of any other information, which means
      that no eviction is performed even if another model is loaded.
      
      This behavior is different from the old estimates (and still
      happens for models that runs on the llama engine). In those
      cases, models would be evicted if needed to load at the requested
      number of layers. That behavior is more useful and less surprising,
      so this changes the new estimates to match.
      
      Fixes #12580
      3dcfd5f6
  9. 14 Oct, 2025 1 commit
    • Thomas Stocker's avatar
      Vulkan based on #9650 (#11835) · 2aba569a
      Thomas Stocker authored
      * implement the vulkan C backend
      
      * add support in gpu.go
      
      * add support in gen_linux.sh
      
      * it builds
      
      * fix segfault
      
      * fix compilation
      
      * fix free memory monitor
      
      * fix total memory monitor
      
      * update gpu.go
      
      * fix build
      
      * fix check_perfmon len
      
      * remove cap_get_bound check
      
      * fix vulkan handle releasing
      
      * fix build on federa 40
      
      * fix vulkan on windows
      
      * making amdgpu work on arm achitecutre with vulkan
      
      * add x86_64 lines in VulkanGlobs and capLinuxGlobs
      
      * add aarch64 lines in vulkanGlobs and capLinuxGlobs
      
      * Fix variable name
      
      * Add vulkan build patch from @jmorganca
      
      * Sync vendored ggml to add Vulkan support
      
      * Updated dockerfile
      
      https://github.com/whyvl/ollama-vulkan/issues/7#issuecomment-2660836871
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Installing rocm library
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * This version works well
      
      built based on this: https://github.com/whyvl/ollama-vulkan/issues/7#issuecomment-2660836871
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Applied 00-fix-vulkan-building.patch
      
      Work done by McBane87 here: https://github.com/whyvl/ollama-vulkan/issues/7#issuecomment-2660836871
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Fixed the "detached head" issues
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Merged in the right direction
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Merging the latest stable (#2)
      
      * Applied 00-fix-vulkan-building.patch
      
      * Implemented vulkan backend based on the work done by whyvl, Dts0, McBane87 and others
      
      Tested on AMD Ryzen 7 8845HS w/ Radeon 780M Graphics with ROCm disabled
      
      ```
      [GIN-debug] POST   /v1/chat/completions      --> github.com/ollama/ollama/server.(*Server).ChatHandler-fm (6 handlers)
      [GIN-debug] POST   /v1/completions           --> github.com/ollama/ollama/server.(*Server).GenerateHandler-fm (6 handlers)
      [GIN-debug] POST   /v1/embeddings            --> github.com/ollama/ollama/server.(*Server).EmbedHandler-fm (6 handlers)
      [GIN-debug] GET    /v1/models                --> github.com/ollama/ollama/server.(*Server).ListHandler-fm (6 handlers)
      [GIN-debug] GET    /v1/models/:model         --> github.com/ollama/ollama/server.(*Server).ShowHandler-fm (6 handlers)
      time=2025-03-11T13:00:40.793Z level=INFO source=gpu.go:199 msg="vulkan: load libvulkan and libcap ok"
      time=2025-03-11T13:00:40.877Z level=INFO source=gpu.go:421 msg="error looking up vulkan GPU memory" error="device is a CPU"
      time=2025-03-11T13:00:40.878Z level=WARN source=amd_linux.go:443 msg="amdgpu detected, but no compatible rocm library found.  Either install rocm v6, or follow manual install instructions at https://github.com/ollama/ollama/blob/main/docs/linux.md#manual-install"
      time=2025-03-11T13:00:40.878Z level=WARN source=amd_linux.go:348 msg="unable to verify rocm library: no suitable rocm found, falling back to CPU"
      time=2025-03-11T13:00:40.879Z level=INFO source=types.go:137 msg="inference compute" id=0 library=vulkan variant="" compute=1.3 driver=1.3 name="AMD Radeon Graphics (RADV GFX1103_R1)" total="15.6 GiB" available="15.6 GiB"
      ```
      
      ```
       # ollama run phi4:14b
      >>> /set verbose
      Set 'verbose' mode.
      >>> how's it going?
      Hello! I'm here to help you with any questions or tasks you have. How can I assist you today? 😊
      
      
      
      total duration:       3.341959745s
      load duration:        18.165612ms
      prompt eval count:    15 token(s)
      prompt eval duration: 475ms
      prompt eval rate:     31.58 tokens/s
      eval count:           26 token(s)
      eval duration:        2.846s
      eval rate:            9.14 tokens/s
      >>>
      ```
      
      * This is no longer needed
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Fixes SIGSEGV: segmentation violation running gemma3 models on ollama 0.6.0 #21
      
      Patch provided by McBane87 on https://github.com/whyvl/ollama-vulkan/issues/21
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Applied 04-disable-mmap-vulkan.patch
      
      From: https://github.com/whyvl/ollama-vulkan/issues/7#issuecomment-2660836871
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Pulled new upstream code for ggml-bulkan backend
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Merged latest ollama 0.6.2 and nasrally's Flash Attention patches (#5)
      
      * readme: add Ellama to list of community integrations (#9800)
      
      * readme: add screenpipe to community integrations (#9786)
      
      * Add support for ROCm gfx1151 (#9773)
      
      * conditionally enable parallel pipelines
      
      * sample: make mutations in transforms explicit (#9743)
      
      * updated minP to use early exit making use of sorted tokens
      
      * ml/backend/ggml: allocate memory with malloc when loading model (#9822)
      
      * runner: remove cache prompt flag from ollama runner (#9826)
      
      We do not need to bypass the prompt caching in the ollama runner yet, as
      only embedding models needed to bypass the prompt caching. When embedding
      models are implemented they can skip initializing this cache completely.
      
      * ollamarunner: Check for minBatch of context space when shifting
      
      Models can specify that a group of inputs need to be handled a single
      batch. However, context shifting didn't respect this and could trigger
      a break anyways. In this case, we should instead trigger a context
      shift earlier so that it occurs before the grouped batch.
      
      Note that there still some corner cases:
       - A long prompt that exceeds the context window can get truncated
         in the middle of an image. With the current models, this will
         result in the model not recognizing the image at all, which is
         pretty much the expected result with truncation.
       - The context window is set less than the minimum batch size. The
         only solution to this is to refuse to load the model with these
         settings. However, this can never occur with current models and
         default settings.
      
      Since users are unlikely to run into these scenarios, fixing them is
      left as a follow up.
      
      * Applied latest patches from McBane87
      
      See this for details: https://github.com/whyvl/ollama-vulkan/issues/7#issuecomment-2708820861
      
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      
      * Add ability to enable flash attention on vulkan (#4
      
      )
      
      * discover: add flash attention handling for vulkan
      * envconfig: fix typo in config.go
      
      As part of the process some code was refactored and I added a new field
      FlashAttention to GpuInfo since the previous solution didn't allow for a
      granular check via vulkan extensions. As a side effect, this now allows
      for granular per-device FA support checking in other places
      
      ---------
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      Co-authored-by: default avatarzeo <108888572+zeozeozeo@users.noreply.github.com>
      Co-authored-by: default avatarLouis Beaumont <louis.beaumont@gmail.com>
      Co-authored-by: default avatarDaniel Hiltgen <dhiltgen@users.noreply.github.com>
      Co-authored-by: default avatarMichael Yang <mxyng@pm.me>
      Co-authored-by: default avatarParth Sareen <parth.sareen@ollama.com>
      Co-authored-by: default avatarJeffrey Morgan <jmorganca@gmail.com>
      Co-authored-by: default avatarBruce MacDonald <brucewmacdonald@gmail.com>
      Co-authored-by: default avatarJesse Gross <jesse@ollama.com>
      Co-authored-by: default avatarNikita <50599445+nasrally@users.noreply.github.com>
      
      * Revert Readme changes
      
      * Revert
      
      * Revert changes in amd_linux.go
      
      * Revert changes in amd_linux.go
      
      * Remove flashattention setting gpu.go
      
      * Revert whitespace changes in gpu.go
      
      * Revert changes in transforms_test.go
      
      * Revert changes in runner.go
      
      * Revert changes in Makefile.sync
      
      * Revert some unintented changes in Dockerfile
      
      * Revert vulkan copy changes in Dockerfile
      
      * Update Vulkan Code to de4c07f93783a1a96456a44dc16b9db538ee1618
      
      * Fixed duplicate sync in ggml.go
      
      * Revert changes in ggml.go
      
      * Revert chnages in ggml.go
      
      * enable falsh attention on vulkan
      
      * revert remove parenthesis
      
      * fixed flash attention logic enabling
      
      * vk_check_flash_attention 0 means supported
      
      * Update gpu.go
      
      * Add vulkan to Windows Build script
      
      * Remove commented out code
      
      * Enable Vulkan Flash attention in FlashAttentionSupported
      
      * Fix logging
      
      * Update Vulkan backend to e54d41befcc1575f4c898c5ff4ef43970cead75f
      
      * Removed libcap related code
      
      libcap is not directly related to Vulkan and should be added by its own PR. It adds additional library dependencies for building and also requires users to run setcap or run ollama as root, which is not ideal for easy use
      
      * Fix Unit Test (Add Vulkan Library)
      
      * Add vulkan to TestHomogeneousGPUs
      Test
      
      * vulkan: get GPU ID (ollama v0.11.5)
      Signed-off-by: default avatarXiaodong Ye <xiaodong.ye@mthreads.com>
      
      * disable mmap for vulkan
      
      * Reduce Changes remove TestHomogeneousGPUs (doesn't exist on master)
      
      * Update vulkan version to the version used in llama.cpp
      
      * rename gpu patch to correct number
      
      * added Vulkan API to get correct Device UUID
      
      current UUID from pipelineCacheUUID does not match CUDA
      
      * Fix GPU ID Patch
      
      * Remove Code not in llama.cpp
      
      * modified UUID code inside ggml
      
      * Fix Patch
      
      * Copied minimal definition from vulkan header
      
      * Fix compile error in Mac
      
      Metal is preferred so we're disabling Vulkan for now
      
      * Removed unused code
      
      Fix linter error in CI
      
      * Fix patches apply
      
      * fixing lint error
      
      * Removed unneeded function call
      
      Somehow removing this call fixed the crashing when Vulkan header was removed
      
      * added missing NL
      
      * Fixed missing members in Vulkan header
      
      also added zero clear for some structs
      
      * Fixed wrong structure ID
      
      * Fixed Vulkan header
      
      More aligned with official header definition now
      
      * buildvulkanAsSeperateFunction
      
      * Vulkan on Windows Test
      
      * temporarly comment out gate to run windows task
      
      * use temporarly windows-latest for build
      
      * Commenting out other presets to build vulkan
      
      * reenable cpu
      
      * commenting out error action stop
      
      * temporarly commenting out rocm
      
      * set vulkan path
      
      * comment out cude for faster turnaround
      
      * correct vulkan install
      
      * correct vulkan silent install
      
      * fixed install command
      
      * revert debugging changes (vulkan builds on windows)
      
      * revert windows-latest
      
      * trying to build vulkan for linux
      
      * temporarly disable cuda and rocm
      
      * try again linux build
      
      * fix version
      
      * trying to fix
      
      * trying again
      
      * trying again
      
      * fix version
      
      * fixed vulkan-sdk name
      
      * try again
      
      * trying again
      
      * try without version number
      
      * try again
      
      * add some more extra
      
      * trying to use version 1.4.313
      
      * revert debugging changes
      
      * Filter out already supported gpus
      
      * revert debug code
      
      * Use runners for GPU discovery
      
      This revamps how we discover GPUs in the system by leveraging the Ollama
      runner.  This should eliminate inconsistency between our GPU discovery and the
      runners capabilities at runtime, particularly for cases where we try to filter
      out unsupported GPUs.  Now the runner does that implicitly based on the actual
      device list.  In some cases free VRAM reporting can be unreliable which can
      leaad to scheduling mistakes, so this also includes a patch to leverage more
      reliable VRAM reporting libraries if available.
      
      Automatic workarounds have been removed as only one GPU leveraged this, which
      is now documented. This GPU will soon fall off the support matrix with the next
      ROCm bump.
      
      Additional cleanup of the scheduler and discovery packages can be done in the
      future once we have switched on the new memory management code, and removed
      support for the llama runner.
      
      * timing info for runner
      
      * WIP - wire up Vulkan with the new engine based discovery
      
      Not a complete implementation - free VRAM is better, but not accurate on
      windows
      
      * fix - trust the library paths from discovery when starting runner
      
      * fix index bug
      
      * fix vulkan ids to be underlying
      
      * fix - give bootstrapping more time on slow systems
      
      * Test if Vulkan device is supported
      
      * vk_check_flash_attention is not needed (coompat2 coopmapt and scalar implementation exist)
      
      * Handle GGML_VK_VISIBLE_DEVICES
      
      * ask for supported first
      
      * win: fix CPU query buffer handling
      
      Try in a short loop until we get the size right.
      
      * test: harden integration tests for slow start
      
      If the server takes a while to start up, block
      tests from starting until it's online to avoid
      setting large timeouts in individual test cases.
      
      * gofumpt fix
      
      * fix build
      
      * merge fixes
      
      * merge fixes
      
      * fixed build
      
      * merge fixes
      
      * fixing build
      
      * fixed build
      
      * fixed formatting
      
      * fixed build
      
      * fix vulkan gpu id patch
      
      * sync llama.cpp vulkan code
      
      * update build windows script
      
      * merge fixes
      
      * fix format
      
      * fixed vulkan casing
      
      * handle igpu as gpu
      
      * improve case
      
      * print out unknown library
      
      * rturn Vulkan for vulkan library
      
      * Revert "rturn Vulkan for vulkan library"
      
      This reverts commit 690461a12fd5e93295d174c97edefb2bc33285b1.
      
      * fixed patch number
      
      * return Library Name
      
      * remvoe debug code
      
      * return integrated in vulkan backend
      
      * Return pci Properties
      
      * update patch
      
      * directly get pci proeprties without parsing
      
      * workaround for filtering devices. Correct way is to have a LibraryPosition Parameter in the deviceInfo
      
      * Revert "directly get pci proeprties without parsing"
      
      This reverts commit 8e0624851f5ed7d9f74518f574dfb422e4dd4dc2.
      
      * Set FilteredID for Environment Filtering
      
      * ROCm Library is named ROCm
      
      * revert changes in patch
      
      * Create 0028-vulkan-pci-and-memory.patch
      
      * vulkan memory patch
      
      * casing fix
      
      * Add more pci properties
      
      * Added better memory management
      
      * Added better memory managament
      
      * fixed patch
      
      * Fixed patch
      
      * FilterID creation group by library
      
      * filter out vulkan supported by other gpu
      
      * fixing deviceid compare
      
      * Vulkan Fix FA coopmat1 invalid array indexing
      
      * Use everywhere the same Vulkan Version 1.4.321.1
      
      * Remove unneeded patch
      
      * vulkan update
      
      * sync vulkan glsl files
      
      * only use for vulkan the filteredid (numeric device number)
      
      * simplify code
      
      ---------
      Signed-off-by: default avatarVadim Grinco <vadim@grinco.eu>
      Signed-off-by: default avatarXiaodong Ye <xiaodong.ye@mthreads.com>
      Co-authored-by: default avatarpufferffish <github@bandersnatch.anonaddy.com>
      Co-authored-by: KOISHI KOMEIJI FROM TOUHOU 11 <fuck>
      Co-authored-by: default avatarDSLstandard <qgeneral35@gmail.com>
      Co-authored-by: default avatarpufferffish <me@windtfw.com>
      Co-authored-by: default avataryeongbba <yeongmo.lee@logpresso.com>
      Co-authored-by: default avatartomaThomas <tomathomas@mailbox.org>
      Co-authored-by: default avatarAntoine Viallon <antoine@lesviallon.fr>
      Co-authored-by: default avatarVadim Grinco <vadim@grinco.eu>
      Co-authored-by: default avatarzeo <108888572+zeozeozeo@users.noreply.github.com>
      Co-authored-by: default avatarLouis Beaumont <louis.beaumont@gmail.com>
      Co-authored-by: default avatarDaniel Hiltgen <dhiltgen@users.noreply.github.com>
      Co-authored-by: default avatarMichael Yang <mxyng@pm.me>
      Co-authored-by: default avatarParth Sareen <parth.sareen@ollama.com>
      Co-authored-by: default avatarJeffrey Morgan <jmorganca@gmail.com>
      Co-authored-by: default avatarBruce MacDonald <brucewmacdonald@gmail.com>
      Co-authored-by: default avatarJesse Gross <jesse@ollama.com>
      Co-authored-by: default avatarNikita <50599445+nasrally@users.noreply.github.com>
      Co-authored-by: default avatarMasato Nakasaka <masato.nakasaka@intel.com>
      Co-authored-by: default avatarXiaodong Ye <xiaodong.ye@mthreads.com>
      Co-authored-by: default avatarDaniel Hiltgen <daniel@ollama.com>
      2aba569a
  10. 11 Oct, 2025 1 commit
  11. 09 Oct, 2025 3 commits
  12. 06 Oct, 2025 1 commit
    • Daniel Hiltgen's avatar
      discovery: prevent dup OLLAMA_LIBRARY_PATH (#12514) · 04c18498
      Daniel Hiltgen authored
      This variable isn't currently documented or intended as something the user can
      override, but if the user happens to set OLLAMA_LIBRARY_PATH we were doubling
      this in the subprocess environment which will cause problems with the new
      bootstrap discovery logic.
      04c18498
  13. 02 Oct, 2025 1 commit
    • Jesse Gross's avatar
      llm: Allow overriding flash attention setting · fdb10946
      Jesse Gross authored
      As we automatically enable flash attention for more models, there
      are likely some cases where we get it wrong. This allows setting
      OLLAMA_FLASH_ATTENTION=0 to disable it, even for models that usually
      have flash attention.
      fdb10946
  14. 01 Oct, 2025 1 commit
    • Daniel Hiltgen's avatar
      Use runners for GPU discovery (#12090) · bc8909fb
      Daniel Hiltgen authored
      This revamps how we discover GPUs in the system by leveraging the Ollama
      runner.  This should eliminate inconsistency between our GPU discovery and the
      runners capabilities at runtime, particularly for cases where we try to filter
      out unsupported GPUs.  Now the runner does that implicitly based on the actual
      device list.  In some cases free VRAM reporting can be unreliable which can
      leaad to scheduling mistakes, so this also includes a patch to leverage more
      reliable VRAM reporting libraries if available.
      
      Automatic workarounds have been removed as only one GPU leveraged this, which
      is now documented. This GPU will soon fall off the support matrix with the next
      ROCm bump.
      
      Additional cleanup of the scheduler and discovery packages can be done in the
      future once we have switched on the new memory management code, and removed
      support for the llama runner.
      bc8909fb
  15. 30 Sep, 2025 1 commit
    • Jesse Gross's avatar
      ggml: Remove allocation status reporting · 734b57da
      Jesse Gross authored
      For each memory allocation we report the size of the (attempted)
      allocation and whether it succeeded or failed. The latter status
      reporting proved to be not that useful in practice as systems
      such as Windows can automatically overflow from VRAM into RAM,
      resultings in successful allocations even when there isn't
      enough memory where we wanted.
      
      As a result, this information is only used for debug logging,
      which isn't worthwhile enough for the amount of code. It
      also isn't fully accurate, as multiple allocations may result
      in partial failures.
      734b57da
  16. 12 Sep, 2025 2 commits
  17. 11 Sep, 2025 2 commits
    • Jesse Gross's avatar
      llm: Don't try to load split vision models in the Ollama engine · aba15753
      Jesse Gross authored
      If a model with a split vision projector is loaded in the Ollama
      engine, the projector will be ignored and the model will hallucinate
      a response. Instead, fallback and try to load the model in the llama
      engine.
      aba15753
    • Jesse Gross's avatar
      llm: Enable new memory estimates by default · eb10390d
      Jesse Gross authored
      New memory estimates (see #11090 for more information) are now
      enabled automatically for all models running on the Ollama engine,
      improving both stability and performance through more accurate sizing
      and allocation. Models running on the llama engine will continue to
      use the original style of memory estimation.
      eb10390d
  18. 10 Sep, 2025 2 commits
  19. 09 Sep, 2025 1 commit
    • Jesse Gross's avatar
      llm: Clamp batch size to context size · e119783e
      Jesse Gross authored
      The context must always be able to store the current batch, so
      if the user requests a small context then we should also shrink
      the batch to match. This also fixes the TestLongInputContext
      test on the new engine. (The old engine already has this behavior.)
      e119783e
  20. 08 Sep, 2025 1 commit
  21. 02 Sep, 2025 2 commits
  22. 29 Aug, 2025 1 commit
  23. 26 Aug, 2025 1 commit
  24. 20 Aug, 2025 1 commit
    • Jesse Gross's avatar
      llm: Don't always evict models in CPU-only mode · 073fa31d
      Jesse Gross authored
      With old memory estimates, it's currently impossible to load more
      than one model at a time when no GPUs are available. This is because
      the check for whether we need to evict a model looks to see if all
      layers of the new model can be loaded onto GPUs, which is never true
      if there are no GPUs. Before the memory management changes, there
      was a special code path for CPU-only systems.
      
      This problem does not exist with new memory estimates.
      
      Fixes #11974
      073fa31d
  25. 18 Aug, 2025 1 commit
    • Jesse Gross's avatar
      llm: Check for nil memory data before printing · e3ade453
      Jesse Gross authored
      We dump out our best memory estimate after we complete processing
      for any reason, including errors. This is helpful for finding what
      what stopped us in error conditions but in some cases we might not
      have gotten even the first result yet.
      
      Fixes #11957
      e3ade453
  26. 14 Aug, 2025 1 commit
    • Jesse Gross's avatar
      llm: New memory management · d5a0d8d9
      Jesse Gross authored
      This changes the memory allocation strategy from upfront estimation to
      tracking actual allocations done by the engine and reacting to that. The
      goal is avoid issues caused by both under-estimation (crashing) and
      over-estimation (low performance due to under-utilized GPUs).
      
      It is currently opt-in and can be enabled for models running on the
      Ollama engine by setting OLLAMA_NEW_ESTIMATES=1. Behavior in other
      cases is unchanged and will continue to use the existing estimates.
      d5a0d8d9
  27. 23 Jun, 2025 2 commits
    • Daniel Hiltgen's avatar
      avoid context overflow (#11175) · 10a8e04a
      Daniel Hiltgen authored
      For smaller context models, make sure we do not exceed the training size.
      10a8e04a
    • Daniel Hiltgen's avatar
      Re-remove cuda v11 (#10694) · 1c6669e6
      Daniel Hiltgen authored
      * Re-remove cuda v11
      
      Revert the revert - drop v11 support requiring drivers newer than Feb 23
      
      This reverts commit c6bcdc42.
      
      * Simplify layout
      
      With only one version of the GPU libraries, we can simplify things down somewhat.  (Jetsons still require special handling)
      
      * distinct sbsa variant for linux arm64
      
      This avoids accidentally trying to load the sbsa cuda libraries on
      a jetson system which results in crashes.
      
      * temporary prevent rocm+cuda mixed loading
      1c6669e6
  28. 29 May, 2025 1 commit
    • Jesse Gross's avatar
      llm: Make "POST predict" error message more informative · f15ffc43
      Jesse Gross authored
      "POST predict" basically means that the runner has crashed, which
      can have many reasons. However, many people think this is a specific
      error and either report only this message or group together unrelated
      bugs. This replaces it with a more friendly and helpful message.
      f15ffc43
  29. 19 May, 2025 1 commit
    • Jesse Gross's avatar
      ggml: Seperate tensor load from backend creation · 94ab428e
      Jesse Gross authored
      Currently, when the backend is created, the tensors are loaded at the
      same time, which is a slow operation. This separates them to be two
      steps:
       - Create backend, including enumerating tensors and memory allocation
       - Loading tensor data
      
      This allows more flexibility in managing model loading.
      94ab428e