-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Extend test case filtering #14865
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
Extend test case filtering #14865
Conversation
1. Allow passing multiple (comma-separated?) ops to test-backend-ops. This can be convenient when working on a set of ops, when you'd want to test them together (but without having to run every single op). For example: `test-backend-ops.exe test -o "ADD,RMS_NORM,ROPE,SILU,SOFT_MAX"` 2. Support full test-case variation string in addition to basic op names. This would make it easy to select a single variation, either for testing or for benchmarking. It can be particularly useful for profiling a particular variation (ex. a CUDA kernel), for example: `test-backend-ops.exe perf -b CUDA0 -o "MUL_MAT(type_a=f16,type_b=f32,m=4096,n=512,k=14336,bs=[1,1],nr=[1,1],per=[0,1,2,3],v=2)"` These two can be combined. As the current `-o`, this change doesn't try to detect/report an error if an filter doesn't name existing ops (ex. misspelled)
tests/test-backend-ops.cpp
Outdated
@@ -1020,7 +1021,37 @@ struct test_case { | |||
return t; | |||
} | |||
|
|||
bool eval(ggml_backend_t backend1, ggml_backend_t backend2, const char * op_name, printer * output_printer) { | |||
// Checks an op against the test filter, which is a comma separated list of OP names or specific variations | |||
bool matches_filter(ggml_tensor* op, const char* op_names_filter) { |
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.
Ideally, this method could be made const
. That would require making test_case::op_desc()
and test_case::vars()
const as well, which is a trivial, but noisy change.
If reviewers agree with that, I'm happy to make the additional change.
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.
Probably not worth it.
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.
It would be a welcome change in a separate PR.
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 extends the test case filtering functionality in the backend operations testing framework to support comma-separated operation lists and full test case variation strings. The enhancement allows developers to test specific groups of operations or individual test variations without running the entire test suite.
- Added
matches_filter
method to parse comma-separated operation filters and full test case strings - Updated all evaluation methods to use the new filtering mechanism instead of simple string comparison
- Modified command-line interface to accept multiple operations and full test case specifications
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.
Can be a follow-up PR, but regex-matching would be nice.
|
Ah, yes, it was mainly the params I was thinking of, thanks for the reminder. :) |
So, perhaps being able to specify params in the ops list is a bit superfluous. |
Thanks @am17an , @CISC. I discovered Either way, I can remove the support for full variation name if that's what the consensus is, but it doesn't simplify the code much, and we'd lose the ability to simply copy & paste the variation name into |
As you say, it has its use and removing it doesn't do much, let's keep it. |
BTW, in case you didn't know, it's super helpful to use single tick quotation marks for f.ex. regex strings as it will then be interpreted literally, no escaping necessary. |
I see one CI failure, although it doesn't appear related to my changes:
|
Thanks. Most, but not all, shells have some "raw" quotation indeed, but the escaping is required not just for the shell but for the regex syntax. For example, you won't be able to use use |
This PR implements the suggestion described in ggml-org/ggml#1308 (originally created against the GGML repo as ggml-org/ggml#1309)
test-backend-ops.exe test -o "ADD,RMS_NORM,ROPE,SILU,SOFT_MAX"
test-backend-ops.exe perf -b CUDA0 -o "MUL_MAT(type_a=f16,type_b=f32,m=4096,n=512,k=14336,bs=[1,1],nr=[1,1],per=[0,1,2,3],v=2)"
These two can be combined. As the current
-o
, this change doesn't try to detect/report an error if an filter doesn't name existing ops (ex. misspelled)