-
Notifications
You must be signed in to change notification settings - Fork 109
Op Builder Tests 1. #4242
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: develop
Are you sure you want to change the base?
Op Builder Tests 1. #4242
Conversation
"batch axes that are not the outer-most axes, is not implemented", | ||
{3, 3, 3}, | ||
{})); | ||
} |
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 is missing tests for the valid inputs, are you going to add tests for those?
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've just added a few positive test cases. Pls. let me know if you'd like to see some specific special case that needs to be tested.
*/ | ||
#include "test.hpp" | ||
|
||
int main(int argc, const char* argv[]) { test::run(argc, argv); } |
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 think this file can be removed as it doesnt have any tests.
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 purpose of this file is equivalent with the main.cpp inside "./test/onnx/parse/" or "./test/onnx/verify". This serves merely for the "test_op_builder_test" binary to have an entry point that launches the test cases.
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 see the other tests dont have a main function.
const migraphx::value& options, | ||
const std::vector<migraphx::instruction_ref>& params) | ||
{ | ||
migraphx::module mm_op_built; |
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.
Paul! I recall that you've mentioned something about this implementation in the weekly meeting. Could you pls. describe here how would you like to see this to be done?
…in the code layout between my vscode and the pipeline
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 comprehensive test coverage for op-builders in AMDMIGraphX, implementing tests for operators that were merged in PR #4005. The tests validate both successful operation building and error handling for invalid inputs.
- Introduces a utility module for testing op-builders with standardized test patterns
- Implements comprehensive test suites for GEMM, GELU, einsum, CELU, and other op-builders
- Adds CMake build configuration to compile and run the op-builder tests
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
test/op/include/op_builder_test_utils.hpp | Utility header providing helper functions for testing op-builders |
test/op/builder/gemm_test.cpp | Test cases for GEMM op-builder with various parameter configurations |
test/op/builder/gelu_test.cpp | Test cases for GELU variants (quick, erf, tanh, split) |
test/op/builder/einsum_test.cpp | Extensive test suite for einsum operations covering matrix operations and error cases |
test/op/builder/celu_test.cpp | Test cases for CELU op-builder including error handling |
test/op/builder/batchnorm_test.cpp | Test cases for batch normalization op-builder |
test/op/builder/mean_variance_normalization_test.cpp | Test cases for mean variance normalization |
test/op/builder/main.cpp | Test runner entry point |
test/op/CMakeLists.txt | Build configuration for op-builder tests |
test/CMakeLists.txt | Updated to include op-builder test directory |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
const std::vector<migraphx::instruction_ref>& args{params.rbegin(), params.rend()}; | ||
mm_op_built.add_instructions(args); | ||
|
||
const auto& params2 = mm_op_built.get_parameters(); | ||
const std::vector<migraphx::instruction_ref>& args2{params2.rbegin(), params2.rend()}; | ||
|
||
migraphx::op::builder::add(op_builder_name, mm_op_built, args2, options); |
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.
[nitpick] The variable name args
is confusing since it represents a reversed copy of params
. Consider renaming to reversed_params
or adding a comment explaining why the reversal is necessary.
const std::vector<migraphx::instruction_ref>& args{params.rbegin(), params.rend()}; | |
mm_op_built.add_instructions(args); | |
const auto& params2 = mm_op_built.get_parameters(); | |
const std::vector<migraphx::instruction_ref>& args2{params2.rbegin(), params2.rend()}; | |
migraphx::op::builder::add(op_builder_name, mm_op_built, args2, options); | |
const std::vector<migraphx::instruction_ref> reversed_params{params.rbegin(), params.rend()}; | |
mm_op_built.add_instructions(reversed_params); | |
const auto& params2 = mm_op_built.get_parameters(); | |
const std::vector<migraphx::instruction_ref> reversed_params2{params2.rbegin(), params2.rend()}; | |
migraphx::op::builder::add(op_builder_name, mm_op_built, reversed_params2, options); |
Copilot uses AI. Check for mistakes.
{ | ||
migraphx::module mm; | ||
|
||
const auto axes = {2, 2, 2}; |
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 axes vector contains duplicate values (2, 2, 2) which doesn't match the test comment indicating 'axes attribute needs to be equal to input tensor rank - 1'. For a 4D tensor {2, 2, 2, 2}, this should likely be {1, 2, 3} or similar non-duplicate axis indices.
const auto axes = {2, 2, 2}; | |
const auto axes = {1, 2, 3}; |
Copilot uses AI. Check for mistakes.
test/op/builder/gelu_test.cpp
Outdated
auto split_left = mm.add_instruction( | ||
migraphx::make_op("slice", | ||
{{"axes", {-1}}, {"starts", {0}}, {"ends", {last_dim_size / 2}}}), | ||
x); |
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.
[nitpick] The indentation of the migraphx::make_op call is inconsistent. The parameters should be aligned properly within the function call.
auto split_left = mm.add_instruction( | |
migraphx::make_op("slice", | |
{{"axes", {-1}}, {"starts", {0}}, {"ends", {last_dim_size / 2}}}), | |
x); | |
auto split_left = mm.add_instruction( | |
migraphx::make_op( | |
"slice", {{"axes", {-1}}, {"starts", {0}}, {"ends", {last_dim_size / 2}}}), | |
x); |
Copilot uses AI. Check for mistakes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4242 +/- ##
=========================================
Coverage 92.23% 92.23%
=========================================
Files 555 557 +2
Lines 25682 25924 +242
=========================================
+ Hits 23686 23910 +224
- Misses 1996 2014 +18 🚀 New features to boost your workflow:
|
During the code review of the op-builder-PRs the demand of creating tests for the op-builders came up.
This is the first PR that covers those op-builders that has already been merged in #4005