Skip to content

tests: Source-level separation between llama.cpp and ggml - #25179

Closed
ckastner wants to merge 1 commit into
ggml-org:masterfrom
ckastner:move-tests-to-ggml
Closed

ckastner wants to merge 1 commit into
ggml-org:masterfrom
ckastner:move-tests-to-ggml

Conversation

@ckastner

@ckastner ckastner commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

The tests don't use anything from llama.cpp, only from ggml, so they can be moved there. This enables a source-level separation of llama.cpp and ggml.

Additional information

Tests are taken over by ggml PR1551. This needs a separate PR there because the ggml/tests directory where they go isn't part of llama.cpp.

Requirements

@ckastner

Copy link
Copy Markdown
Collaborator Author

I found one more instance on the cmake level, but that should be it.

@ckastner ckastner changed the title tests: Remove ggml-only tests tests: Source-level separation between llama.cpp and ggml Jun 30, 2026
@ggerganov

Copy link
Copy Markdown
Member

The test-opt.cpp and test-backend-ops.cpp also don't depend on llama.cpp. However, we have to keep them here because most of the ggml development happens in the llama.cpp repo.

@ckastner

ckastner commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Understood.

Would you be open to conditionalizing the tests in cmake on LLAMA_USE_SYSTEM_GGML similar to the change for test-export-graph-ops, or should we just do this downstream only? All the same to us, I'm just asking in case this is also useful upstream.

@ggerganov

Copy link
Copy Markdown
Member

Would you be open to conditionalizing the tests in cmake on LLAMA_USE_SYSTEM_GGML similar to the change for test-export-graph-ops, or should we just do this downstream only?

Yes, that would be acceptable.

I think the ideal version is to move the ggml tests from /tests to ggml/tests and keep only the llama.cpp tests in the existing /tests folder. But this a bit of extra work - can do it next.

When using system ggml, skip tests against embedded ggml. The sources
might have been stripped of the embedded version, downstream.
@ckastner
ckastner force-pushed the move-tests-to-ggml branch from e44bd1d to bd42c81 Compare July 6, 2026 11:53
@ckastner

ckastner commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Yes, that would be acceptable.

Thanks, I force-pushed a change just for that.

I think the ideal version is to move the ggml tests from /tests to ggml/tests and keep only the llama.cpp tests in the existing /tests folder. But this a bit of extra work - can do it next.

Agreed. I considered proposing this, but then guessed keeping ggml/tests out of the sync was a design decision that you'd like to keep.

Comment thread tests/CMakeLists.txt
Comment on lines 308 to +311
llama_build(test-export-graph-ops.cpp)
target_include_directories(test-export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
if (NOT LLAMA_USE_SYSTEM_GGML)
target_include_directories(test-export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
endif()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the llama_build(test-export-graph-ops.cpp) line be inside the if?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it's useful to test-backend-ops which is always built, so I conditionalized only the use of the embedded-ggml headers.

But that is because I initially misunderstood test-backend-ops as being llama-specific, whereas you clarified above it's not.

That made me wonder why test-backend-ops didn't need that target_include_directories that test-export-graph-ops needs. So I rechecked, and it's because the former includes <ggml.h> not "ggml.h".

So maybe the CMake change is the wrong change, and the backend approach should be mirrored in test-export-graph-ops with the following change - what do you think?

-#include "ggml.h"
+#include <ggml.h>
 #include "gguf-model-data.h"
-#include "gguf.h"
-#include "ggml-backend.h"
+#include <gguf.h>
+#include <ggml-backend.h>

test-gguf and test-alloc refer to non-public ggml headers, so they continue to need the guard.

@ggerganov

Copy link
Copy Markdown
Member

Agreed. I considered proposing this, but then guessed keeping ggml/tests out of the sync was a design decision that you'd like to keep.

No, I think the reason was that it was simpler to have all tests in one place at the beginning. Now it makes sense to differentiate between ggml tests and llama.cpp tests.

@ckastner

ckastner commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Closing, superseded by #25616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants