Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
mlx, mlxrunner: move the MLX engine out of x/
Jesse Gross2e036e7cdf7b
diff --git a/.github/scripts/prepare_mlx_darwin.sh b/.github/scripts/prepare_mlx_darwin.shindex 6e8a19d92..d153e34bd 100755--- a/.github/scripts/prepare_mlx_darwin.sh+++ b/.github/scripts/prepare_mlx_darwin.sh@@ -9,7 +9,7 @@## The payload also depends on Ollama's payload build rules (cmake glue and# carried mlx/compat patches) and the xgrammar native wrapper-# (x/mlxrunner/xgrammar/native). Rule drift rebuilds the whole payload from+# (mlxrunner/xgrammar/native). Rule drift rebuilds the whole payload from# source; wrapper-only drift rebuilds just libollama_xgrammar.dylib.## If no release matches the MLX pins (e.g. right after a pin bump), the@@ -54,7 +54,7 @@ read_pin() {# Native wrapper sources compiled into libollama_xgrammar.dylib — keep in# sync with the ollama_xgrammar target in cmake/mlx/CMakeLists.txt.-xgrammar_native_dir=x/mlxrunner/xgrammar/native+xgrammar_native_dir=mlxrunner/xgrammar/native# Payload build rules beyond the MLX_VERSION/MLX_C_VERSION pins.payload_rule_files=(@@ -62,7 +62,7 @@ payload_rule_files=("cmake/apply-git-patches.cmake""cmake/mlx/CMakeLists.txt""cmake/mlx/CMakePresets.json"- "x/mlxrunner/mlx/CMakeLists.txt"+ "mlx/CMakeLists.txt")# Build-rule inputs: the rule files plus carried MLX/MLX-C patch content.diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yamlindex e1ebd0bdc..f7ea8bf56 100644--- a/.github/workflows/test.yaml+++ b/.github/workflows/test.yaml@@ -49,10 +49,11 @@ jobs:'LLAMA_CPP_VERSION' \'MLX_VERSION' \'MLX_C_VERSION' \- 'x/imagegen/mlx/**' \- 'x/imagegen/mlx/**/*' \- 'x/mlxrunner/xgrammar/native/**' \- 'x/mlxrunner/xgrammar/native/**/*' \+ 'mlx/CMakeLists.txt' \+ 'mlx/compat/**' \+ 'mlx/compat/**/*' \+ 'mlxrunner/xgrammar/native/**' \+ 'mlxrunner/xgrammar/native/**/*' \'.github/**/*') | tee -a $GITHUB_OUTPUTecho app_changed=$(changed 'app/**' 'app/**/*') | tee -a $GITHUB_OUTPUTecho go_mod_changed=$(changed 'go.mod') | tee -a $GITHUB_OUTPUT@@ -417,7 +418,7 @@ jobs:with:path: .cache/mlx-darwin-release# Key on every payload input so a source-built payload survives pushes.- key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'x/mlxrunner/mlx/CMakeLists.txt', 'mlx/compat/**', 'x/mlxrunner/xgrammar/native/**') }}+ key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'mlx/CMakeLists.txt', 'mlx/compat/**', 'mlxrunner/xgrammar/native/**') }}- name: Prepare MLX Darwin release payloadif: ${{ startsWith(matrix.os, 'macos') }}run: .github/scripts/prepare_mlx_darwin.sh@@ -437,11 +438,9 @@ jobs:cmake -S . -B build/mlx-generate -DOLLAMA_MLX_BACKENDS=cuda_v13cmake --build build/mlx-generate --target ollama-mlx-generate-wrappersgit diff --exit-code -- \- x/imagegen/mlx/mlx.h \- x/imagegen/mlx/mlx.c \- x/mlxrunner/mlx/generated.h \- x/mlxrunner/mlx/generated.c \- x/mlxrunner/mlx/include/mlx/c+ mlx/generated.h \+ mlx/generated.c \+ mlx/include/mlx/c- name: Run go generaterun: go generate ./...@@ -484,7 +483,7 @@ jobs:with:path: .cache/mlx-darwin-release# Key on every payload input so a source-built payload survives pushes.- key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'x/mlxrunner/mlx/CMakeLists.txt', 'mlx/compat/**', 'x/mlxrunner/xgrammar/native/**') }}+ key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'mlx/CMakeLists.txt', 'mlx/compat/**', 'mlxrunner/xgrammar/native/**') }}- name: Prepare MLX Darwin release payloadif: ${{ startsWith(matrix.os, 'macos') }}run: .github/scripts/prepare_mlx_darwin.shdiff --git a/.golangci.yaml b/.golangci.yamlindex 2b843b6ce..5c532d23e 100644--- a/.golangci.yaml+++ b/.golangci.yaml@@ -27,9 +27,14 @@ linters:files:- $all- "!$test"+ - "!**/mlx/mlxtest/*.go"deny:- pkg: github.com/ollama/ollama/internal/testutildesc: test helpers may only be imported by test files+ - pkg: github.com/ollama/ollama/mlx/mlxtest+ desc: test helpers may only be imported by test files+ - pkg: github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest+ desc: test helpers may only be imported by test filesgovet:disable:- unusedresultdiff --git a/Dockerfile b/Dockerfileindex 3a6abc331..6c629077e 100644--- a/Dockerfile+++ b/Dockerfile@@ -220,9 +220,8 @@ ENV CGO_LDFLAGS="-L/usr/local/cuda-13/lib64 -L/usr/local/cuda-13/targets/x86_64-WORKDIR /go/src/github.com/ollama/ollamaCOPY CMakeLists.txt CMakePresets.json .COPY cmake cmake-COPY mlx/compat mlx/compat-COPY x/mlxrunner/mlx x/mlxrunner/mlx-COPY x/mlxrunner/xgrammar/native x/mlxrunner/xgrammar/native+COPY mlx mlx+COPY mlxrunner/xgrammar/native mlxrunner/xgrammar/nativeCOPY go.mod go.sum .COPY MLX_VERSION MLX_C_VERSION .RUN curl -fsSL https://golang.org/dl/go$(awk '/^go/ { print $2 }' go.mod).linux-$(case $(uname -m) in x86_64) echo amd64 ;; aarch64) echo arm64 ;; esac).tar.gz | tar xz -C /usr/localdiff --git a/cmake/local.cmake b/cmake/local.cmakeindex 3535a5556..2fb9b8429 100644--- a/cmake/local.cmake+++ b/cmake/local.cmake@@ -175,8 +175,8 @@ if(OLLAMA_MLX_BACKENDS)find_package(Git REQUIRED)set(OLLAMA_MLX_C_COMPAT_PATCH_COMMAND${CMAKE_COMMAND}- -DPATCH_DIR=${CMAKE_SOURCE_DIR}/mlx/compat- -DPATCH_LABEL=mlx/compat+ -DPATCH_DIR=${CMAKE_SOURCE_DIR}/mlx/compat/mlx-c+ -DPATCH_LABEL=mlx/compat/mlx-c-P ${CMAKE_SOURCE_DIR}/cmake/apply-git-patches.cmakeCACHE INTERNAL "MLX-C carry patch")@@ -236,7 +236,7 @@ if(OLLAMA_MLX_BACKENDS)add_custom_target(ollama-mlx-vendor-headersCOMMAND ${CMAKE_COMMAND}-DMLX_C_HEADERS_DIR=${OLLAMA_MLX_C_SOURCE_DIR}/mlx/c- -DMLX_C_HEADERS_DEST=${CMAKE_SOURCE_DIR}/x/mlxrunner/mlx/include/mlx/c+ -DMLX_C_HEADERS_DEST=${CMAKE_SOURCE_DIR}/mlx/include/mlx/c-P "${CMAKE_SOURCE_DIR}/cmake/vendor-mlx-c-headers.cmake"DEPENDS ${_mlx_source_targets}COMMENT "Vendoring MLX-C headers"@@ -623,7 +623,7 @@ if(OLLAMA_MLX_BACKENDS)add_custom_target(ollama-mlx-generate-wrappersCOMMAND ${CMAKE_COMMAND} -E envCC= CGO_CFLAGS= CGO_CXXFLAGS=- ${GO_EXECUTABLE} generate ./x/...+ ${GO_EXECUTABLE} generate ./mlx/...WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}DEPENDS ollama-mlx-sourcesCOMMENT "Regenerating MLX Go wrappers"diff --git a/cmake/mlx/CMakeLists.txt b/cmake/mlx/CMakeLists.txtindex 997577d0f..984b06572 100644--- a/cmake/mlx/CMakeLists.txt+++ b/cmake/mlx/CMakeLists.txt@@ -59,7 +59,7 @@ foreach(_cudnn_var CUDNN_INCLUDE_PATH CUDNN_LIBRARY_PATH)set(${_cudnn_var} "$ENV{${_cudnn_var}}" CACHE PATH "")endif()endforeach()-add_subdirectory(${OLLAMA_SOURCE_DIR}/x/mlxrunner/mlx ${CMAKE_BINARY_DIR}/x/mlxrunner/mlx)+add_subdirectory(${OLLAMA_SOURCE_DIR}/mlx ${CMAKE_BINARY_DIR}/mlx)include(FetchContent)set(XGRAMMAR_VERSION v0.2.5)@@ -88,9 +88,9 @@ target_compile_definitions(xgrammar PUBLICXGRAMMAR_ENABLE_INTERNAL_CHECK=0)add_library(ollama_xgrammar SHARED- "${OLLAMA_SOURCE_DIR}/x/mlxrunner/xgrammar/native/xgrammar.cpp")+ "${OLLAMA_SOURCE_DIR}/mlxrunner/xgrammar/native/xgrammar.cpp")target_include_directories(ollama_xgrammar PRIVATE- "${OLLAMA_SOURCE_DIR}/x/mlxrunner/xgrammar/native")+ "${OLLAMA_SOURCE_DIR}/mlxrunner/xgrammar/native")target_compile_definitions(ollama_xgrammar PRIVATEOLLAMA_XGRAMMAR_BUILD=1OLLAMA_XGRAMMAR_VERSION="${XGRAMMAR_VERSION}")diff --git a/cmd/cmd.go b/cmd/cmd.goindex bd529fc1d..baba019c1 100644--- a/cmd/cmd.go+++ b/cmd/cmd.go@@ -42,12 +42,15 @@ import ("github.com/ollama/ollama/cmd/config""github.com/ollama/ollama/cmd/launch""github.com/ollama/ollama/cmd/tui"+ "github.com/ollama/ollama/create"+ createclient "github.com/ollama/ollama/create/client""github.com/ollama/ollama/discover""github.com/ollama/ollama/envconfig""github.com/ollama/ollama/format""github.com/ollama/ollama/internal/modelref""github.com/ollama/ollama/logutil""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlxrunner""github.com/ollama/ollama/parser""github.com/ollama/ollama/progress""github.com/ollama/ollama/readline"@@ -55,9 +58,6 @@ import ("github.com/ollama/ollama/types/model""github.com/ollama/ollama/types/syncmap""github.com/ollama/ollama/version"- xcreate "github.com/ollama/ollama/x/create"- xcreateclient "github.com/ollama/ollama/x/create/client"- "github.com/ollama/ollama/x/mlxrunner")func init() {@@ -191,7 +191,7 @@ func resolveCreateLocalModelDir(ref, filename string) string {}candidate := filepath.Join(filepath.Dir(filename), ref)- if xcreate.IsSafetensorsModelDir(candidate) {+ if create.IsSafetensorsModelDir(candidate) {return candidate}@@ -203,14 +203,14 @@ func resolveCreateDraftDir(ref, filename string) (string, error) {return "", nil}if filepath.IsAbs(ref) {- if xcreate.IsSafetensorsModelDir(ref) {+ if create.IsSafetensorsModelDir(ref) {return ref, nil}return "", fmt.Errorf("draft %s is not a supported safetensors model directory", ref)}if filename != "" {candidate := filepath.Join(filepath.Dir(filename), ref)- if xcreate.IsSafetensorsModelDir(candidate) {+ if create.IsSafetensorsModelDir(candidate) {return candidate, nil}}@@ -241,28 +241,28 @@ func readCreateModelfile(cmd *cobra.Command) (*parser.Modelfile, string, error)return modelfile, filename, nil}-func safetensorsCreateOptions(modelfile *parser.Modelfile, filename, modelName string) (xcreateclient.CreateOptions, bool, error) {- modelDir, mfConfig, err := xcreateclient.ConfigFromModelfile(modelfile)+func safetensorsCreateOptions(modelfile *parser.Modelfile, filename, modelName string) (createclient.CreateOptions, bool, error) {+ modelDir, mfConfig, err := createclient.ConfigFromModelfile(modelfile)if err != nil {- return xcreateclient.CreateOptions{}, false, err+ return createclient.CreateOptions{}, false, err}modelDir = resolveCreateLocalModelDir(modelDir, filename)- isSafetensors := xcreate.IsSafetensorsModelDir(modelDir)- isBaseModelWithDraft := mfConfig.Draft != "" && !isSafetensors && xcreate.IsSafetensorsLLMModel(modelDir)+ isSafetensors := create.IsSafetensorsModelDir(modelDir)+ isBaseModelWithDraft := mfConfig.Draft != "" && !isSafetensors && create.IsSafetensorsLLMModel(modelDir)if !isSafetensors && !isBaseModelWithDraft {- return xcreateclient.CreateOptions{}, false, nil+ return createclient.CreateOptions{}, false, nil}if mfConfig.Draft != "" {draftDir, err := resolveCreateDraftDir(mfConfig.Draft, filename)if err != nil {if isSafetensors {- return xcreateclient.CreateOptions{}, false, err+ return createclient.CreateOptions{}, false, err}// Existing safetensors models may still use a GGUF DRAFT layer;// leave that combination on the standard create path.- return xcreateclient.CreateOptions{}, false, nil+ return createclient.CreateOptions{}, false, nil}mfConfig.Draft = draftDir}@@ -277,13 +277,13 @@ func safetensorsCreateOptions(modelfile *parser.Modelfile, filename, modelName s}}if modelCount != 1 {- return xcreateclient.CreateOptions{}, false, errors.New("safetensors imports require exactly one FROM source")+ return createclient.CreateOptions{}, false, errors.New("safetensors imports require exactly one FROM source")}if draftCount > 1 {- return xcreateclient.CreateOptions{}, false, errors.New("safetensors imports support at most one DRAFT source")+ return createclient.CreateOptions{}, false, errors.New("safetensors imports support at most one DRAFT source")}- return xcreateclient.CreateOptions{+ return createclient.CreateOptions{ModelName: modelName,ModelDir: modelDir,Modelfile: mfConfig,@@ -298,9 +298,9 @@ var (// createSafetensorsModel imports in-process when the server is local and// otherwise uploads the source files for the server to import.-func createSafetensorsModel(cmd *cobra.Command, args []string, opts xcreateclient.CreateOptions, p *progress.Progress) error {+func createSafetensorsModel(cmd *cobra.Command, args []string, opts createclient.CreateOptions, p *progress.Progress) error {if !envconfig.CreateRemote() && isLocalhost() {- return xcreateclient.CreateModel(cmd.Context(), opts, p)+ return createclient.CreateModel(cmd.Context(), opts, p)}if opts.Force {return errForceLocalOnly@@ -312,7 +312,7 @@ func createSafetensorsModel(cmd *cobra.Command, args []string, opts xcreateclienif err != nil {return err}- return xcreateclient.CreateModelRemote(cmd.Context(), client, opts, p)+ return createclient.CreateModelRemote(cmd.Context(), client, opts, p)}func CreateHandler(cmd *cobra.Command, args []string) error {diff --git a/x/create/blockfp8.go b/create/blockfp8.gosimilarity index 100%rename from x/create/blockfp8.gorename to create/blockfp8.godiff --git a/x/create/blockfp8_test.go b/create/blockfp8_test.gosimilarity index 100%rename from x/create/blockfp8_test.gorename to create/blockfp8_test.godiff --git a/x/create/classify.go b/create/classify.gosimilarity index 99%rename from x/create/classify.gorename to create/classify.goindex e8fc28e2c..26d914d0f 100644--- a/x/create/classify.go+++ b/create/classify.go@@ -4,7 +4,7 @@ import ("fmt""strings"- "github.com/ollama/ollama/x/quant"+ "github.com/ollama/ollama/mlx/quant")// SourceKind is the overarching dtype for a given safetensors modeldiff --git a/x/create/classify_test.go b/create/classify_test.gosimilarity index 100%rename from x/create/classify_test.gorename to create/classify_test.godiff --git a/x/create/client/create.go b/create/client/create.gosimilarity index 97%rename from x/create/client/create.gorename to create/client/create.goindex 9d5ac9762..80986ce13 100644--- a/x/create/client/create.go+++ b/create/client/create.go@@ -14,12 +14,12 @@ import ("golang.org/x/mod/semver""github.com/ollama/ollama/api"+ "github.com/ollama/ollama/create""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlx/quant""github.com/ollama/ollama/parser""github.com/ollama/ollama/progress""github.com/ollama/ollama/types/model"- "github.com/ollama/ollama/x/create"- "github.com/ollama/ollama/x/quant")var errAdaptersUnsupported = errors.New("LoRA adapters are no longer supported")@@ -49,7 +49,7 @@ var ignoredModelfileParameters = []string{"mirostat_eta",}-// ConfigFromModelfile extracts the model directory and x/create-specific+// ConfigFromModelfile extracts the model directory and create-specific// Modelfile configuration from a parsed Modelfile.func ConfigFromModelfile(modelfile *parser.Modelfile) (string, *ModelfileConfig, error) {var modelDir string@@ -206,7 +206,7 @@ func CreateModel(ctx context.Context, opts CreateOptions, p *progress.Progress)return nil}- // Create the model through the x/create pipeline (read → classify → plan+ // Create the model through the create pipeline (read → classify → plan// → write), supplying blob storage and manifest assembly.pipelineOpts := create.PipelineOptions{Quantize: opts.Quantize,diff --git a/x/create/client/create_test.go b/create/client/create_test.gosimilarity index 99%rename from x/create/client/create_test.gorename to create/client/create_test.goindex 4acbadc43..f5e67f9bc 100644--- a/x/create/client/create_test.go+++ b/create/client/create_test.go@@ -13,10 +13,10 @@ import ("github.com/google/go-cmp/cmp"+ "github.com/ollama/ollama/create""github.com/ollama/ollama/manifest""github.com/ollama/ollama/parser""github.com/ollama/ollama/types/model"- "github.com/ollama/ollama/x/create")func TestModelfileConfig(t *testing.T) {diff --git a/x/create/client/remote.go b/create/client/remote.gosimilarity index 98%rename from x/create/client/remote.gorename to create/client/remote.goindex 038e3bd28..515e6484e 100644--- a/x/create/client/remote.go+++ b/create/client/remote.go@@ -18,16 +18,16 @@ import ("golang.org/x/sync/errgroup""github.com/ollama/ollama/api"+ "github.com/ollama/ollama/create""github.com/ollama/ollama/envconfig""github.com/ollama/ollama/progress"- "github.com/ollama/ollama/x/create")// Six attempts produce at most 31 seconds of exponential backoff per blob.const maxUploadRetries = 6// CreateModelRemote uploads raw safetensors source files and asks the server to-// run the x/create import pipeline. The server performs planning, transforms,+// run the create import pipeline. The server performs planning, transforms,// and MLX quantization against its own hardware.func CreateModelRemote(ctx context.Context, client *api.Client, opts CreateOptions, p *progress.Progress) error {if opts.Force {diff --git a/x/create/client/remote_test.go b/create/client/remote_test.gosimilarity index 100%rename from x/create/client/remote_test.gorename to create/client/remote_test.godiff --git a/x/create/cohere2moe.go b/create/cohere2moe.gosimilarity index 100%rename from x/create/cohere2moe.gorename to create/cohere2moe.godiff --git a/x/create/create.go b/create/create.gosimilarity index 99%rename from x/create/create.gorename to create/create.goindex f75fa90b9..f8236eb7c 100644--- a/x/create/create.go+++ b/create/create.go@@ -14,9 +14,9 @@ import ("strconv""strings"+ "github.com/ollama/ollama/fs/safetensors""github.com/ollama/ollama/manifest""github.com/ollama/ollama/types/model"- "github.com/ollama/ollama/x/safetensors")// SafetensorsMinOllamaVersion is the minimum Ollama version required fordiff --git a/x/create/create_test.go b/create/create_test.gosimilarity index 99%rename from x/create/create_test.gorename to create/create_test.goindex ebc53ea44..993b812a9 100644--- a/x/create/create_test.go+++ b/create/create_test.go@@ -12,9 +12,9 @@ import ("strings""testing"+ st "github.com/ollama/ollama/fs/safetensors""github.com/ollama/ollama/manifest""github.com/ollama/ollama/types/model"- st "github.com/ollama/ollama/x/safetensors")func TestValidateScalarFloat32TensorData(t *testing.T) {diff --git a/x/create/draft.go b/create/draft.gosimilarity index 100%rename from x/create/draft.gorename to create/draft.godiff --git a/x/create/draft_test.go b/create/draft_test.gosimilarity index 99%rename from x/create/draft_test.gorename to create/draft_test.goindex 4df89067e..c0ef587c2 100644--- a/x/create/draft_test.go+++ b/create/draft_test.go@@ -8,7 +8,7 @@ import ("slices""testing"- st "github.com/ollama/ollama/x/safetensors"+ st "github.com/ollama/ollama/fs/safetensors")// recordingStore captures the blobs a pipeline run produces so tests can assertdiff --git a/x/create/gemma4.go b/create/gemma4.gosimilarity index 100%rename from x/create/gemma4.gorename to create/gemma4.godiff --git a/x/create/gemma4_test.go b/create/gemma4_test.gosimilarity index 100%rename from x/create/gemma4_test.gorename to create/gemma4_test.godiff --git a/x/create/glimmer.go b/create/glimmer.gosimilarity index 100%rename from x/create/glimmer.gorename to create/glimmer.godiff --git a/x/create/glimmer_test.go b/create/glimmer_test.gosimilarity index 100%rename from x/create/glimmer_test.gorename to create/glimmer_test.godiff --git a/x/create/inventory.go b/create/inventory.gosimilarity index 99%rename from x/create/inventory.gorename to create/inventory.goindex efe02b312..eea8a2e5a 100644--- a/x/create/inventory.go+++ b/create/inventory.go@@ -7,7 +7,7 @@ import ("path/filepath""strings"- "github.com/ollama/ollama/x/safetensors"+ "github.com/ollama/ollama/fs/safetensors")// SourceTensor describes one tensor found in a source model: its on-disk typediff --git a/x/create/inventory_test.go b/create/inventory_test.gosimilarity index 99%rename from x/create/inventory_test.gorename to create/inventory_test.goindex 085916777..4c0a157d4 100644--- a/x/create/inventory_test.go+++ b/create/inventory_test.go@@ -7,7 +7,7 @@ import ("strings""testing"- st "github.com/ollama/ollama/x/safetensors"+ st "github.com/ollama/ollama/fs/safetensors")func writeConfigJSON(t *testing.T, dir, content string) {diff --git a/x/create/laguna.go b/create/laguna.gosimilarity index 100%rename from x/create/laguna.gorename to create/laguna.godiff --git a/x/create/laguna_test.go b/create/laguna_test.gosimilarity index 100%rename from x/create/laguna_test.gorename to create/laguna_test.godiff --git a/x/create/manifest.go b/create/manifest.gosimilarity index 100%rename from x/create/manifest.gorename to create/manifest.godiff --git a/x/create/manifest_test.go b/create/manifest_test.gosimilarity index 100%rename from x/create/manifest_test.gorename to create/manifest_test.godiff --git a/x/create/metadata.go b/create/metadata.gosimilarity index 100%rename from x/create/metadata.gorename to create/metadata.godiff --git a/x/create/metadata_test.go b/create/metadata_test.gosimilarity index 100%rename from x/create/metadata_test.gorename to create/metadata_test.godiff --git a/x/create/mlxthread.go b/create/mlxthread.gosimilarity index 91%rename from x/create/mlxthread.gorename to create/mlxthread.goindex e0c56bce7..7b9000f64 100644--- a/x/create/mlxthread.go+++ b/create/mlxthread.go@@ -6,8 +6,8 @@ import ("sync""sync/atomic"- "github.com/ollama/ollama/x/internal/mlxthread"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxthread")var (diff --git a/x/create/nemotron_h.go b/create/nemotron_h.gosimilarity index 100%rename from x/create/nemotron_h.gorename to create/nemotron_h.godiff --git a/x/create/nemotron_h_test.go b/create/nemotron_h_test.gosimilarity index 100%rename from x/create/nemotron_h_test.gorename to create/nemotron_h_test.godiff --git a/x/create/pipeline.go b/create/pipeline.gosimilarity index 100%rename from x/create/pipeline.gorename to create/pipeline.godiff --git a/x/create/pipeline_test.go b/create/pipeline_test.gosimilarity index 99%rename from x/create/pipeline_test.gorename to create/pipeline_test.goindex c558d0e9b..9d4f244f9 100644--- a/x/create/pipeline_test.go+++ b/create/pipeline_test.go@@ -10,8 +10,8 @@ import ("strings""testing"+ st "github.com/ollama/ollama/fs/safetensors""github.com/ollama/ollama/types/model"- st "github.com/ollama/ollama/x/safetensors")type blobStoreFunc func(io.Reader, string, string) (LayerInfo, error)diff --git a/x/create/plan.go b/create/plan.gosimilarity index 100%rename from x/create/plan.gorename to create/plan.godiff --git a/x/create/plan_test.go b/create/plan_test.gosimilarity index 100%rename from x/create/plan_test.gorename to create/plan_test.godiff --git a/x/create/prequant.go b/create/prequant.gosimilarity index 100%rename from x/create/prequant.gorename to create/prequant.godiff --git a/x/create/prequant_test.go b/create/prequant_test.gosimilarity index 100%rename from x/create/prequant_test.gorename to create/prequant_test.godiff --git a/x/create/quantize.go b/create/quantize.gosimilarity index 99%rename from x/create/quantize.gorename to create/quantize.goindex 2c7ee5a32..2f4e2d171 100644--- a/x/create/quantize.go+++ b/create/quantize.go@@ -9,8 +9,8 @@ import ("slices""strconv"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/quant"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/quant")// quantizeItem is one tensor going into a (possibly multi-tensor) quantizeddiff --git a/x/create/quantpolicy.go b/create/quantpolicy.gosimilarity index 100%rename from x/create/quantpolicy.gorename to create/quantpolicy.godiff --git a/x/create/qwen35.go b/create/qwen35.gosimilarity index 100%rename from x/create/qwen35.gorename to create/qwen35.godiff --git a/x/create/qwen4_exp.go b/create/qwen4_exp.gosimilarity index 100%rename from x/create/qwen4_exp.gorename to create/qwen4_exp.godiff --git a/x/create/qwen4_exp_test.go b/create/qwen4_exp_test.gosimilarity index 100%rename from x/create/qwen4_exp_test.gorename to create/qwen4_exp_test.godiff --git a/x/create/transform.go b/create/transform.gosimilarity index 98%rename from x/create/transform.gorename to create/transform.goindex ceb761cc8..99847011f 100644--- a/x/create/transform.go+++ b/create/transform.go@@ -5,7 +5,7 @@ import ("fmt""io"- "github.com/ollama/ollama/x/safetensors"+ "github.com/ollama/ollama/fs/safetensors")// applyByteTransform produces a TensorSpec's output tensor from its resolveddiff --git a/x/create/verify.go b/create/verify.gosimilarity index 97%rename from x/create/verify.gorename to create/verify.goindex 30e870b8b..3a55dd435 100644--- a/x/create/verify.go+++ b/create/verify.go@@ -5,7 +5,7 @@ import ("fmt""log/slog"- "github.com/ollama/ollama/x/mlxrunner"+ "github.com/ollama/ollama/mlxrunner")var ErrUnsupportedMLXArchitecture = errors.New("unsupported MLX architecture")diff --git a/x/create/verify_test.go b/create/verify_test.gosimilarity index 100%rename from x/create/verify_test.gorename to create/verify_test.godiff --git a/x/create/writer.go b/create/writer.gosimilarity index 99%rename from x/create/writer.gorename to create/writer.goindex 5e483ae8d..ae4e4a570 100644--- a/x/create/writer.go+++ b/create/writer.go@@ -7,8 +7,8 @@ import ("io""path/filepath"+ "github.com/ollama/ollama/fs/safetensors""github.com/ollama/ollama/manifest"- "github.com/ollama/ollama/x/safetensors")// BlobStore stores a finished blob and returns its layer info. The writerdiff --git a/x/create/writer_test.go b/create/writer_test.gosimilarity index 99%rename from x/create/writer_test.gorename to create/writer_test.goindex 79d1764d6..5b82b7ab9 100644--- a/x/create/writer_test.go+++ b/create/writer_test.go@@ -11,8 +11,8 @@ import ("sort""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- st "github.com/ollama/ollama/x/safetensors"+ st "github.com/ollama/ollama/fs/safetensors"+ "github.com/ollama/ollama/mlx/mlxtest")type captureStore struct{ blobs map[string][]byte }diff --git a/x/safetensors/extractor.go b/fs/safetensors/extractor.gosimilarity index 100%rename from x/safetensors/extractor.gorename to fs/safetensors/extractor.godiff --git a/x/safetensors/extractor_test.go b/fs/safetensors/extractor_test.gosimilarity index 100%rename from x/safetensors/extractor_test.gorename to fs/safetensors/extractor_test.godiff --git a/integration/utils_test.go b/integration/utils_test.goindex 7ac356f22..0d7a4973e 100644--- a/integration/utils_test.go+++ b/integration/utils_test.go@@ -609,7 +609,7 @@ func preloadGenerateModel(ctx context.Context, t *testing.T, client *api.Client,// through and fail the test — we never want to mask a real Mac regression.//// The fingerprints are the exact wrapper strings produced by the MLX code-// paths (see x/mlxrunner/server.go, x/mlxrunner/mlx/dynamic.go). Model-level errors+// paths (see mlxrunner/server.go, mlx/dynamic.go). Model-level errors// (unsupported architecture, tensor mismatches, runtime failures) do not// contain these strings, so this helper will not mask them.func skipIfMLXUnsupported(t *testing.T, err error) {diff --git a/llama/README.md b/llama/README.mdindex bd2e6e209..21ed7dae3 100644--- a/llama/README.md+++ b/llama/README.md@@ -55,8 +55,8 @@ For build prerequisites, platform notes, and backend selection, see themarker, or response cadence on paths Ollama parses directly.- Model and conversion surfaces: new architectures, tensor names, GGUFmetadata, tokenizer behavior, speculative/MTP paths, sampler defaults, and- server capabilities that may require updates under `convert/`, `model/`,- `x/create/`, `llm/`, or `llama/compat/`. A model load alone is not enough;+ server capabilities that may require updates under `model/`,+ `create/`, `llm/`, or `llama/compat/`. A model load alone is not enough;affected paths should run a real request and assert the expected result.### Compatibility patchesdiff --git a/x/mlxrunner/mlx/.gitignore b/mlx/.gitignoresimilarity index 100%rename from x/mlxrunner/mlx/.gitignorerename to mlx/.gitignorediff --git a/x/mlxrunner/mlx/CMakeLists.txt b/mlx/CMakeLists.txtsimilarity index 96%rename from x/mlxrunner/mlx/CMakeLists.txtrename to mlx/CMakeLists.txtindex 5e52498bd..919a693de 100644--- a/x/mlxrunner/mlx/CMakeLists.txt+++ b/mlx/CMakeLists.txt@@ -20,7 +20,7 @@ endif()include(FetchContent)# Read MLX-C version from top-level file.-file(READ "${CMAKE_CURRENT_LIST_DIR}/../../../MLX_C_VERSION" MLX_C_GIT_TAG)+file(READ "${CMAKE_CURRENT_LIST_DIR}/../MLX_C_VERSION" MLX_C_GIT_TAG)string(STRIP "${MLX_C_GIT_TAG}" MLX_C_GIT_TAG)FetchContent_Declare(diff --git a/x/mlxrunner/mlx/act.go b/mlx/act.gosimilarity index 100%rename from x/mlxrunner/mlx/act.gorename to mlx/act.godiff --git a/x/mlxrunner/mlx/act_test.go b/mlx/act_test.gosimilarity index 97%rename from x/mlxrunner/mlx/act_test.gorename to mlx/act_test.goindex c2c8ff5dc..68539496c 100644--- a/x/mlxrunner/mlx/act_test.go+++ b/mlx/act_test.go@@ -4,7 +4,7 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestGELUCompiledMatchesEager(t *testing.T) {diff --git a/x/mlxrunner/mlx/array.go b/mlx/array.gosimilarity index 100%rename from x/mlxrunner/mlx/array.gorename to mlx/array.godiff --git a/x/mlxrunner/mlx/array_test.go b/mlx/array_test.gosimilarity index 98%rename from x/mlxrunner/mlx/array_test.gorename to mlx/array_test.goindex 4387fa27d..06870e6df 100644--- a/x/mlxrunner/mlx/array_test.go+++ b/mlx/array_test.go@@ -3,7 +3,7 @@ package mlximport ("testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestFromValue(t *testing.T) {diff --git a/mlx/compat/0001-mlx-c-qmm-global-scale.patch b/mlx/compat/mlx-c/0001-mlx-c-qmm-global-scale.patchsimilarity index 100%rename from mlx/compat/0001-mlx-c-qmm-global-scale.patchrename to mlx/compat/mlx-c/0001-mlx-c-qmm-global-scale.patchdiff --git a/x/mlxrunner/mlx/compile.go b/mlx/compile.gosimilarity index 100%rename from x/mlxrunner/mlx/compile.gorename to mlx/compile.godiff --git a/x/mlxrunner/mlx/compile_test.go b/mlx/compile_test.gosimilarity index 98%rename from x/mlxrunner/mlx/compile_test.gorename to mlx/compile_test.goindex 956b7a7c6..34501ca16 100644--- a/x/mlxrunner/mlx/compile_test.go+++ b/mlx/compile_test.go@@ -3,7 +3,7 @@ package mlximport ("testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestCompileFusion(t *testing.T) {diff --git a/x/mlxrunner/mlx/depthwise_conv.go b/mlx/depthwise_conv.gosimilarity index 100%rename from x/mlxrunner/mlx/depthwise_conv.gorename to mlx/depthwise_conv.godiff --git a/x/mlxrunner/mlx/depthwise_conv_test.go b/mlx/depthwise_conv_test.gosimilarity index 95%rename from x/mlxrunner/mlx/depthwise_conv_test.gorename to mlx/depthwise_conv_test.goindex 57c74c50f..3cc2c3bd6 100644--- a/x/mlxrunner/mlx/depthwise_conv_test.go+++ b/mlx/depthwise_conv_test.go@@ -4,7 +4,7 @@ import ("fmt""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestDepthwiseConvSiLUMatchesGraph(t *testing.T) {diff --git a/x/mlxrunner/mlx/dtype.go b/mlx/dtype.gosimilarity index 100%rename from x/mlxrunner/mlx/dtype.gorename to mlx/dtype.godiff --git a/x/mlxrunner/mlx/dynamic.c b/mlx/dynamic.csimilarity index 100%rename from x/mlxrunner/mlx/dynamic.crename to mlx/dynamic.cdiff --git a/x/mlxrunner/mlx/dynamic.go b/mlx/dynamic.gosimilarity index 100%rename from x/mlxrunner/mlx/dynamic.gorename to mlx/dynamic.godiff --git a/x/mlxrunner/mlx/dynamic.h b/mlx/dynamic.hsimilarity index 100%rename from x/mlxrunner/mlx/dynamic.hrename to mlx/dynamic.hdiff --git a/x/mlxrunner/mlx/dynamic_darwin.go b/mlx/dynamic_darwin.gosimilarity index 100%rename from x/mlxrunner/mlx/dynamic_darwin.gorename to mlx/dynamic_darwin.godiff --git a/x/mlxrunner/mlx/dynamic_other.go b/mlx/dynamic_other.gosimilarity index 100%rename from x/mlxrunner/mlx/dynamic_other.gorename to mlx/dynamic_other.godiff --git a/x/mlxrunner/mlx/fast.go b/mlx/fast.gosimilarity index 100%rename from x/mlxrunner/mlx/fast.gorename to mlx/fast.godiff --git a/x/mlxrunner/mlx/gated_delta.go b/mlx/gated_delta.gosimilarity index 100%rename from x/mlxrunner/mlx/gated_delta.gorename to mlx/gated_delta.godiff --git a/x/mlxrunner/mlx/gated_delta_test.go b/mlx/gated_delta_test.gosimilarity index 99%rename from x/mlxrunner/mlx/gated_delta_test.gorename to mlx/gated_delta_test.goindex 81a2034a6..dc3758d8d 100644--- a/x/mlxrunner/mlx/gated_delta_test.go+++ b/mlx/gated_delta_test.go@@ -5,7 +5,7 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")type gatedDeltaTestGeometry struct {diff --git a/x/mlxrunner/mlx/generated.c b/mlx/generated.csimilarity index 100%rename from x/mlxrunner/mlx/generated.crename to mlx/generated.cdiff --git a/x/mlxrunner/mlx/generated.h b/mlx/generated.hsimilarity index 100%rename from x/mlxrunner/mlx/generated.hrename to mlx/generated.hdiff --git a/x/mlxrunner/mlx/generator/generated.c.gotmpl b/mlx/generator/generated.c.gotmplsimilarity index 100%rename from x/mlxrunner/mlx/generator/generated.c.gotmplrename to mlx/generator/generated.c.gotmpldiff --git a/x/mlxrunner/mlx/generator/generated.h.gotmpl b/mlx/generator/generated.h.gotmplsimilarity index 100%rename from x/mlxrunner/mlx/generator/generated.h.gotmplrename to mlx/generator/generated.h.gotmpldiff --git a/x/mlxrunner/mlx/generator/main.go b/mlx/generator/main.gosimilarity index 100%rename from x/mlxrunner/mlx/generator/main.gorename to mlx/generator/main.godiff --git a/x/mlxrunner/mlx/gpu_kernel.go b/mlx/gpu_kernel.gosimilarity index 100%rename from x/mlxrunner/mlx/gpu_kernel.gorename to mlx/gpu_kernel.godiff --git a/x/mlxrunner/mlx/include/mlx/c/README.md b/mlx/include/mlx/c/README.mdsimilarity index 65%rename from x/mlxrunner/mlx/include/mlx/c/README.mdrename to mlx/include/mlx/c/README.mdindex 1d693359d..6b42f9729 100644--- a/x/mlxrunner/mlx/include/mlx/c/README.md+++ b/mlx/include/mlx/c/README.md@@ -9,4 +9,4 @@ Headers are automatically refreshed when you run a CMake build:cmake --preset 'MLX CUDA 13'```-See the [MLX Engine](../../../../../../../docs/development.md#mlx-engine-optional) section of the development docs for full build instructions.+See the [MLX Engine](../../../../docs/development.md#mlx-engine-optional) section of the development docs for full build instructions.diff --git a/x/mlxrunner/mlx/include/mlx/c/array.h b/mlx/include/mlx/c/array.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/array.hrename to mlx/include/mlx/c/array.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/closure.h b/mlx/include/mlx/c/closure.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/closure.hrename to mlx/include/mlx/c/closure.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/compile.h b/mlx/include/mlx/c/compile.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/compile.hrename to mlx/include/mlx/c/compile.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/cuda.h b/mlx/include/mlx/c/cuda.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/cuda.hrename to mlx/include/mlx/c/cuda.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/device.h b/mlx/include/mlx/c/device.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/device.hrename to mlx/include/mlx/c/device.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/distributed.h b/mlx/include/mlx/c/distributed.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/distributed.hrename to mlx/include/mlx/c/distributed.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/distributed_group.h b/mlx/include/mlx/c/distributed_group.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/distributed_group.hrename to mlx/include/mlx/c/distributed_group.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/error.h b/mlx/include/mlx/c/error.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/error.hrename to mlx/include/mlx/c/error.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/export.h b/mlx/include/mlx/c/export.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/export.hrename to mlx/include/mlx/c/export.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/fast.h b/mlx/include/mlx/c/fast.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/fast.hrename to mlx/include/mlx/c/fast.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/fft.h b/mlx/include/mlx/c/fft.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/fft.hrename to mlx/include/mlx/c/fft.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/graph_utils.h b/mlx/include/mlx/c/graph_utils.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/graph_utils.hrename to mlx/include/mlx/c/graph_utils.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/half.h b/mlx/include/mlx/c/half.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/half.hrename to mlx/include/mlx/c/half.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/io.h b/mlx/include/mlx/c/io.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/io.hrename to mlx/include/mlx/c/io.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/io_types.h b/mlx/include/mlx/c/io_types.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/io_types.hrename to mlx/include/mlx/c/io_types.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/linalg.h b/mlx/include/mlx/c/linalg.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/linalg.hrename to mlx/include/mlx/c/linalg.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/map.h b/mlx/include/mlx/c/map.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/map.hrename to mlx/include/mlx/c/map.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/memory.h b/mlx/include/mlx/c/memory.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/memory.hrename to mlx/include/mlx/c/memory.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/metal.h b/mlx/include/mlx/c/metal.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/metal.hrename to mlx/include/mlx/c/metal.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/mlx.h b/mlx/include/mlx/c/mlx.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/mlx.hrename to mlx/include/mlx/c/mlx.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/ops.h b/mlx/include/mlx/c/ops.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/ops.hrename to mlx/include/mlx/c/ops.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/optional.h b/mlx/include/mlx/c/optional.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/optional.hrename to mlx/include/mlx/c/optional.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/random.h b/mlx/include/mlx/c/random.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/random.hrename to mlx/include/mlx/c/random.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/stream.h b/mlx/include/mlx/c/stream.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/stream.hrename to mlx/include/mlx/c/stream.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/string.h b/mlx/include/mlx/c/string.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/string.hrename to mlx/include/mlx/c/string.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/transforms.h b/mlx/include/mlx/c/transforms.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/transforms.hrename to mlx/include/mlx/c/transforms.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/transforms_impl.h b/mlx/include/mlx/c/transforms_impl.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/transforms_impl.hrename to mlx/include/mlx/c/transforms_impl.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/vector.h b/mlx/include/mlx/c/vector.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/vector.hrename to mlx/include/mlx/c/vector.hdiff --git a/x/mlxrunner/mlx/include/mlx/c/version.h b/mlx/include/mlx/c/version.hsimilarity index 100%rename from x/mlxrunner/mlx/include/mlx/c/version.hrename to mlx/include/mlx/c/version.hdiff --git a/x/mlxrunner/mlx/io.go b/mlx/io.gosimilarity index 100%rename from x/mlxrunner/mlx/io.gorename to mlx/io.godiff --git a/x/mlxrunner/mlx/io_test.go b/mlx/io_test.gosimilarity index 96%rename from x/mlxrunner/mlx/io_test.gorename to mlx/io_test.goindex 9a90046c2..c273efb43 100644--- a/x/mlxrunner/mlx/io_test.go+++ b/mlx/io_test.go@@ -7,7 +7,7 @@ import ("path/filepath""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestSaveSafetensorsWithMetadataDeterministic(t *testing.T) {diff --git a/x/mlxrunner/mlx/kernel_test.go b/mlx/kernel_test.gosimilarity index 100%rename from x/mlxrunner/mlx/kernel_test.gorename to mlx/kernel_test.godiff --git a/x/mlxrunner/mlx/mamba2_scan.go b/mlx/mamba2_scan.gosimilarity index 100%rename from x/mlxrunner/mlx/mamba2_scan.gorename to mlx/mamba2_scan.godiff --git a/x/mlxrunner/mlx/mamba_kernels_test.go b/mlx/mamba_kernels_test.gosimilarity index 99%rename from x/mlxrunner/mlx/mamba_kernels_test.gorename to mlx/mamba_kernels_test.goindex 67518f4af..724bdfce1 100644--- a/x/mlxrunner/mlx/mamba_kernels_test.go+++ b/mlx/mamba_kernels_test.go@@ -5,7 +5,7 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestMamba2ScanMatchesReference(t *testing.T) {diff --git a/x/mlxrunner/mlx/memory.go b/mlx/memory.gosimilarity index 100%rename from x/mlxrunner/mlx/memory.gorename to mlx/memory.godiff --git a/x/mlxrunner/mlx/memory_test.go b/mlx/memory_test.gosimilarity index 96%rename from x/mlxrunner/mlx/memory_test.gorename to mlx/memory_test.goindex 5e54c39cc..3367f0745 100644--- a/x/mlxrunner/mlx/memory_test.go+++ b/mlx/memory_test.go@@ -7,7 +7,7 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")func TestSetWiredLimitRejectsOversizeWithoutChangingLimit(t *testing.T) {diff --git a/x/mlxrunner/mlx/mlx.go b/mlx/mlx.gosimilarity index 99%rename from x/mlxrunner/mlx/mlx.gorename to mlx/mlx.goindex 141ba9cc2..8f66f3e7e 100644--- a/x/mlxrunner/mlx/mlx.go+++ b/mlx/mlx.go@@ -2,7 +2,7 @@//// MLX keeps stream and backend state in thread-locals, so all calls into this// package must come from a single goroutine locked to its OS thread (see-// x/internal/mlxthread).+// mlx/mlxthread).package mlx//go:generate go run generator/main.go -output=. ./include/mlx/c/*.hdiff --git a/x/internal/mlxtest/mlxtest.go b/mlx/mlxtest/mlxtest.gosimilarity index 89%rename from x/internal/mlxtest/mlxtest.gorename to mlx/mlxtest/mlxtest.goindex d19fa1892..506125614 100644--- a/x/internal/mlxtest/mlxtest.go+++ b/mlx/mlxtest/mlxtest.go@@ -1,13 +1,13 @@// Package mlxtest provides shared scaffolding for tests that exercise MLX-// through the cgo wrapper in x/mlxrunner/mlx.+// through the cgo wrapper in mlx.package mlxtestimport ("sync""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")var testThread = sync.OnceValues(func() (*mlxthreadtest.Thread, error) {diff --git a/x/internal/mlxthreadtest/mlxthreadtest.go b/mlx/mlxthread/mlxthreadtest/mlxthreadtest.gosimilarity index 98%rename from x/internal/mlxthreadtest/mlxthreadtest.gorename to mlx/mlxthread/mlxthreadtest/mlxthreadtest.goindex 5e43ea384..2ee75d512 100644--- a/x/internal/mlxthreadtest/mlxthreadtest.go+++ b/mlx/mlxthread/mlxthreadtest/mlxthreadtest.go@@ -5,7 +5,7 @@ import ("context""testing"- "github.com/ollama/ollama/x/internal/mlxthread"+ "github.com/ollama/ollama/mlx/mlxthread")// Thread is a pinned worker used by MLX tests.diff --git a/x/internal/mlxthreadtest/mlxthreadtest_test.go b/mlx/mlxthread/mlxthreadtest/mlxthreadtest_test.gosimilarity index 100%rename from x/internal/mlxthreadtest/mlxthreadtest_test.gorename to mlx/mlxthread/mlxthreadtest/mlxthreadtest_test.godiff --git a/x/internal/mlxthreadtest/threadid_darwin.go b/mlx/mlxthread/mlxthreadtest/threadid_darwin.gosimilarity index 100%rename from x/internal/mlxthreadtest/threadid_darwin.gorename to mlx/mlxthread/mlxthreadtest/threadid_darwin.godiff --git a/x/internal/mlxthreadtest/threadid_linux.go b/mlx/mlxthread/mlxthreadtest/threadid_linux.gosimilarity index 100%rename from x/internal/mlxthreadtest/threadid_linux.gorename to mlx/mlxthread/mlxthreadtest/threadid_linux.godiff --git a/x/internal/mlxthreadtest/threadid_other.go b/mlx/mlxthread/mlxthreadtest/threadid_other.gosimilarity index 100%rename from x/internal/mlxthreadtest/threadid_other.gorename to mlx/mlxthread/mlxthreadtest/threadid_other.godiff --git a/x/internal/mlxthreadtest/threadid_windows.go b/mlx/mlxthread/mlxthreadtest/threadid_windows.gosimilarity index 100%rename from x/internal/mlxthreadtest/threadid_windows.gorename to mlx/mlxthread/mlxthreadtest/threadid_windows.godiff --git a/x/internal/mlxthread/thread.go b/mlx/mlxthread/thread.gosimilarity index 100%rename from x/internal/mlxthread/thread.gorename to mlx/mlxthread/thread.godiff --git a/x/internal/mlxthread/thread_affinity_test.go b/mlx/mlxthread/thread_affinity_test.gosimilarity index 100%rename from x/internal/mlxthread/thread_affinity_test.gorename to mlx/mlxthread/thread_affinity_test.godiff --git a/x/internal/mlxthread/thread_test.go b/mlx/mlxthread/thread_test.gosimilarity index 100%rename from x/internal/mlxthread/thread_test.gorename to mlx/mlxthread/thread_test.godiff --git a/x/internal/mlxthread/threadid_darwin_test.go b/mlx/mlxthread/threadid_darwin_test.gosimilarity index 100%rename from x/internal/mlxthread/threadid_darwin_test.gorename to mlx/mlxthread/threadid_darwin_test.godiff --git a/x/internal/mlxthread/threadid_linux_test.go b/mlx/mlxthread/threadid_linux_test.gosimilarity index 100%rename from x/internal/mlxthread/threadid_linux_test.gorename to mlx/mlxthread/threadid_linux_test.godiff --git a/x/mlxrunner/mlx/nn.go b/mlx/nn.gosimilarity index 100%rename from x/mlxrunner/mlx/nn.gorename to mlx/nn.godiff --git a/x/mlxrunner/mlx/ops.go b/mlx/ops.gosimilarity index 100%rename from x/mlxrunner/mlx/ops.gorename to mlx/ops.godiff --git a/x/mlxrunner/mlx/ops_extra.go b/mlx/ops_extra.gosimilarity index 100%rename from x/mlxrunner/mlx/ops_extra.gorename to mlx/ops_extra.godiff --git a/x/mlxrunner/mlx/ops_extra_test.go b/mlx/ops_extra_test.gosimilarity index 99%rename from x/mlxrunner/mlx/ops_extra_test.gorename to mlx/ops_extra_test.goindex fe06562ac..12be6fbb5 100644--- a/x/mlxrunner/mlx/ops_extra_test.go+++ b/mlx/ops_extra_test.go@@ -4,7 +4,7 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")// mlxForm converts checkpoint multipliers to MLX's global-scalediff --git a/x/quant/quant.go b/mlx/quant/quant.gosimilarity index 100%rename from x/quant/quant.gorename to mlx/quant/quant.godiff --git a/x/quant/quant_test.go b/mlx/quant/quant_test.gosimilarity index 100%rename from x/quant/quant_test.gorename to mlx/quant/quant_test.godiff --git a/x/mlxrunner/mlx/random.go b/mlx/random.gosimilarity index 100%rename from x/mlxrunner/mlx/random.gorename to mlx/random.godiff --git a/x/mlxrunner/mlx/scope.go b/mlx/scope.gosimilarity index 100%rename from x/mlxrunner/mlx/scope.gorename to mlx/scope.godiff --git a/x/mlxrunner/mlx/scope_test.go b/mlx/scope_test.gosimilarity index 98%rename from x/mlxrunner/mlx/scope_test.gorename to mlx/scope_test.goindex 641e6ddc7..efb21c767 100644--- a/x/mlxrunner/mlx/scope_test.go+++ b/mlx/scope_test.go@@ -3,7 +3,7 @@ package mlximport ("testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")// A function scope frees what was created in it. What fn returns moves to thediff --git a/x/mlxrunner/mlx/slice.go b/mlx/slice.gosimilarity index 100%rename from x/mlxrunner/mlx/slice.gorename to mlx/slice.godiff --git a/x/mlxrunner/mlx/stream.go b/mlx/stream.gosimilarity index 100%rename from x/mlxrunner/mlx/stream.gorename to mlx/stream.godiff --git a/x/mlxrunner/mlx/thread_test.go b/mlx/thread_test.gosimilarity index 96%rename from x/mlxrunner/mlx/thread_test.gorename to mlx/thread_test.goindex 0cebb04a9..7fcc29677 100644--- a/x/mlxrunner/mlx/thread_test.go+++ b/mlx/thread_test.go@@ -6,7 +6,7 @@ import ("sync""testing"- "github.com/ollama/ollama/x/internal/mlxthreadtest"+ "github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest")var testThread = sync.OnceValues(func() (*mlxthreadtest.Thread, error) {diff --git a/x/mlxrunner/batch/batch.go b/mlxrunner/batch/batch.gosimilarity index 97%rename from x/mlxrunner/batch/batch.gorename to mlxrunner/batch/batch.goindex 509ec41f6..a96153ef7 100644--- a/x/mlxrunner/batch/batch.go+++ b/mlxrunner/batch/batch.go@@ -1,6 +1,6 @@package batch-import "github.com/ollama/ollama/x/mlxrunner/mlx"+import "github.com/ollama/ollama/mlx"// Batch is the per-forward-pass input handed to a model.type Batch struct {diff --git a/x/mlxrunner/cache/cache.go b/mlxrunner/cache/cache.gosimilarity index 99%rename from x/mlxrunner/cache/cache.gorename to mlxrunner/cache/cache.goindex be404a92f..c75c63ade 100644--- a/x/mlxrunner/cache/cache.go+++ b/mlxrunner/cache/cache.go@@ -3,7 +3,7 @@ package cacheimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx")// Cache is common state management shared by every cache kind. Writersdiff --git a/x/mlxrunner/cache/cache_test.go b/mlxrunner/cache/cache_test.gosimilarity index 98%rename from x/mlxrunner/cache/cache_test.gorename to mlxrunner/cache/cache_test.goindex 408aa7da6..a3846460a 100644--- a/x/mlxrunner/cache/cache_test.go+++ b/mlxrunner/cache/cache_test.go@@ -3,9 +3,9 @@ package cacheimport ("testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch")// newKVBatch builds a B=1 batch at SeqOffsets=off with all-realdiff --git a/x/mlxrunner/cache/kvcache.go b/mlxrunner/cache/kvcache.gosimilarity index 98%rename from x/mlxrunner/cache/kvcache.gorename to mlxrunner/cache/kvcache.goindex 68afac07c..78a47f7e0 100644--- a/x/mlxrunner/cache/kvcache.go+++ b/mlxrunner/cache/kvcache.go@@ -3,9 +3,9 @@ package cacheimport ("slices"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// Attention is the contract for caches that back attention layersdiff --git a/x/mlxrunner/cache/lazy_test.go b/mlxrunner/cache/lazy_test.gosimilarity index 99%rename from x/mlxrunner/cache/lazy_test.gorename to mlxrunner/cache/lazy_test.goindex 01232a610..309093f02 100644--- a/x/mlxrunner/cache/lazy_test.go+++ b/mlxrunner/cache/lazy_test.go@@ -3,8 +3,8 @@ package cacheimport ("testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// distinctKV builds a [1, H, L, D] keys/values pair whose values encode thediff --git a/x/mlxrunner/cache/recurrent.go b/mlxrunner/cache/recurrent.gosimilarity index 98%rename from x/mlxrunner/cache/recurrent.gorename to mlxrunner/cache/recurrent.goindex 80c45daad..ea8ee3980 100644--- a/x/mlxrunner/cache/recurrent.go+++ b/mlxrunner/cache/recurrent.go@@ -3,9 +3,9 @@ package cacheimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// RecurrentCache stores state for linear-recurrent layers.diff --git a/x/mlxrunner/cache/recurrent_test.go b/mlxrunner/cache/recurrent_test.gosimilarity index 97%rename from x/mlxrunner/cache/recurrent_test.gorename to mlxrunner/cache/recurrent_test.goindex 4a4624d51..56b6d775a 100644--- a/x/mlxrunner/cache/recurrent_test.go+++ b/mlxrunner/cache/recurrent_test.go@@ -4,10 +4,10 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// TestRecurrentCacheRestoreExactOffset verifies that RecurrentCache restorediff --git a/x/mlxrunner/cache/rotating.go b/mlxrunner/cache/rotating.gosimilarity index 99%rename from x/mlxrunner/cache/rotating.gorename to mlxrunner/cache/rotating.goindex 8aa3f9c2d..d862dc0fc 100644--- a/x/mlxrunner/cache/rotating.go+++ b/mlxrunner/cache/rotating.go@@ -5,9 +5,9 @@ import ("slices""github.com/ollama/ollama/logutil"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// RotatingKVCache implements sliding window attention with bounded memory.diff --git a/x/mlxrunner/cache/rotating_attention_test.go b/mlxrunner/cache/rotating_attention_test.gosimilarity index 98%rename from x/mlxrunner/cache/rotating_attention_test.gorename to mlxrunner/cache/rotating_attention_test.goindex 6d2d6d318..769268842 100644--- a/x/mlxrunner/cache/rotating_attention_test.go+++ b/mlxrunner/cache/rotating_attention_test.go@@ -4,10 +4,10 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// TestRotatingKVCacheDecodeParity drives a rotating cache past itsdiff --git a/x/mlxrunner/cache/rotating_multiturn_test.go b/mlxrunner/cache/rotating_multiturn_test.gosimilarity index 97%rename from x/mlxrunner/cache/rotating_multiturn_test.gorename to mlxrunner/cache/rotating_multiturn_test.goindex 2b6ce30c0..99f6fbc1f 100644--- a/x/mlxrunner/cache/rotating_multiturn_test.go+++ b/mlxrunner/cache/rotating_multiturn_test.go@@ -3,8 +3,8 @@ package cacheimport ("testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// singleTokenKV and multiTokenKV fabricate [B=1, H=1, L, D=2] key/value@@ -107,7 +107,7 @@ func TestRotatingKVCacheConcatMidRotationPreservesContext(t *testing.T) {// TestRotatingKVCacheConcatAlignedInvariant: with an aligned buffer// (c.idx == Dim), an L>1 concat keeps the last (maxSize-1) pre-existing// tokens plus the full new batch. This is the chunked-prefill contract-// x/mlxrunner/pipeline.go relies on.+// mlxrunner/pipeline.go relies on.func TestRotatingKVCacheConcatAlignedInvariant(t *testing.T) {mlxtest.Run(t, func(t *mlxtest.T) {const window = 4@@ -165,7 +165,7 @@ func TestRotatingKVCacheConcatAfterDecodeGrowsBuffer(t *testing.T) {})}-// TestRotatingKVCacheConcatAfterLiveRewind: x/mlxrunner/cache.go calls+// TestRotatingKVCacheConcatAfterLiveRewind: mlxrunner/cache.go calls// Restore(nil, target) between conversation turns to rewind the cache to// the matched prefix. Restore moves c.offset/c.idx without trimming the// underlying buffer, so slots [c.idx, Dim) still hold stale pre-rewind@@ -222,7 +222,7 @@ func TestRotatingKVCacheConcatGrowingBuffer(t *testing.T) {}// TestRotatingKVCacheRunnerChunkedPrefill mirrors the-// x/mlxrunner/pipeline.go prefill loop: a long prompt fed through+// mlxrunner/pipeline.go prefill loop: a long prompt fed through// repeated L>1 Update() calls on a single cache. Scaled-down proxy for// the Gemma 4 26B case (sliding_window=1024, prefillChunkSize=2048).func TestRotatingKVCacheRunnerChunkedPrefill(t *testing.T) {diff --git a/x/mlxrunner/cache/snapshot_capture_test.go b/mlxrunner/cache/snapshot_capture_test.gosimilarity index 99%rename from x/mlxrunner/cache/snapshot_capture_test.gorename to mlxrunner/cache/snapshot_capture_test.goindex eb81df1a3..b972d90c6 100644--- a/x/mlxrunner/cache/snapshot_capture_test.go+++ b/mlxrunner/cache/snapshot_capture_test.go@@ -4,8 +4,8 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// fillKV writes n single-token steps into c, one Update per token, so thediff --git a/x/mlxrunner/cache_trie.go b/mlxrunner/cache_trie.gosimilarity index 99%rename from x/mlxrunner/cache_trie.gorename to mlxrunner/cache_trie.goindex 535a0a2cd..cb187733d 100644--- a/x/mlxrunner/cache_trie.go+++ b/mlxrunner/cache_trie.go@@ -5,7 +5,7 @@ import ("slices""time"- "github.com/ollama/ollama/x/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/cache")// trieKey encodes a token for trie matching (see prefixCache.key).diff --git a/x/mlxrunner/cache_trie_test.go b/mlxrunner/cache_trie_test.gosimilarity index 99%rename from x/mlxrunner/cache_trie_test.gorename to mlxrunner/cache_trie_test.goindex 2232af41e..7f30a26cf 100644--- a/x/mlxrunner/cache_trie_test.go+++ b/mlxrunner/cache_trie_test.go@@ -5,7 +5,7 @@ import ("testing""time"- "github.com/ollama/ollama/x/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/cache")func newTestTrie(tokens []trieKey) *trieNode {diff --git a/x/mlxrunner/client.go b/mlxrunner/client.gosimilarity index 99%rename from x/mlxrunner/client.gorename to mlxrunner/client.goindex 081c2708b..9787a01cc 100644--- a/x/mlxrunner/client.go+++ b/mlxrunner/client.go@@ -26,8 +26,8 @@ import ("github.com/ollama/ollama/format""github.com/ollama/ollama/llm""github.com/ollama/ollama/ml"+ "github.com/ollama/ollama/mlx""github.com/ollama/ollama/x/imagegen/manifest"- "github.com/ollama/ollama/x/mlxrunner/mlx")// Client wraps an MLX runner subprocess to implement llm.LlamaServer for LLM models.diff --git a/x/mlxrunner/client_test.go b/mlxrunner/client_test.gosimilarity index 100%rename from x/mlxrunner/client_test.gorename to mlxrunner/client_test.godiff --git a/x/mlxrunner/dflash.go b/mlxrunner/dflash.gosimilarity index 97%rename from x/mlxrunner/dflash.gorename to mlxrunner/dflash.goindex 628c0bf43..b4b383e44 100644--- a/x/mlxrunner/dflash.go+++ b/mlxrunner/dflash.go@@ -3,9 +3,9 @@ package mlxrunnerimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model/base")// dflashPendingFlushTokens bounds the held feature rows between flushes.diff --git a/x/mlxrunner/dflash_test.go b/mlxrunner/dflash_test.gosimilarity index 97%rename from x/mlxrunner/dflash_test.gorename to mlxrunner/dflash_test.goindex 3f4a89f1c..bdcc4e090 100644--- a/x/mlxrunner/dflash_test.go+++ b/mlxrunner/dflash_test.go@@ -6,12 +6,12 @@ import ("testing""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base"+ sampler "github.com/ollama/ollama/mlxrunner/sample")// fakeBlockDraft is a block-diffusion draft: one Draft call ingests contextdiff --git a/x/mlxrunner/grammar.go b/mlxrunner/grammar.gosimilarity index 98%rename from x/mlxrunner/grammar.gorename to mlxrunner/grammar.goindex e4c49f901..8e45ddc56 100644--- a/x/mlxrunner/grammar.go+++ b/mlxrunner/grammar.go@@ -16,9 +16,9 @@ import ("unicode/utf8""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/xgrammar"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/tokenizer"+ "github.com/ollama/ollama/mlxrunner/xgrammar")const (diff --git a/x/mlxrunner/grammar_mask_test.go b/mlxrunner/grammar_mask_test.gosimilarity index 98%rename from x/mlxrunner/grammar_mask_test.gorename to mlxrunner/grammar_mask_test.goindex 7541d8f25..dc77f8303 100644--- a/x/mlxrunner/grammar_mask_test.go+++ b/mlxrunner/grammar_mask_test.go@@ -8,9 +8,9 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/xgrammar"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/xgrammar")func TestApplyTokenMask(t *testing.T) {diff --git a/x/mlxrunner/grammar_test.go b/mlxrunner/grammar_test.gosimilarity index 98%rename from x/mlxrunner/grammar_test.gorename to mlxrunner/grammar_test.goindex b86de6bd4..1efdeb452 100644--- a/x/mlxrunner/grammar_test.go+++ b/mlxrunner/grammar_test.go@@ -13,11 +13,11 @@ import ("testing""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"- "github.com/ollama/ollama/x/mlxrunner/xgrammar"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ sampler "github.com/ollama/ollama/mlxrunner/sample"+ "github.com/ollama/ollama/mlxrunner/xgrammar")// schemaTag wraps a JSON Schema into the structural tag the MLX clientdiff --git a/x/mlxrunner/media.go b/mlxrunner/media.gosimilarity index 98%rename from x/mlxrunner/media.gorename to mlxrunner/media.goindex 03d0ff8cc..a48b3216a 100644--- a/x/mlxrunner/media.go+++ b/mlxrunner/media.go@@ -10,9 +10,9 @@ import ("strconv""github.com/ollama/ollama/llm"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model/base")var imgTagPattern = regexp.MustCompile(`\[img-(\d+)\]`)diff --git a/x/mlxrunner/media_test.go b/mlxrunner/media_test.gosimilarity index 97%rename from x/mlxrunner/media_test.gorename to mlxrunner/media_test.goindex ab150f8c5..f84023cb4 100644--- a/x/mlxrunner/media_test.go+++ b/mlxrunner/media_test.go@@ -4,9 +4,9 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/model/base")func TestEffectiveKeyTokens(t *testing.T) {diff --git a/mlxrunner/model/architectures/architectures.go b/mlxrunner/model/architectures/architectures.gonew file mode 100644index 000000000..168a5bb62--- /dev/null+++ b/mlxrunner/model/architectures/architectures.go@@ -0,0 +1,16 @@+package architectures++import (+ _ "github.com/ollama/ollama/mlxrunner/model/cohere2_moe"+ _ "github.com/ollama/ollama/mlxrunner/model/dflash"+ _ "github.com/ollama/ollama/mlxrunner/model/gemma4"+ _ "github.com/ollama/ollama/mlxrunner/model/glimmer"+ _ "github.com/ollama/ollama/mlxrunner/model/glm4_moe_lite"+ _ "github.com/ollama/ollama/mlxrunner/model/laguna"+ _ "github.com/ollama/ollama/mlxrunner/model/llama"+ _ "github.com/ollama/ollama/mlxrunner/model/nemotron_h"+ _ "github.com/ollama/ollama/mlxrunner/model/qwen3"+ _ "github.com/ollama/ollama/mlxrunner/model/qwen3_5"+ _ "github.com/ollama/ollama/mlxrunner/model/qwen3_5_moe"+ _ "github.com/ollama/ollama/mlxrunner/model/qwen4_exp"+)diff --git a/x/mlxrunner/model/audio/audio.go b/mlxrunner/model/audio/audio.gosimilarity index 100%rename from x/mlxrunner/model/audio/audio.gorename to mlxrunner/model/audio/audio.godiff --git a/x/mlxrunner/model/audio/audio_test.go b/mlxrunner/model/audio/audio_test.gosimilarity index 100%rename from x/mlxrunner/model/audio/audio_test.gorename to mlxrunner/model/audio/audio_test.godiff --git a/x/mlxrunner/model/base/base.go b/mlxrunner/model/base/base.gosimilarity index 96%rename from x/mlxrunner/model/base/base.gorename to mlxrunner/model/base/base.goindex f5aac8eac..468a46e02 100644--- a/x/mlxrunner/model/base/base.go+++ b/mlxrunner/model/base/base.go@@ -6,11 +6,11 @@ import ("log/slog""sync"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/tokenizer")// Model is the interface that model implementations must satisfy.diff --git a/x/mlxrunner/model/base/media.go b/mlxrunner/model/base/media.gosimilarity index 98%rename from x/mlxrunner/model/base/media.gorename to mlxrunner/model/base/media.goindex 513add66f..b14318504 100644--- a/x/mlxrunner/model/base/media.go+++ b/mlxrunner/model/base/media.go@@ -9,7 +9,7 @@ import (_ "golang.org/x/image/webp"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx")// Segment is one run of the prompt in stream order: either a tokenized textdiff --git a/x/models/cohere2_moe/cohere2_moe.go b/mlxrunner/model/cohere2_moe/cohere2_moe.gosimilarity index 98%rename from x/models/cohere2_moe/cohere2_moe.gorename to mlxrunner/model/cohere2_moe/cohere2_moe.goindex 884afb173..37fd67f07 100644--- a/x/models/cohere2_moe/cohere2_moe.go+++ b/mlxrunner/model/cohere2_moe/cohere2_moe.go@@ -19,13 +19,13 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/cohere2_moe/cohere2_moe_test.go b/mlxrunner/model/cohere2_moe/cohere2_moe_test.gosimilarity index 94%rename from x/models/cohere2_moe/cohere2_moe_test.gorename to mlxrunner/model/cohere2_moe/cohere2_moe_test.goindex 099d38c8d..9a7c6f459 100644--- a/x/models/cohere2_moe/cohere2_moe_test.go+++ b/mlxrunner/model/cohere2_moe/cohere2_moe_test.go@@ -4,8 +4,8 @@ import ("fmt""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")func TestLoadPerExpertGlobalScale(t *testing.T) {diff --git a/x/models/dflash/dflash.go b/mlxrunner/model/dflash/dflash.gosimilarity index 98%rename from x/models/dflash/dflash.gorename to mlxrunner/model/dflash/dflash.goindex e64ebe363..a3aa7ab54 100644--- a/x/models/dflash/dflash.go+++ b/mlxrunner/model/dflash/dflash.go@@ -8,12 +8,12 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn")func init() {diff --git a/x/mlxrunner/model/embedding.go b/mlxrunner/model/embedding.gosimilarity index 93%rename from x/mlxrunner/model/embedding.gorename to mlxrunner/model/embedding.goindex 021ef3044..1683b6056 100644--- a/x/mlxrunner/model/embedding.go+++ b/mlxrunner/model/embedding.go@@ -1,8 +1,8 @@package modelimport (- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/nn")// MakeEmbeddingLayer constructs an embedding layer from a tensor map.diff --git a/x/mlxrunner/model/embedding_test.go b/mlxrunner/model/embedding_test.gosimilarity index 96%rename from x/mlxrunner/model/embedding_test.gorename to mlxrunner/model/embedding_test.goindex 8ef08652f..3560a44a2 100644--- a/x/mlxrunner/model/embedding_test.go+++ b/mlxrunner/model/embedding_test.go@@ -3,9 +3,9 @@ package modelimport ("testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/nn")func TestMakeEmbeddingLayerDense(t *testing.T) {diff --git a/x/models/gemma4/assistant.go b/mlxrunner/model/gemma4/assistant.gosimilarity index 97%rename from x/models/gemma4/assistant.gorename to mlxrunner/model/gemma4/assistant.goindex 9d942c849..3ef69b46b 100644--- a/x/models/gemma4/assistant.go+++ b/mlxrunner/model/gemma4/assistant.go@@ -4,12 +4,12 @@ import ("encoding/json""fmt"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn")var _ base.DraftModel = (*AssistantModel)(nil)diff --git a/x/models/gemma4/audio.go b/mlxrunner/model/gemma4/audio.gosimilarity index 99%rename from x/models/gemma4/audio.gorename to mlxrunner/model/gemma4/audio.goindex 53a150dab..0c8d89561 100644--- a/x/models/gemma4/audio.go+++ b/mlxrunner/model/gemma4/audio.go@@ -4,9 +4,9 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/nn")type AudioConfig struct {diff --git a/x/models/gemma4/audio_test.go b/mlxrunner/model/gemma4/audio_test.gosimilarity index 97%rename from x/models/gemma4/audio_test.gorename to mlxrunner/model/gemma4/audio_test.goindex 0dacf30ff..80028f67f 100644--- a/x/models/gemma4/audio_test.go+++ b/mlxrunner/model/gemma4/audio_test.go@@ -4,10 +4,10 @@ import ("strings""testing"- "github.com/ollama/ollama/x/internal/mlxtest"+ "github.com/ollama/ollama/mlx/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/model/base")func newAudioTestModel() *Model {diff --git a/x/models/gemma4/gemma4.go b/mlxrunner/model/gemma4/gemma4.gosimilarity index 99%rename from x/models/gemma4/gemma4.gorename to mlxrunner/model/gemma4/gemma4.goindex badaaacb3..e61addc16 100644--- a/x/models/gemma4/gemma4.go+++ b/mlxrunner/model/gemma4/gemma4.go@@ -7,13 +7,13 @@ import ("math""strings"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/gemma4/gemma4_moe_test.go b/mlxrunner/model/gemma4/gemma4_moe_test.gosimilarity index 99%rename from x/models/gemma4/gemma4_moe_test.gorename to mlxrunner/model/gemma4/gemma4_moe_test.goindex 2f8371d5b..8bd6144da 100644--- a/x/models/gemma4/gemma4_moe_test.go+++ b/mlxrunner/model/gemma4/gemma4_moe_test.go@@ -4,8 +4,8 @@ import ("fmt""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// onesLike creates a tensor of the given shape filled with a small constant.diff --git a/x/models/gemma4/gemma4_test.go b/mlxrunner/model/gemma4/gemma4_test.gosimilarity index 99%rename from x/models/gemma4/gemma4_test.gorename to mlxrunner/model/gemma4/gemma4_test.goindex 385b5b6ea..f1f1dd0e4 100644--- a/x/models/gemma4/gemma4_test.go+++ b/mlxrunner/model/gemma4/gemma4_test.go@@ -5,8 +5,8 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")func TestParseSuppressTokens(t *testing.T) {diff --git a/x/models/gemma4/media.go b/mlxrunner/model/gemma4/media.gosimilarity index 97%rename from x/models/gemma4/media.gorename to mlxrunner/model/gemma4/media.goindex eb8f8c68a..40103101d 100644--- a/x/models/gemma4/media.go+++ b/mlxrunner/model/gemma4/media.go@@ -5,11 +5,11 @@ import ("fmt""log/slog"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn")// multimodalConfig carries the top-level config.json fields the text_configdiff --git a/x/models/gemma4/media_test.go b/mlxrunner/model/gemma4/media_test.gosimilarity index 97%rename from x/models/gemma4/media_test.gorename to mlxrunner/model/gemma4/media_test.goindex 31cabb1e9..2b41e5e1a 100644--- a/x/models/gemma4/media_test.go+++ b/mlxrunner/model/gemma4/media_test.go@@ -6,11 +6,11 @@ import ("image/png""testing"- "github.com/ollama/ollama/x/internal/mlxtest"+ "github.com/ollama/ollama/mlx/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model/base")func TestParseMultimodalConfig(t *testing.T) {diff --git a/x/models/gemma4/process_audio.go b/mlxrunner/model/gemma4/process_audio.gosimilarity index 99%rename from x/models/gemma4/process_audio.gorename to mlxrunner/model/gemma4/process_audio.goindex 62658ce25..225060fba 100644--- a/x/models/gemma4/process_audio.go+++ b/mlxrunner/model/gemma4/process_audio.go@@ -6,7 +6,7 @@ import ("math/cmplx""sync"- "github.com/ollama/ollama/x/mlxrunner/model/audio"+ "github.com/ollama/ollama/mlxrunner/model/audio")// Audio front-end constants from the reference Gemma4AudioFeatureExtractordiff --git a/x/models/gemma4/process_audio_test.go b/mlxrunner/model/gemma4/process_audio_test.gosimilarity index 100%rename from x/models/gemma4/process_audio_test.gorename to mlxrunner/model/gemma4/process_audio_test.godiff --git a/x/models/gemma4/process_image.go b/mlxrunner/model/gemma4/process_image.gosimilarity index 100%rename from x/models/gemma4/process_image.gorename to mlxrunner/model/gemma4/process_image.godiff --git a/x/models/gemma4/vision.go b/mlxrunner/model/gemma4/vision.gosimilarity index 99%rename from x/models/gemma4/vision.gorename to mlxrunner/model/gemma4/vision.goindex ed2f8a0bb..aee4400e5 100644--- a/x/models/gemma4/vision.go+++ b/mlxrunner/model/gemma4/vision.go@@ -6,9 +6,9 @@ import ("slices""strings"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/nn")// VisionConfig holds configuration for the Gemma 4 vision path: thediff --git a/x/models/gemma4/vision_test.go b/mlxrunner/model/gemma4/vision_test.gosimilarity index 98%rename from x/models/gemma4/vision_test.gorename to mlxrunner/model/gemma4/vision_test.goindex b999f32da..23bce1146 100644--- a/x/models/gemma4/vision_test.go+++ b/mlxrunner/model/gemma4/vision_test.go@@ -6,10 +6,10 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"+ "github.com/ollama/ollama/mlx/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/nn")func TestVisionTargetSize(t *testing.T) {diff --git a/x/models/glimmer/glimmer.go b/mlxrunner/model/glimmer/glimmer.gosimilarity index 98%rename from x/models/glimmer/glimmer.gorename to mlxrunner/model/glimmer/glimmer.goindex 5098b8811..557f304fc 100644--- a/x/models/glimmer/glimmer.go+++ b/mlxrunner/model/glimmer/glimmer.go@@ -7,13 +7,13 @@ import ("math""slices"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/glimmer/glimmer_test.go b/mlxrunner/model/glimmer/glimmer_test.gosimilarity index 97%rename from x/models/glimmer/glimmer_test.gorename to mlxrunner/model/glimmer/glimmer_test.goindex 3827f006e..d1c35ee8f 100644--- a/x/models/glimmer/glimmer_test.go+++ b/mlxrunner/model/glimmer/glimmer_test.go@@ -8,11 +8,11 @@ import ("strings""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func testConfig() Config {diff --git a/x/models/glimmer/media.go b/mlxrunner/model/glimmer/media.gosimilarity index 97%rename from x/models/glimmer/media.gorename to mlxrunner/model/glimmer/media.goindex 97ea6f2d4..803c3d85d 100644--- a/x/models/glimmer/media.go+++ b/mlxrunner/model/glimmer/media.go@@ -11,9 +11,9 @@ import ("golang.org/x/image/draw"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model/base")// The reference processor uses the full 4096-token budget for still images.diff --git a/x/models/glimmer/media_test.go b/mlxrunner/model/glimmer/media_test.gosimilarity index 97%rename from x/models/glimmer/media_test.gorename to mlxrunner/model/glimmer/media_test.goindex 380fcf0de..0c027db7f 100644--- a/x/models/glimmer/media_test.go+++ b/mlxrunner/model/glimmer/media_test.go@@ -6,7 +6,7 @@ import ("image/png""testing"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/model/base")func testVisionModel() *Model {diff --git a/x/models/glimmer/vision.go b/mlxrunner/model/glimmer/vision.gosimilarity index 99%rename from x/models/glimmer/vision.gorename to mlxrunner/model/glimmer/vision.goindex 737e8e6f5..d13f31160 100644--- a/x/models/glimmer/vision.go+++ b/mlxrunner/model/glimmer/vision.go@@ -4,9 +4,9 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/nn")type VisionEncoder struct {diff --git a/x/models/glm4_moe_lite/config_test.go b/mlxrunner/model/glm4_moe_lite/config_test.gosimilarity index 96%rename from x/models/glm4_moe_lite/config_test.gorename to mlxrunner/model/glm4_moe_lite/config_test.goindex a8d932648..36c676ad3 100644--- a/x/models/glm4_moe_lite/config_test.go+++ b/mlxrunner/model/glm4_moe_lite/config_test.go@@ -5,8 +5,8 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")func TestConfigNestedRopeTheta(t *testing.T) {diff --git a/x/models/glm4_moe_lite/glm4_moe_lite.go b/mlxrunner/model/glm4_moe_lite/glm4_moe_lite.gosimilarity index 98%rename from x/models/glm4_moe_lite/glm4_moe_lite.gorename to mlxrunner/model/glm4_moe_lite/glm4_moe_lite.goindex 911934675..de6efdf84 100644--- a/x/models/glm4_moe_lite/glm4_moe_lite.go+++ b/mlxrunner/model/glm4_moe_lite/glm4_moe_lite.go@@ -7,13 +7,13 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/glm4_moe_lite/parser.go b/mlxrunner/model/glm4_moe_lite/parser.gosimilarity index 100%rename from x/models/glm4_moe_lite/parser.gorename to mlxrunner/model/glm4_moe_lite/parser.godiff --git a/x/models/glm4_moe_lite/parser_test.go b/mlxrunner/model/glm4_moe_lite/parser_test.gosimilarity index 100%rename from x/models/glm4_moe_lite/parser_test.gorename to mlxrunner/model/glm4_moe_lite/parser_test.godiff --git a/x/models/glm4_moe_lite/render.go b/mlxrunner/model/glm4_moe_lite/render.gosimilarity index 100%rename from x/models/glm4_moe_lite/render.gorename to mlxrunner/model/glm4_moe_lite/render.godiff --git a/x/models/glm4_moe_lite/render_test.go b/mlxrunner/model/glm4_moe_lite/render_test.gosimilarity index 100%rename from x/models/glm4_moe_lite/render_test.gorename to mlxrunner/model/glm4_moe_lite/render_test.godiff --git a/x/models/laguna/laguna.go b/mlxrunner/model/laguna/laguna.gosimilarity index 99%rename from x/models/laguna/laguna.gorename to mlxrunner/model/laguna/laguna.goindex 202df40c4..e1e353cf9 100644--- a/x/models/laguna/laguna.go+++ b/mlxrunner/model/laguna/laguna.go@@ -8,13 +8,13 @@ import ("slices""strings"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/laguna/laguna_test.go b/mlxrunner/model/laguna/laguna_test.gosimilarity index 99%rename from x/models/laguna/laguna_test.gorename to mlxrunner/model/laguna/laguna_test.goindex 02c727300..ecbcd9353 100644--- a/x/models/laguna/laguna_test.go+++ b/mlxrunner/model/laguna/laguna_test.go@@ -5,11 +5,11 @@ import ("strings""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/nn")func TestParseConfigLagunaXS(t *testing.T) {diff --git a/x/mlxrunner/model/linear.go b/mlxrunner/model/linear.gosimilarity index 96%rename from x/mlxrunner/model/linear.gorename to mlxrunner/model/linear.goindex 34dbfe8b4..bbc0eb26d 100644--- a/x/mlxrunner/model/linear.go+++ b/mlxrunner/model/linear.go@@ -1,8 +1,8 @@package modelimport (- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/nn")// LinearFactory builds linear layers using shared tensor maps and quant defaults.diff --git a/x/models/llama/llama.go b/mlxrunner/model/llama/llama.gosimilarity index 96%rename from x/models/llama/llama.gorename to mlxrunner/model/llama/llama.goindex d38b68e4d..8b2d62374 100644--- a/x/models/llama/llama.go+++ b/mlxrunner/model/llama/llama.go@@ -6,13 +6,13 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/nemotron_h/nemotron_h.go b/mlxrunner/model/nemotron_h/nemotron_h.gosimilarity index 99%rename from x/models/nemotron_h/nemotron_h.gorename to mlxrunner/model/nemotron_h/nemotron_h.goindex a64efe8e0..ce7e27af3 100644--- a/x/models/nemotron_h/nemotron_h.go+++ b/mlxrunner/model/nemotron_h/nemotron_h.go@@ -9,13 +9,13 @@ import ("strconv""strings"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/nemotron_h/nemotron_h_test.go b/mlxrunner/model/nemotron_h/nemotron_h_test.gosimilarity index 98%rename from x/models/nemotron_h/nemotron_h_test.gorename to mlxrunner/model/nemotron_h/nemotron_h_test.goindex 1d3d404d3..2b0e46627 100644--- a/x/models/nemotron_h/nemotron_h_test.go+++ b/mlxrunner/model/nemotron_h/nemotron_h_test.go@@ -6,10 +6,10 @@ import ("strings""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/nn")func TestParseConfigNestedWrapper(t *testing.T) {diff --git a/x/mlxrunner/model/quant.go b/mlxrunner/model/quant.gosimilarity index 97%rename from x/mlxrunner/model/quant.gorename to mlxrunner/model/quant.goindex 611b9e6b9..99bab3771 100644--- a/x/mlxrunner/model/quant.go+++ b/mlxrunner/model/quant.go@@ -1,8 +1,8 @@package modelimport (- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/quant"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/quant")// Import rewrites every vendor spelling to ".global_scale"; "_scale_2" is@@ -92,7 +92,7 @@ func SameGlobalScales(a, b *mlx.Array) bool {}// QuantizationParams returns default groupSize, bits, and mode for a-// quantization type. The values live in the shared x/quant package so the+// quantization type. The values live in the shared mlx/quant package so the// importer, the runtime loader, and `ollama show` agree on them.func QuantizationParams(quantization string) (groupSize, bits int, mode string) {return quant.Params(quantization)diff --git a/x/mlxrunner/model/quant_global_scale_test.go b/mlxrunner/model/quant_global_scale_test.gosimilarity index 98%rename from x/mlxrunner/model/quant_global_scale_test.gorename to mlxrunner/model/quant_global_scale_test.goindex c19af46e9..72c9424fa 100644--- a/x/mlxrunner/model/quant_global_scale_test.go+++ b/mlxrunner/model/quant_global_scale_test.go@@ -5,8 +5,8 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// ToMLXGlobalScale converts and flattens; PrepareGatherQMMGlobalScale onlydiff --git a/x/models/qwen3/qwen3.go b/mlxrunner/model/qwen3/qwen3.gosimilarity index 97%rename from x/models/qwen3/qwen3.gorename to mlxrunner/model/qwen3/qwen3.goindex ba78bc1f4..f87b4ff17 100644--- a/x/models/qwen3/qwen3.go+++ b/mlxrunner/model/qwen3/qwen3.go@@ -6,13 +6,13 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/qwen3_5/gdn_projections.go b/mlxrunner/model/qwen3_5/gdn_projections.gosimilarity index 98%rename from x/models/qwen3_5/gdn_projections.gorename to mlxrunner/model/qwen3_5/gdn_projections.goindex 1deb3dcdd..3f246b7df 100644--- a/x/models/qwen3_5/gdn_projections.go+++ b/mlxrunner/model/qwen3_5/gdn_projections.go@@ -4,8 +4,8 @@ import ("fmt""log/slog"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/nn")// The runtime keeps one layout for the linear-attention input projections:diff --git a/x/models/qwen3_5/gdn_projections_test.go b/mlxrunner/model/qwen3_5/gdn_projections_test.gosimilarity index 97%rename from x/models/qwen3_5/gdn_projections_test.gorename to mlxrunner/model/qwen3_5/gdn_projections_test.goindex 0b9203c90..a54e8b603 100644--- a/x/models/qwen3_5/gdn_projections_test.go+++ b/mlxrunner/model/qwen3_5/gdn_projections_test.go@@ -4,9 +4,9 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/nn")func gdnTestConfig() *Config {diff --git a/x/models/qwen3_5/process_image.go b/mlxrunner/model/qwen3_5/process_image.gosimilarity index 100%rename from x/models/qwen3_5/process_image.gorename to mlxrunner/model/qwen3_5/process_image.godiff --git a/x/models/qwen3_5/qwen3_5.go b/mlxrunner/model/qwen3_5/qwen3_5.gosimilarity index 99%rename from x/models/qwen3_5/qwen3_5.gorename to mlxrunner/model/qwen3_5/qwen3_5.goindex 85a7a03bd..ecf06f3a7 100644--- a/x/models/qwen3_5/qwen3_5.go+++ b/mlxrunner/model/qwen3_5/qwen3_5.go@@ -8,13 +8,13 @@ import ("math""strings"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/qwen3_5/qwen3_5_test.go b/mlxrunner/model/qwen3_5/qwen3_5_test.gosimilarity index 99%rename from x/models/qwen3_5/qwen3_5_test.gorename to mlxrunner/model/qwen3_5/qwen3_5_test.goindex b667567a4..5db6ce87a 100644--- a/x/models/qwen3_5/qwen3_5_test.go+++ b/mlxrunner/model/qwen3_5/qwen3_5_test.go@@ -4,9 +4,9 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/cache")func TestSanitizeConvWeight(t *testing.T) {diff --git a/x/models/qwen3_5/vision.go b/mlxrunner/model/qwen3_5/vision.gosimilarity index 98%rename from x/models/qwen3_5/vision.gorename to mlxrunner/model/qwen3_5/vision.goindex df664b4df..1c41591e4 100644--- a/x/models/qwen3_5/vision.go+++ b/mlxrunner/model/qwen3_5/vision.go@@ -5,11 +5,11 @@ import ("fmt""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/nn")// VisionConfig holds the qwen3.5 vision tower configuration.diff --git a/x/models/qwen3_5/vision_test.go b/mlxrunner/model/qwen3_5/vision_test.gosimilarity index 97%rename from x/models/qwen3_5/vision_test.gorename to mlxrunner/model/qwen3_5/vision_test.goindex 0099a84a7..9668df77b 100644--- a/x/models/qwen3_5/vision_test.go+++ b/mlxrunner/model/qwen3_5/vision_test.go@@ -7,9 +7,9 @@ import ("strings""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/model/base")func TestVisionAdapterWeightsAreCollectable(t *testing.T) {diff --git a/x/models/qwen3_5_moe/qwen3_5_moe.go b/mlxrunner/model/qwen3_5_moe/qwen3_5_moe.gosimilarity index 78%rename from x/models/qwen3_5_moe/qwen3_5_moe.gorename to mlxrunner/model/qwen3_5_moe/qwen3_5_moe.goindex a505b458e..8975b2ad8 100644--- a/x/models/qwen3_5_moe/qwen3_5_moe.go+++ b/mlxrunner/model/qwen3_5_moe/qwen3_5_moe.go@@ -2,8 +2,8 @@package qwen3_5_moeimport (- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/qwen3_5"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/model/qwen3_5")func init() {diff --git a/x/models/qwen4_exp/blocks.go b/mlxrunner/model/qwen4_exp/blocks.gosimilarity index 97%rename from x/models/qwen4_exp/blocks.gorename to mlxrunner/model/qwen4_exp/blocks.goindex f48046762..760c36751 100644--- a/x/models/qwen4_exp/blocks.go+++ b/mlxrunner/model/qwen4_exp/blocks.go@@ -3,10 +3,10 @@ package qwen4_expimport ("math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/nn")func (l *Layer) Forward(x *mlx.Array, b *batch.Batch, c, side cache.Cache, positions, ropePositions *mlx.Array, cfg *Config) *mlx.Array {diff --git a/x/models/qwen4_exp/config.go b/mlxrunner/model/qwen4_exp/config.gosimilarity index 100%rename from x/models/qwen4_exp/config.gorename to mlxrunner/model/qwen4_exp/config.godiff --git a/x/models/qwen4_exp/config_test.go b/mlxrunner/model/qwen4_exp/config_test.gosimilarity index 100%rename from x/models/qwen4_exp/config_test.gorename to mlxrunner/model/qwen4_exp/config_test.godiff --git a/x/models/qwen4_exp/engram.go b/mlxrunner/model/qwen4_exp/engram.gosimilarity index 98%rename from x/models/qwen4_exp/engram.gorename to mlxrunner/model/qwen4_exp/engram.goindex 1e6f5d8c9..ddb787304 100644--- a/x/models/qwen4_exp/engram.go+++ b/mlxrunner/model/qwen4_exp/engram.go@@ -3,8 +3,8 @@ package qwen4_expimport ("math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch")func (n *streamRMSNorm) Forward(x *mlx.Array, eps float32) *mlx.Array {diff --git a/x/models/qwen4_exp/engram_cache.go b/mlxrunner/model/qwen4_exp/engram_cache.gosimilarity index 97%rename from x/models/qwen4_exp/engram_cache.gorename to mlxrunner/model/qwen4_exp/engram_cache.goindex 1cfce5d98..cc840a52b 100644--- a/x/models/qwen4_exp/engram_cache.go+++ b/mlxrunner/model/qwen4_exp/engram_cache.go@@ -3,9 +3,9 @@ package qwen4_expimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache")// engramCache keeps the two raw token IDs and nine normalizeddiff --git a/x/models/qwen4_exp/engram_test.go b/mlxrunner/model/qwen4_exp/engram_test.gosimilarity index 96%rename from x/models/qwen4_exp/engram_test.gorename to mlxrunner/model/qwen4_exp/engram_test.goindex f356e911c..0b7a3ce93 100644--- a/x/models/qwen4_exp/engram_test.go+++ b/mlxrunner/model/qwen4_exp/engram_test.go@@ -4,9 +4,9 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch")func TestEngramHashes(t *testing.T) {diff --git a/x/models/qwen4_exp/hyper_connection.go b/mlxrunner/model/qwen4_exp/hyper_connection.gosimilarity index 97%rename from x/models/qwen4_exp/hyper_connection.gorename to mlxrunner/model/qwen4_exp/hyper_connection.goindex 85c1c3421..333b3af9f 100644--- a/x/models/qwen4_exp/hyper_connection.go+++ b/mlxrunner/model/qwen4_exp/hyper_connection.go@@ -1,6 +1,6 @@package qwen4_exp-import "github.com/ollama/ollama/x/mlxrunner/mlx"+import "github.com/ollama/ollama/mlx"type hyperConnectionState struct {residual *mlx.Arraydiff --git a/x/models/qwen4_exp/hyper_connection_test.go b/mlxrunner/model/qwen4_exp/hyper_connection_test.gosimilarity index 96%rename from x/models/qwen4_exp/hyper_connection_test.gorename to mlxrunner/model/qwen4_exp/hyper_connection_test.goindex e6c93950b..4564da917 100644--- a/x/models/qwen4_exp/hyper_connection_test.go+++ b/mlxrunner/model/qwen4_exp/hyper_connection_test.go@@ -4,9 +4,9 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/nn")func TestHyperConnectionMatchesReferenceFormula(t *testing.T) {diff --git a/x/models/qwen4_exp/qsa.go b/mlxrunner/model/qwen4_exp/qsa.gosimilarity index 98%rename from x/models/qwen4_exp/qsa.gorename to mlxrunner/model/qwen4_exp/qsa.goindex f70040082..5f8e3cf13 100644--- a/x/models/qwen4_exp/qsa.go+++ b/mlxrunner/model/qwen4_exp/qsa.go@@ -3,9 +3,9 @@ package qwen4_expimport ("math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")// canonicalRopePositionRows returns exact [B, 1, L, 3] position rows. MRoPEdiff --git a/x/models/qwen4_exp/qsa_test.go b/mlxrunner/model/qwen4_exp/qsa_test.gosimilarity index 95%rename from x/models/qwen4_exp/qsa_test.gorename to mlxrunner/model/qwen4_exp/qsa_test.goindex f86dde497..10046a52a 100644--- a/x/models/qwen4_exp/qsa_test.go+++ b/mlxrunner/model/qwen4_exp/qsa_test.go@@ -5,10 +5,10 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/models/nn"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/nn")func TestQSASelectsCompressedBlocksAndCausalTail(t *testing.T) {diff --git a/x/models/qwen4_exp/qwen4_exp.go b/mlxrunner/model/qwen4_exp/qwen4_exp.gosimilarity index 95%rename from x/models/qwen4_exp/qwen4_exp.gorename to mlxrunner/model/qwen4_exp/qwen4_exp.goindex 069ca2eba..88df62a15 100644--- a/x/models/qwen4_exp/qwen4_exp.go+++ b/mlxrunner/model/qwen4_exp/qwen4_exp.go@@ -4,14 +4,14 @@ package qwen4_expimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/models/qwen3_5"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/model/qwen3_5"+ "github.com/ollama/ollama/mlxrunner/nn"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func init() {diff --git a/x/models/qwen4_exp/weights.go b/mlxrunner/model/qwen4_exp/weights.gosimilarity index 98%rename from x/models/qwen4_exp/weights.gorename to mlxrunner/model/qwen4_exp/weights.goindex eece909c9..9efc91b3c 100644--- a/x/models/qwen4_exp/weights.go+++ b/mlxrunner/model/qwen4_exp/weights.go@@ -3,10 +3,10 @@ package qwen4_expimport ("fmt"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/models/nn"- "github.com/ollama/ollama/x/models/qwen3_5"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/model"+ "github.com/ollama/ollama/mlxrunner/model/qwen3_5"+ "github.com/ollama/ollama/mlxrunner/nn")type hyperConnection struct {diff --git a/x/mlxrunner/model/root.go b/mlxrunner/model/root.gosimilarity index 100%rename from x/mlxrunner/model/root.gorename to mlxrunner/model/root.godiff --git a/x/mlxrunner/mtp.go b/mlxrunner/mtp.gosimilarity index 98%rename from x/mlxrunner/mtp.gorename to mlxrunner/mtp.goindex aed607f31..e7e91f192 100644--- a/x/mlxrunner/mtp.go+++ b/mlxrunner/mtp.go@@ -4,9 +4,9 @@ import ("fmt""slices"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ sampler "github.com/ollama/ollama/mlxrunner/sample")// mtpPendingFlushTokens caps how many committed look-ahead tokens wait in thediff --git a/x/mlxrunner/mtp_test.go b/mlxrunner/mtp_test.gosimilarity index 99%rename from x/mlxrunner/mtp_test.gorename to mlxrunner/mtp_test.goindex 43142fa25..45404c27f 100644--- a/x/mlxrunner/mtp_test.go+++ b/mlxrunner/mtp_test.go@@ -12,13 +12,13 @@ import ("time""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base"+ sampler "github.com/ollama/ollama/mlxrunner/sample"+ "github.com/ollama/ollama/mlxrunner/tokenizer")// The MTP fakes make hidden state and logits the same tensor (Forward returnsdiff --git a/x/models/nn/nn.go b/mlxrunner/nn/nn.gosimilarity index 99%rename from x/models/nn/nn.gorename to mlxrunner/nn/nn.goindex f1f2d9783..90f918faf 100644--- a/x/models/nn/nn.go+++ b/mlxrunner/nn/nn.go@@ -1,6 +1,6 @@package nn-import "github.com/ollama/ollama/x/mlxrunner/mlx"+import "github.com/ollama/ollama/mlx"// Layer is the interface for neural network layers with a Forward method.type Layer interface {diff --git a/x/models/nn/nn_test.go b/mlxrunner/nn/nn_test.gosimilarity index 98%rename from x/models/nn/nn_test.gorename to mlxrunner/nn/nn_test.goindex 6d6e5c911..c31cb2db6 100644--- a/x/models/nn/nn_test.go+++ b/mlxrunner/nn/nn_test.go@@ -4,8 +4,8 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")func approxEqual(a, b, tol float32) bool {diff --git a/x/models/nn/recurrent.go b/mlxrunner/nn/recurrent.gosimilarity index 99%rename from x/models/nn/recurrent.gorename to mlxrunner/nn/recurrent.goindex 39ed099c5..ded8b55e7 100644--- a/x/models/nn/recurrent.go+++ b/mlxrunner/nn/recurrent.go@@ -3,8 +3,8 @@ package nnimport ("slices"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch")// RecurrentOption configures a call to CausalConv1D, GatedDelta or Mamba2Scan.diff --git a/x/models/nn/recurrent_test.go b/mlxrunner/nn/recurrent_test.gosimilarity index 99%rename from x/models/nn/recurrent_test.gorename to mlxrunner/nn/recurrent_test.goindex 2860ecb0a..4eef031f0 100644--- a/x/models/nn/recurrent_test.go+++ b/mlxrunner/nn/recurrent_test.go@@ -4,9 +4,9 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch")// lastState returns the forward-end state — the last boundary the recurrentdiff --git a/x/models/nn/rope.go b/mlxrunner/nn/rope.gosimilarity index 98%rename from x/models/nn/rope.gorename to mlxrunner/nn/rope.goindex 39d9dab19..c8ce30c7c 100644--- a/x/models/nn/rope.go+++ b/mlxrunner/nn/rope.go@@ -3,7 +3,7 @@ package nnimport ("math"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx")// RopeParameters carries common RoPE metadata embedded in model configs.diff --git a/x/models/nn/sdpa.go b/mlxrunner/nn/sdpa.gosimilarity index 99%rename from x/models/nn/sdpa.gorename to mlxrunner/nn/sdpa.goindex 3aaa2a908..6ead98248 100644--- a/x/models/nn/sdpa.go+++ b/mlxrunner/nn/sdpa.go@@ -4,8 +4,8 @@ import ("encoding/binary""math"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch")// SDPAOption configures a call to ScaledDotProductAttention.diff --git a/x/models/nn/sdpa_test.go b/mlxrunner/nn/sdpa_test.gosimilarity index 99%rename from x/models/nn/sdpa_test.gorename to mlxrunner/nn/sdpa_test.goindex b225110ea..9845c2667 100644--- a/x/models/nn/sdpa_test.go+++ b/mlxrunner/nn/sdpa_test.go@@ -4,9 +4,9 @@ import ("math""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest"+ "github.com/ollama/ollama/mlxrunner/batch")// newBatch constructs a synthetic batch for mask/SDPA tests.diff --git a/x/mlxrunner/pipeline.go b/mlxrunner/pipeline.gosimilarity index 98%rename from x/mlxrunner/pipeline.gorename to mlxrunner/pipeline.goindex 188f3610b..05a5d6039 100644--- a/x/mlxrunner/pipeline.go+++ b/mlxrunner/pipeline.go@@ -11,12 +11,12 @@ import ("github.com/ollama/ollama/llm""github.com/ollama/ollama/logutil"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base"+ sampler "github.com/ollama/ollama/mlxrunner/sample"+ "github.com/ollama/ollama/mlxrunner/tokenizer")func prefillChunkSize() int {diff --git a/x/mlxrunner/pipeline_test.go b/mlxrunner/pipeline_test.gosimilarity index 96%rename from x/mlxrunner/pipeline_test.gorename to mlxrunner/pipeline_test.goindex a80fce634..5d0bcf787 100644--- a/x/mlxrunner/pipeline_test.go+++ b/mlxrunner/pipeline_test.go@@ -7,11 +7,11 @@ import ("testing""github.com/ollama/ollama/llm"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/tokenizer")// textOnlyModel satisfies base.Model but not base.MediaModel.diff --git a/x/mlxrunner/prefix_cache.go b/mlxrunner/prefix_cache.gosimilarity index 99%rename from x/mlxrunner/prefix_cache.gorename to mlxrunner/prefix_cache.goindex 9a75e5761..0cf0742be 100644--- a/x/mlxrunner/prefix_cache.go+++ b/mlxrunner/prefix_cache.go@@ -36,8 +36,8 @@ import ("time""github.com/ollama/ollama/logutil"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/cache")const maxPagedOutBytes int64 = 8 << 30 // 8 GiB eviction threshold for paged-out snapshot memorydiff --git a/x/mlxrunner/prefix_cache_scenario_test.go b/mlxrunner/prefix_cache_scenario_test.gosimilarity index 99%rename from x/mlxrunner/prefix_cache_scenario_test.gorename to mlxrunner/prefix_cache_scenario_test.goindex 4f560c6db..62979262f 100644--- a/x/mlxrunner/prefix_cache_scenario_test.go+++ b/mlxrunner/prefix_cache_scenario_test.go@@ -8,7 +8,7 @@ import ("strings""testing"- "github.com/ollama/ollama/x/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/cache")// Scenario tests drive prefixCache through multi-request timelines on thediff --git a/x/mlxrunner/prefix_cache_test.go b/mlxrunner/prefix_cache_test.gosimilarity index 99%rename from x/mlxrunner/prefix_cache_test.gorename to mlxrunner/prefix_cache_test.goindex b870fd7ea..4beff3151 100644--- a/x/mlxrunner/prefix_cache_test.go+++ b/mlxrunner/prefix_cache_test.go@@ -5,9 +5,9 @@ import ("testing""time"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base")// snapshotTracker records every fakeSnapshot created and every Close() calldiff --git a/x/mlxrunner/runner.go b/mlxrunner/runner.gosimilarity index 95%rename from x/mlxrunner/runner.gorename to mlxrunner/runner.goindex 4814edfd5..a8eeb9303 100644--- a/x/mlxrunner/runner.go+++ b/mlxrunner/runner.go@@ -13,14 +13,15 @@ import ("golang.org/x/sync/errgroup""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/internal/mlxthread"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model"- "github.com/ollama/ollama/x/mlxrunner/model/base"- "github.com/ollama/ollama/x/mlxrunner/sample"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxthread"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model"+ _ "github.com/ollama/ollama/mlxrunner/model/architectures"+ "github.com/ollama/ollama/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/sample"+ "github.com/ollama/ollama/mlxrunner/tokenizer")// Request is a short-lived struct that carries a completion request throughdiff --git a/x/mlxrunner/sample/logprob_test.go b/mlxrunner/sample/logprob_test.gosimilarity index 98%rename from x/mlxrunner/sample/logprob_test.gorename to mlxrunner/sample/logprob_test.goindex 97abf343b..bc3aeb25a 100644--- a/x/mlxrunner/sample/logprob_test.go+++ b/mlxrunner/sample/logprob_test.go@@ -5,8 +5,8 @@ import ("sort""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// logprobEntry is the (token id, logprob) pair returned by the sampler'sdiff --git a/x/mlxrunner/sample/sample.go b/mlxrunner/sample/sample.gosimilarity index 99%rename from x/mlxrunner/sample/sample.gorename to mlxrunner/sample/sample.goindex 4e85778b4..573f026a4 100644--- a/x/mlxrunner/sample/sample.go+++ b/mlxrunner/sample/sample.go@@ -5,7 +5,7 @@ import ("math""slices"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx")type Options struct {diff --git a/x/mlxrunner/sample/sample_test.go b/mlxrunner/sample/sample_test.gosimilarity index 99%rename from x/mlxrunner/sample/sample_test.gorename to mlxrunner/sample/sample_test.goindex 30edfca80..13e2b12d5 100644--- a/x/mlxrunner/sample/sample_test.go+++ b/mlxrunner/sample/sample_test.go@@ -5,8 +5,8 @@ import ("slices""testing"- "github.com/ollama/ollama/x/internal/mlxtest"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxtest")// slotLogits builds a [1, V] logits tensor for a single-slot Sample call.diff --git a/x/mlxrunner/server.go b/mlxrunner/server.gosimilarity index 97%rename from x/mlxrunner/server.gorename to mlxrunner/server.goindex 0d3b6b1dd..0470f599b 100644--- a/x/mlxrunner/server.go+++ b/mlxrunner/server.go@@ -17,9 +17,9 @@ import ("github.com/ollama/ollama/api""github.com/ollama/ollama/envconfig""github.com/ollama/ollama/logutil"- "github.com/ollama/ollama/x/internal/mlxthread"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/sample"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlx/mlxthread"+ "github.com/ollama/ollama/mlxrunner/sample")func Execute(args []string) error {diff --git a/x/mlxrunner/speculate.go b/mlxrunner/speculate.gosimilarity index 98%rename from x/mlxrunner/speculate.gorename to mlxrunner/speculate.goindex 2aa2ca491..0f75aa6fe 100644--- a/x/mlxrunner/speculate.go+++ b/mlxrunner/speculate.go@@ -5,11 +5,11 @@ import ("fmt""time"- "github.com/ollama/ollama/x/mlxrunner/batch"- "github.com/ollama/ollama/x/mlxrunner/cache"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/model/base"- sampler "github.com/ollama/ollama/x/mlxrunner/sample"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/batch"+ "github.com/ollama/ollama/mlxrunner/cache"+ "github.com/ollama/ollama/mlxrunner/model/base"+ sampler "github.com/ollama/ollama/mlxrunner/sample")// draftSession proposes speculative tokens for one request, learning thediff --git a/x/mlxrunner/speculate_depth.go b/mlxrunner/speculate_depth.gosimilarity index 100%rename from x/mlxrunner/speculate_depth.gorename to mlxrunner/speculate_depth.godiff --git a/x/mlxrunner/speculate_depth_test.go b/mlxrunner/speculate_depth_test.gosimilarity index 100%rename from x/mlxrunner/speculate_depth_test.gorename to mlxrunner/speculate_depth_test.godiff --git a/x/mlxrunner/speculate_stats.go b/mlxrunner/speculate_stats.gosimilarity index 100%rename from x/mlxrunner/speculate_stats.gorename to mlxrunner/speculate_stats.godiff --git a/x/mlxrunner/status_memory.go b/mlxrunner/status_memory.gosimilarity index 100%rename from x/mlxrunner/status_memory.gorename to mlxrunner/status_memory.godiff --git a/x/mlxrunner/status_memory_test.go b/mlxrunner/status_memory_test.gosimilarity index 100%rename from x/mlxrunner/status_memory_test.gorename to mlxrunner/status_memory_test.godiff --git a/tokenizer/testdata/llama3.2/encoder.json b/mlxrunner/tokenizer/testdata/llama3.2/encoder.jsonsimilarity index 100%rename from tokenizer/testdata/llama3.2/encoder.jsonrename to mlxrunner/tokenizer/testdata/llama3.2/encoder.jsondiff --git a/tokenizer/testdata/llama3.2/vocab.bpe b/mlxrunner/tokenizer/testdata/llama3.2/vocab.bpesimilarity index 100%rename from tokenizer/testdata/llama3.2/vocab.bperename to mlxrunner/tokenizer/testdata/llama3.2/vocab.bpediff --git a/x/tokenizer/testdata/mini_llama.json b/mlxrunner/tokenizer/testdata/mini_llama.jsonsimilarity index 100%rename from x/tokenizer/testdata/mini_llama.jsonrename to mlxrunner/tokenizer/testdata/mini_llama.jsondiff --git a/x/tokenizer/tokenizer.go b/mlxrunner/tokenizer/tokenizer.gosimilarity index 100%rename from x/tokenizer/tokenizer.gorename to mlxrunner/tokenizer/tokenizer.godiff --git a/x/tokenizer/tokenizer_benchmark_test.go b/mlxrunner/tokenizer/tokenizer_benchmark_test.gosimilarity index 100%rename from x/tokenizer/tokenizer_benchmark_test.gorename to mlxrunner/tokenizer/tokenizer_benchmark_test.godiff --git a/x/tokenizer/tokenizer_bpe.go b/mlxrunner/tokenizer/tokenizer_bpe.gosimilarity index 100%rename from x/tokenizer/tokenizer_bpe.gorename to mlxrunner/tokenizer/tokenizer_bpe.godiff --git a/x/tokenizer/tokenizer_correctness_test.go b/mlxrunner/tokenizer/tokenizer_correctness_test.gosimilarity index 100%rename from x/tokenizer/tokenizer_correctness_test.gorename to mlxrunner/tokenizer/tokenizer_correctness_test.godiff --git a/x/tokenizer/tokenizer_decode.go b/mlxrunner/tokenizer/tokenizer_decode.gosimilarity index 100%rename from x/tokenizer/tokenizer_decode.gorename to mlxrunner/tokenizer/tokenizer_decode.godiff --git a/x/tokenizer/tokenizer_encode.go b/mlxrunner/tokenizer/tokenizer_encode.gosimilarity index 100%rename from x/tokenizer/tokenizer_encode.gorename to mlxrunner/tokenizer/tokenizer_encode.godiff --git a/x/tokenizer/tokenizer_ggml_parity_test.go b/mlxrunner/tokenizer/tokenizer_ggml_parity_test.gosimilarity index 98%rename from x/tokenizer/tokenizer_ggml_parity_test.gorename to mlxrunner/tokenizer/tokenizer_ggml_parity_test.goindex ee9b68f38..cd26fec76 100644--- a/x/tokenizer/tokenizer_ggml_parity_test.go+++ b/mlxrunner/tokenizer/tokenizer_ggml_parity_test.go@@ -18,7 +18,7 @@ func llama32GGMLFixturePath(tb testing.TB, file string) string {tb.Fatal("failed to resolve test file path")}- return filepath.Join(filepath.Dir(filename), "..", "..", "tokenizer", "testdata", "llama3.2", file)+ return filepath.Join(filepath.Dir(filename), "testdata", "llama3.2", file)}func loadLlama32FromGGMLFixture(tb testing.TB) *Tokenizer {diff --git a/x/tokenizer/tokenizer_load.go b/mlxrunner/tokenizer/tokenizer_load.gosimilarity index 100%rename from x/tokenizer/tokenizer_load.gorename to mlxrunner/tokenizer/tokenizer_load.godiff --git a/x/tokenizer/tokenizer_load_test.go b/mlxrunner/tokenizer/tokenizer_load_test.gosimilarity index 100%rename from x/tokenizer/tokenizer_load_test.gorename to mlxrunner/tokenizer/tokenizer_load_test.godiff --git a/x/mlxrunner/utf8_buffer.go b/mlxrunner/utf8_buffer.gosimilarity index 100%rename from x/mlxrunner/utf8_buffer.gorename to mlxrunner/utf8_buffer.godiff --git a/x/mlxrunner/utf8_buffer_test.go b/mlxrunner/utf8_buffer_test.gosimilarity index 100%rename from x/mlxrunner/utf8_buffer_test.gorename to mlxrunner/utf8_buffer_test.godiff --git a/x/mlxrunner/verify.go b/mlxrunner/verify.gosimilarity index 88%rename from x/mlxrunner/verify.gorename to mlxrunner/verify.goindex e7313c65a..85bd44331 100644--- a/x/mlxrunner/verify.go+++ b/mlxrunner/verify.go@@ -1,7 +1,7 @@package mlxrunnerimport (- "github.com/ollama/ollama/x/mlxrunner/model/base"+ "github.com/ollama/ollama/mlxrunner/model/base")// SupportsArchitecture reports whether the MLX runner has a constructor for arch.diff --git a/x/mlxrunner/verify_test.go b/mlxrunner/verify_test.gosimilarity index 86%rename from x/mlxrunner/verify_test.gorename to mlxrunner/verify_test.goindex 5bc543eec..35eebd0a6 100644--- a/x/mlxrunner/verify_test.go+++ b/mlxrunner/verify_test.go@@ -3,7 +3,7 @@ package mlxrunnerimport ("testing"- "github.com/ollama/ollama/x/mlxrunner/mlx"+ "github.com/ollama/ollama/mlx")func TestCheckRuntimeRequiresLoadedLibrary(t *testing.T) {diff --git a/x/mlxrunner/xgrammar/dynamic.c b/mlxrunner/xgrammar/dynamic.csimilarity index 100%rename from x/mlxrunner/xgrammar/dynamic.crename to mlxrunner/xgrammar/dynamic.cdiff --git a/x/mlxrunner/xgrammar/dynamic.h b/mlxrunner/xgrammar/dynamic.hsimilarity index 100%rename from x/mlxrunner/xgrammar/dynamic.hrename to mlxrunner/xgrammar/dynamic.hdiff --git a/x/mlxrunner/xgrammar/native/xgrammar.cpp b/mlxrunner/xgrammar/native/xgrammar.cppsimilarity index 100%rename from x/mlxrunner/xgrammar/native/xgrammar.cpprename to mlxrunner/xgrammar/native/xgrammar.cppdiff --git a/x/mlxrunner/xgrammar/native/xgrammar.h b/mlxrunner/xgrammar/native/xgrammar.hsimilarity index 100%rename from x/mlxrunner/xgrammar/native/xgrammar.hrename to mlxrunner/xgrammar/native/xgrammar.hdiff --git a/x/mlxrunner/xgrammar/xgrammar.go b/mlxrunner/xgrammar/xgrammar.gosimilarity index 100%rename from x/mlxrunner/xgrammar/xgrammar.gorename to mlxrunner/xgrammar/xgrammar.godiff --git a/x/mlxrunner/xgrammar/xgrammar_test.go b/mlxrunner/xgrammar/xgrammar_test.gosimilarity index 99%rename from x/mlxrunner/xgrammar/xgrammar_test.gorename to mlxrunner/xgrammar/xgrammar_test.goindex ddb4fd50d..3bb771888 100644--- a/x/mlxrunner/xgrammar/xgrammar_test.go+++ b/mlxrunner/xgrammar/xgrammar_test.go@@ -8,8 +8,8 @@ import ("strings""testing"- "github.com/ollama/ollama/x/mlxrunner/mlx"- "github.com/ollama/ollama/x/mlxrunner/xgrammar"+ "github.com/ollama/ollama/mlx"+ "github.com/ollama/ollama/mlxrunner/xgrammar")const (diff --git a/model/renderers/qwen38_test.go b/model/renderers/qwen38_test.goindex 971e5e776..3d3c93bae 100644--- a/model/renderers/qwen38_test.go+++ b/model/renderers/qwen38_test.go@@ -10,7 +10,7 @@ import ("github.com/google/go-cmp/cmp""github.com/ollama/ollama/api"- "github.com/ollama/ollama/x/tokenizer"+ "github.com/ollama/ollama/mlxrunner/tokenizer")const (diff --git a/server/create.go b/server/create.goindex 991cb0008..45c39f139 100644--- a/server/create.go+++ b/server/create.go@@ -24,15 +24,15 @@ import ("github.com/gin-gonic/gin""github.com/ollama/ollama/api"+ "github.com/ollama/ollama/create""github.com/ollama/ollama/envconfig""github.com/ollama/ollama/format""github.com/ollama/ollama/fs/gguf""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlx/quant"+ "github.com/ollama/ollama/mlxrunner""github.com/ollama/ollama/types/errtypes""github.com/ollama/ollama/types/model"- xcreate "github.com/ollama/ollama/x/create"- "github.com/ollama/ollama/x/mlxrunner"- "github.com/ollama/ollama/x/quant")var (@@ -87,7 +87,7 @@ func (s *Server) CreateHandler(c *gin.Context) {c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": errAdaptersUnsupported.Error()})return}- if _, err := xcreate.LicenseStrings(r.License); err != nil {+ if _, err := create.LicenseStrings(r.License); err != nil {c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": err.Error()})return}@@ -257,7 +257,7 @@ func (s *Server) CreateHandler(c *gin.Context) {}if err := createModel(reqCtx, r, name, baseLayers, config, fn); err != nil {- if errors.Is(err, xcreate.ErrBadTemplate) || errors.Is(err, xcreate.ErrInvalidRequires) || errors.Is(err, xcreate.ErrInvalidLicense) || errors.Is(err, errInvalidSplitGGUF) {+ if errors.Is(err, create.ErrBadTemplate) || errors.Is(err, create.ErrInvalidRequires) || errors.Is(err, create.ErrInvalidLicense) || errors.Is(err, errInvalidSplitGGUF) {send(gin.H{"error": err.Error(), "status": http.StatusBadRequest})return}@@ -297,7 +297,7 @@ func recoverCreatePanic(send func(any) bool) {}// createSafetensorsModel imports uploaded raw safetensors source files by-// staging them as a normal model directory and running the shared x/create+// staging them as a normal model directory and running the shared create// pipeline on the server.func createSafetensorsModel(ctx context.Context, r api.CreateRequest, name model.Name, fn func(resp api.ProgressResponse)) error {if len(r.Files) == 0 {@@ -326,7 +326,7 @@ func createSafetensorsModel(ctx context.Context, r api.CreateRequest, name modelprogressFn := func(status string) {fn(api.ProgressResponse{Status: status})}- store := xcreate.ManifestBlobStore{}+ store := create.ManifestBlobStore{}var draftDir stringvar draftCleanup func()@@ -341,7 +341,7 @@ func createSafetensorsModel(ctx context.Context, r api.CreateRequest, name modeldefer draftCleanup()}- return xcreate.Create(ctx, name.String(), modelDir, xcreate.PipelineOptions{+ return create.Create(ctx, name.String(), modelDir, create.PipelineOptions{Quantize: cmp.Or(r.Quantize, r.Quantization),Parser: r.Parser,Renderer: r.Renderer,@@ -358,7 +358,7 @@ func createSafetensorsErrorResponse(err error) gin.H {}status := http.StatusInternalServerError- for _, badReq := range []error{errNoFilesProvided, errFilePath, errSafetensorsFrom, errInvalidCreateInfo, manifest.ErrInvalidDigestFormat, xcreate.ErrBadTemplate, xcreate.ErrInvalidRequires, xcreate.ErrInvalidLicense, xcreate.ErrUnsupportedMLXArchitecture, os.ErrNotExist} {+ for _, badReq := range []error{errNoFilesProvided, errFilePath, errSafetensorsFrom, errInvalidCreateInfo, manifest.ErrInvalidDigestFormat, create.ErrBadTemplate, create.ErrInvalidRequires, create.ErrInvalidLicense, create.ErrUnsupportedMLXArchitecture, os.ErrNotExist} {if errors.Is(err, badReq) {status = http.StatusBadRequestbreak@@ -367,9 +367,9 @@ func createSafetensorsErrorResponse(err error) gin.H {return gin.H{"error": err.Error(), "status": status}}-func writeSafetensorsManifest(r api.CreateRequest, draftDir string, fn func(resp api.ProgressResponse)) xcreate.ManifestWriter {- next := xcreate.NewSafetensorsManifestWriter(xcreate.SafetensorsManifestOptions{- MinVersion: xcreate.SafetensorsMinOllamaVersion,+func writeSafetensorsManifest(r api.CreateRequest, draftDir string, fn func(resp api.ProgressResponse)) create.ManifestWriter {+ next := create.NewSafetensorsManifestWriter(create.SafetensorsManifestOptions{+ MinVersion: create.SafetensorsMinOllamaVersion,DraftDir: draftDir,Template: r.Template,System: r.System,@@ -378,7 +378,7 @@ func writeSafetensorsManifest(r api.CreateRequest, draftDir string, fn func(respMessages: r.Messages,BeforeWriteManifest: func() { fn(api.ProgressResponse{Status: "writing manifest"}) },})- return func(ctx context.Context, modelName string, info xcreate.ManifestInfo) error {+ return func(ctx context.Context, modelName string, info create.ManifestInfo) error {if len(info.ModelConfig.Capabilities) == 0 {info.ModelConfig.Capabilities = []string{"completion"}}@@ -470,7 +470,7 @@ func linkOrCopyFile(ctx context.Context, src, dst string) error {if err != nil {return err}- _, copyErr := io.Copy(out, xcreate.ReaderWithContext(ctx, in))+ _, copyErr := io.Copy(out, create.ReaderWithContext(ctx, in))closeErr := out.Close()if copyErr != nil {return copyErr@@ -844,7 +844,7 @@ func createModel(ctx context.Context, r api.CreateRequest, name model.Name, base}}- layers, err = xcreate.ApplyModelfileLayers(layers, xcreate.ModelfileLayerOptions{+ layers, err = create.ApplyModelfileLayers(layers, create.ModelfileLayerOptions{Template: r.Template,System: r.System,License: r.License,diff --git a/server/images.go b/server/images.goindex 383a23840..56fe712ca 100644--- a/server/images.go+++ b/server/images.go@@ -24,13 +24,13 @@ import ("github.com/ollama/ollama/api""github.com/ollama/ollama/envconfig""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlx""github.com/ollama/ollama/model/parsers""github.com/ollama/ollama/parser""github.com/ollama/ollama/template""github.com/ollama/ollama/thinking""github.com/ollama/ollama/types/model""github.com/ollama/ollama/version"- "github.com/ollama/ollama/x/mlxrunner/mlx""github.com/ollama/ollama/x/transfer")diff --git a/server/routes_create_test.go b/server/routes_create_test.goindex d1a30a0c0..2d7ef0654 100644--- a/server/routes_create_test.go+++ b/server/routes_create_test.go@@ -25,13 +25,13 @@ import (gocmpopts "github.com/google/go-cmp/cmp/cmpopts""github.com/ollama/ollama/api"+ "github.com/ollama/ollama/create""github.com/ollama/ollama/fs/gguf"+ st "github.com/ollama/ollama/fs/safetensors"gguftest "github.com/ollama/ollama/internal/testutil/gguf""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlxrunner""github.com/ollama/ollama/types/model"- xcreate "github.com/ollama/ollama/x/create"- "github.com/ollama/ollama/x/mlxrunner"- st "github.com/ollama/ollama/x/safetensors")var stream bool = false@@ -2083,9 +2083,9 @@ func createTestSafetensorsBlob(t *testing.T, tensors []*st.TensorData) string {return createTestBlob(t, data)}-func createTestLayerInfo(t *testing.T, name, mediaType string, data []byte) xcreate.LayerInfo {+func createTestLayerInfo(t *testing.T, name, mediaType string, data []byte) create.LayerInfo {t.Helper()- return xcreate.LayerInfo{+ return create.LayerInfo{Name: name,MediaType: mediaType,Digest: createTestBlob(t, data),@@ -2113,7 +2113,7 @@ func TestCreateSafetensorsRejectsUnsupportedArchitecture(t *testing.T) {if w.Code != http.StatusBadRequest {t.Fatalf("status = %d, want %d: %s", w.Code, http.StatusBadRequest, w.Body.String())}- if !strings.Contains(w.Body.String(), xcreate.ErrUnsupportedMLXArchitecture.Error()) {+ if !strings.Contains(w.Body.String(), create.ErrUnsupportedMLXArchitecture.Error()) {t.Fatalf("response = %s, want unsupported architecture error", w.Body.String())}if _, err := manifest.ParseNamedManifest(model.ParseName("unsupported-safetensors")); !errors.Is(err, os.ErrNotExist) {@@ -2223,7 +2223,7 @@ func TestWriteSafetensorsManifestPreservesRequestMetadata(t *testing.T) {tensorData := []byte("tensor")configData := []byte(`{"architectures":["TestModel"]}`)tokenizerData := []byte(`{"version":"1.0"}`)- info := xcreate.ManifestInfo{Layers: []xcreate.LayerInfo{+ info := create.ManifestInfo{Layers: []create.LayerInfo{createTestLayerInfo(t, "model.embed_tokens.weight", manifest.MediaTypeImageTensor, tensorData),createTestLayerInfo(t, "config.json", "application/vnd.ollama.image.json", configData),createTestLayerInfo(t, "tokenizer.json", "application/vnd.ollama.image.json", tokenizerData),@@ -2331,7 +2331,7 @@ func TestWriteSafetensorsManifestIncludesDraft(t *testing.T) {mainData := []byte("main tensor")draftData := []byte("draft tensor")draftConfig := []byte(`{"architectures":["TestDraftModel"]}`)- info := xcreate.ManifestInfo{Layers: []xcreate.LayerInfo{+ info := create.ManifestInfo{Layers: []create.LayerInfo{createTestLayerInfo(t, "model.embed_tokens.weight", manifest.MediaTypeImageTensor, mainData),createTestLayerInfo(t, "draft.model.embed_tokens.weight", manifest.MediaTypeImageTensor, draftData),createTestLayerInfo(t, "draft/config.json", "application/vnd.ollama.image.json", draftConfig),@@ -2478,7 +2478,7 @@ func TestCreateRejectsInvalidLicense(t *testing.T) {if w.Code != http.StatusBadRequest {t.Fatalf("status = %d, want %d: %s", w.Code, http.StatusBadRequest, w.Body.String())}- if !strings.Contains(w.Body.String(), xcreate.ErrInvalidLicense.Error()) {+ if !strings.Contains(w.Body.String(), create.ErrInvalidLicense.Error()) {t.Fatalf("response = %s, want invalid license error", w.Body.String())}})diff --git a/server/sched.go b/server/sched.goindex e31fedc57..535491349 100644--- a/server/sched.go+++ b/server/sched.go@@ -23,8 +23,8 @@ import ("github.com/ollama/ollama/llm""github.com/ollama/ollama/logutil""github.com/ollama/ollama/ml"+ "github.com/ollama/ollama/mlxrunner""github.com/ollama/ollama/types/model"- "github.com/ollama/ollama/x/mlxrunner")type LlmRequest struct {diff --git a/x/mlxrunner/imports.go b/x/mlxrunner/imports.godeleted file mode 100644index 540d8352d..000000000--- a/x/mlxrunner/imports.go+++ /dev/null@@ -1,16 +0,0 @@-package mlxrunner--import (- _ "github.com/ollama/ollama/x/models/cohere2_moe"- _ "github.com/ollama/ollama/x/models/dflash"- _ "github.com/ollama/ollama/x/models/gemma4"- _ "github.com/ollama/ollama/x/models/glimmer"- _ "github.com/ollama/ollama/x/models/glm4_moe_lite"- _ "github.com/ollama/ollama/x/models/laguna"- _ "github.com/ollama/ollama/x/models/llama"- _ "github.com/ollama/ollama/x/models/nemotron_h"- _ "github.com/ollama/ollama/x/models/qwen3"- _ "github.com/ollama/ollama/x/models/qwen3_5"- _ "github.com/ollama/ollama/x/models/qwen3_5_moe"- _ "github.com/ollama/ollama/x/models/qwen4_exp"-)diff --git a/x/server/show.go b/x/server/show.goindex f1985e3f2..4576b2ffb 100644--- a/x/server/show.go+++ b/x/server/show.go@@ -12,8 +12,8 @@ import ("github.com/ollama/ollama/api""github.com/ollama/ollama/manifest"+ "github.com/ollama/ollama/mlx/quant""github.com/ollama/ollama/types/model"- "github.com/ollama/ollama/x/quant")func canonicalQuantType(quantType string) string {