-
Notifications
You must be signed in to change notification settings - Fork 256
Rework KTN gtest #3733
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?
Rework KTN gtest #3733
Conversation
test/gtest/kernel_tuning_net.cpp
Outdated
auto out_tensor = | ||
GPUMem{0, output_desc.GetNumBytes() / sizeof(data_type), sizeof(data_type)}; | ||
auto workSpaceSize = conv_desc.GetWorkSpaceSize(ctx, problem); | ||
auto workSpace = GPUMem{0, workSpaceSize / sizeof(data_type), sizeof(data_type)}; |
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.
Because of splitting bytes into elements, some solvers require workspace to be aligned like ConvAsmImplicitGemmGTCDynamicWrwXdlopsNHWC (256 B padding) - or have a multiple of some tile size.
So it might be a good idea to assert it meets alignment:
assert((workSpaceSize % required_alignment) == 0);
test/gtest/kernel_tuning_net.cpp
Outdated
@@ -181,11 +160,76 @@ class KernelTuningNetTest : public ::testing::TestWithParam<KernelTuningNetTestC | |||
conv_desc, | |||
test_case.direction); | |||
|
|||
Solver perf_config; | |||
auto data_type = test_case.data_type; | |||
auto in_tensor = |
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.
Becasue data_type is enum (not C++ type), when dividing the total byte_size, it will always be the size of that enum (which is 4 bytes) rather than the size of the underlying data elements intended to be allocated - which could over/under allocate GPU buffer. Is there a better way instead, like an actual element size or so?
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 is a utility for this I believe:
MIOpen/src/include/miopen/datatype.hpp
Lines 84 to 110 in 7e387ac
inline std::size_t get_data_size(miopenDataType_t type) | |
{ | |
auto ret = std::size_t{}; | |
visit_float(type, [&](auto as_float) { ret = sizeof(decltype(as_float(1.f))); }); | |
return ret; | |
} | |
inline std::size_t get_data_size(miopenIndexType_t index_type) | |
{ | |
switch(index_type) | |
{ | |
case miopenIndexUint8: { | |
return sizeof(uint8_t); | |
} | |
case miopenIndexUint16: { | |
return sizeof(uint16_t); | |
} | |
case miopenIndexUint32: { | |
return sizeof(uint32_t); | |
} | |
case miopenIndexUint64: { | |
return sizeof(uint64_t); | |
} | |
} | |
MIOPEN_THROW("not belong to any case"); | |
} |
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 has been resolved I believe.
Looks like build is failing on windows.
Probably need to add MIOPEN_INTERNALS_EXPORT to some of the functions that are used now in the tests. |
I think this has been corrected. |
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.
Edit:
Might be worth getting @msaudulhassan to look at this.
I think the original intent of these tests were to ensure the trained model was matching the expected result once integrated.
We may want to have both types of tests.
Some specific points to ensure the model integration is matching expected predictions.
And another set that ensures a broad set of shapes is giving correct predictions.
Test no longer compares to hard coded string.
Test applicability of performance config returned by model.
Test solver can be used for shape.
Test invocation of solution.
#3708