Skip to content

Commit b0800f6

Browse files
authored
Merge pull request #3422 from ROCm/release-fixes/fix_3285
Produced solutions now contain original problem #3413
2 parents 5790dc3 + e24d1f4 commit b0800f6

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed

src/include/miopen/problem.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ struct Problem
186186
const FindOptions& options,
187187
std::size_t max_solutions,
188188
const Buffers& buffers,
189-
const ConvolutionDescriptor& conv_desc) const;
189+
const ConvolutionDescriptor& conv_desc,
190+
const Problem& original) const;
190191

191192
std::vector<Solution> FindSolutionsImpl(Handle& handle,
192193
const FindOptions& options,

src/problem.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ Problem::FindSolutions(Handle& handle, const FindOptions& options, std::size_t m
179179
auto ret = std::visit(
180180
boost::hof::match(
181181
[&](const ConvolutionDescriptor& op_desc) {
182-
return FindSolutionsImpl(handle, options, max_solutions, buffers, op_desc);
182+
if(op_desc.mode == miopenTranspose)
183+
return MakeTransposed().FindSolutionsImpl(
184+
handle, options, max_solutions, buffers, op_desc, *this);
185+
else
186+
return FindSolutionsImpl(
187+
handle, options, max_solutions, buffers, op_desc, *this);
183188
},
184189
[&](const SoftmaxDescriptor& op_desc) {
185190
return FindSolutionsImpl(handle, options, max_solutions, buffers, op_desc);
@@ -460,7 +465,8 @@ std::vector<Solution> Problem::FindSolutionsImpl(Handle& handle,
460465
const FindOptions& options,
461466
std::size_t max_solutions,
462467
const Buffers& buffers,
463-
const ConvolutionDescriptor& conv_desc) const
468+
const ConvolutionDescriptor& conv_desc,
469+
const Problem& original) const
464470
{
465471
if(tensor_descriptors.size() != 3)
466472
{
@@ -477,21 +483,17 @@ std::vector<Solution> Problem::FindSolutionsImpl(Handle& handle,
477483
const auto& w = buffers.at(miopenTensorConvolutionW);
478484
auto y = buffers.at(miopenTensorConvolutionY);
479485

480-
const auto conv_problem =
481-
conv_desc.mode == miopenTranspose ? MakeTransposed().AsConvolution() : AsConvolution();
482-
483-
std::size_t workspace_size;
484-
Allocator::ManageDataPtr owned_workspace;
485-
Data_t workspace;
486-
487486
if(conv_desc.mode == miopenTranspose)
488-
{
489487
std::swap(x, y);
490-
std::swap(x_desc, y_desc);
491-
}
488+
489+
const auto conv_problem = AsConvolution();
492490

493491
ValidateGroupCount(x_desc, w_desc, conv_desc);
494492

493+
std::size_t workspace_size;
494+
Allocator::ManageDataPtr owned_workspace;
495+
Data_t workspace;
496+
495497
if(options.preallocated_workspace)
496498
{
497499
workspace = options.preallocated_workspace->buffer;
@@ -518,7 +520,7 @@ std::vector<Solution> Problem::FindSolutionsImpl(Handle& handle,
518520

519521
for(auto& result : results)
520522
{
521-
result.SetProblem({*this});
523+
result.SetProblem({original});
522524

523525
if(result.GetKernels().empty())
524526
{

test/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,31 @@ add_custom_test(smoke_solver_ConvMlirIgemm_W GFX900_DISABLED GFX908_DISABLED GFX
930930
ENVIRONMENT MIOPEN_FIND_ENFORCE=SEARCH_DB_UPDATE MIOPEN_DEBUG_TUNING_ITERATIONS_MAX=5 ${IMPLICITGEMM_MLIR_ENV_W}
931931
COMMAND $<TARGET_FILE:test_conv2d> ${TEST_CONV_VERBOSE_W} --input 64 64 28 28 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
932932
)
933+
934+
add_custom_test(conv_transposed_fwd
935+
COMMAND $<TARGET_FILE:test_conv2d> ${TEST_CONV_VERBOSE_F} --input 1 16 24 24 --weights 16 16 7 7 --pads_strides_dilations 3 3 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
936+
)
937+
938+
add_custom_test(conv_transposed_bwd
939+
COMMAND $<TARGET_FILE:test_conv2d> ${TEST_CONV_VERBOSE_B} --input 64 64 28 28 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
940+
)
941+
942+
add_custom_test(conv_transposed_wrw
943+
COMMAND $<TARGET_FILE:test_conv2d> ${TEST_CONV_VERBOSE_W} --input 64 64 28 28 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
944+
)
945+
946+
add_custom_test(conv_transposed_fwd_find_2
947+
COMMAND $<TARGET_FILE:test_conv2d_find2> ${TEST_CONV_VERBOSE_F} --input 1 16 24 24 --weights 16 16 7 7 --pads_strides_dilations 3 3 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
948+
)
949+
950+
add_custom_test(conv_transposed_bwd_find_2
951+
COMMAND $<TARGET_FILE:test_conv2d_find2> ${TEST_CONV_VERBOSE_B} --input 64 64 28 28 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
952+
)
953+
954+
add_custom_test(conv_transposed_wrw_find_2
955+
COMMAND $<TARGET_FILE:test_conv2d_find2> ${TEST_CONV_VERBOSE_W} --input 64 64 28 28 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --cmode transpose ${MIOPEN_TEST_FLAGS_ARGS}
956+
)
957+
933958
#Dont install the tests if we are building each test separately
934959
#When the tests are built as a single unit, then we want to be
935960
#able to package them

0 commit comments

Comments
 (0)