-
Notifications
You must be signed in to change notification settings - Fork 12.2k
test-backend-ops: add support for specifying output format #14368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bfa7a43
to
359d792
Compare
359d792
to
34500f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for specifying the output format (console or SQL) for the test-backend-ops tool and unifies logging via a new printer interface.
- Introduces a printer interface with concrete implementations for console and SQL output.
- Updates test evaluation functions and the CLI to use the printer for logging.
- Adds new command-line option "--output" along with helper functions to parse the output format.
Signed-off-by: Xiaodong Ye <[email protected]>
34500f9
to
679a141
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my end I think these changes to test-backend-ops
would be fine but keep in mind that it's an important piece of the project with many stakeholders.
passed = false; | ||
|
||
// Set test time | ||
time_t t = time(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to record the timestamp (the same as llama-bench
), but I haven’t decided how to use it.
Signed-off-by: Xiaodong Ye <[email protected]>
Signed-off-by: Xiaodong Ye <[email protected]>
Thanks for pointing that out! I’ll add the recent contributors as reviewers. |
// External declarations for build info | ||
extern int LLAMA_BUILD_NUMBER; | ||
extern const char *LLAMA_COMMIT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-backend-ops
is part of ggml, and cannot depend on llama.cpp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main goal of this work is to generate a comparison table for test-backend-ops, which I believe is especially useful when updating or optimizing op implementations. For more context, please refer to #14354.
The commit hash is used to compare performance changes between two revisions, as shown in #14392.
Do you have any suggestions on how to update this? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are already GGML_BUILD_NUMBER
and GGML_BUILD_COMMIT
variables in the ggml build. They are currently not passed to the code, but you pass them through a compile_definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the generated build-info.cpp
contains the same commit hash and build number for both LLAMA and GGML:
int LLAMA_BUILD_NUMBER = 5757;
char const *LLAMA_COMMIT = "38d4930ec";
char const *LLAMA_COMPILER = "Apple clang version 17.0.0 (clang-1700.0.13.5)";
char const *LLAMA_BUILD_TARGET = "arm64-apple-darwin24.5.0";
int GGML_BUILD_NUMBER = 5757;
char const *GGML_BUILD_COMMIT = "38d4930ec";
Please see the new commit: 76ca4f6 Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this way still depends on the llama.cpp common lib.
tests/test-backend-ops.cpp
Outdated
// General purpose output methods | ||
virtual void print_info(const char * format, ...) = 0; | ||
virtual void print_error(const char * format, ...) = 0; | ||
virtual void print_device_info(const char * format, ...) = 0; | ||
virtual void print_test_summary(const char * format, ...) = 0; | ||
virtual void print_status_ok() = 0; | ||
virtual void print_status_fail() = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this a good design, all of these functions do the same and could be replaced with a single print_message
. If you want transfer the responsibility of formatting the output to a class, then the class needs to have the information to decide what to print, not an unstructured message. Ideally all of the functions would receive an object to print, and the class would determine how to format that object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I’ll update the code accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the latest commit. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really change anything. The ideal solution would be to remove all the messages entirely, and pass enough information to the printers so that they format the output in any way they want. That would require a significant refactor, and not simply replacing calls to printf
with printer->print_message
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if I understand this correctly: f4f5512
Thanks.
Signed-off-by: Xiaodong Ye <[email protected]>
Signed-off-by: Xiaodong Ye <[email protected]>
76ca4f6
to
f4f5512
Compare
Make sure to read the contributing guidelines before submitting a PR
Testing Done
Edit (added
build_commit
andbuild_number
for future use):