Repository navigation
feat(miopen-provider): support standalone binary pointwise #11934
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
Merged
averinevg
merged 24 commits into
develop
from
users/evaverin/binary-elementwise-op-support
Sep 22, 2026
Merged
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
965b90c
feat(miopen-provider): add standalone binary pointwise op support
averinevg aec8ee3
feat(dnn-providers): add binary pointwise integration tests
averinevg e4b10bb
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg c95da6e
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg 7939b9c
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg 2a7c0b0
test(miopen-provider): close mutation-blind gap in binary pointwise m…
averinevg 274429a
test(miopen-provider): trim redundant binary pointwise plan/builder u…
averinevg 028046f
test(dnn-providers): move pointwise graph builder to shared test SDK
averinevg afaa94a
refactor(miopen-provider): trim redundant comments in binary pointwis…
averinevg db6d0ff
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg 7f5b59d
refactor(dnn-providers,test_sdk): generalize pointwise graph test helper
averinevg 4f879c9
Merge branch 'develop' into users/evaverin/binary-elementwise-op-support
averinevg 296dc4b
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg afbe12c
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg 51109a7
test(dnn-providers): add binary pointwise template-sweep bundle
averinevg 3c3d6bf
feat(miopen-provider): register unary activation and binary pointwise…
averinevg 6d5bd79
fix(miopen-provider): guard binary pointwise element-count products a…
averinevg fb35aeb
test(miopen-provider): cover binary pointwise buildPlan
averinevg 94119f6
refactor(test_sdk): take a parameter struct in createPointwiseGraph
averinevg 9e66d84
test(flatbuffers_sdk): restore fully-populated pointwise JSON round-t…
averinevg ba1fdbc
Merge remote-tracking branch 'origin/develop' into users/evaverin/bin…
averinevg 31aa27a
Merge branch 'develop' into users/evaverin/binary-elementwise-op-support
averinevg 46371c8
Merge branch 'develop' into users/evaverin/binary-elementwise-op-support
averinevg 1dc65ca
Merge branch 'develop' into users/evaverin/binary-elementwise-op-support
averinevg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
dnn-providers/integration-tests/src/common/BinaryPointwiseCommon.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Copyright © Advanced Micro Devices, Inc., or its affiliates. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
| #include <ostream> | ||
| #include <string> | ||
| #include <utility> | ||
| #include <vector> | ||
|
|
||
| #include <hipdnn_data_sdk/utilities/ShapeUtilities.hpp> | ||
| #include <hipdnn_data_sdk/utilities/StringUtil.hpp> | ||
| #include <hipdnn_flatbuffers_sdk/flatbuffer_utilities/FlatbufferTypeHelpers.hpp> | ||
|
|
||
| namespace test_binary_pointwise_common | ||
| { | ||
|
|
||
| struct BinaryPointwiseShapeCase | ||
| { | ||
| std::vector<int64_t> xDims; | ||
| std::vector<int64_t> xStrides; | ||
| std::vector<int64_t> yDims; | ||
| std::vector<int64_t> yStrides; | ||
| std::vector<int64_t> outDims; | ||
| std::vector<int64_t> outStrides; | ||
| std::string note; | ||
|
|
||
| BinaryPointwiseShapeCase(std::vector<int64_t>&& dims, std::string&& caseNote) | ||
| : xDims(dims) | ||
| , xStrides(hipdnn_data_sdk::utilities::generateStrides(xDims)) | ||
| , yDims(xDims) | ||
| , yStrides(xStrides) | ||
| , outDims(std::move(dims)) | ||
| , outStrides(xStrides) | ||
| , note(std::move(caseNote)) | ||
| { | ||
| } | ||
|
|
||
| BinaryPointwiseShapeCase(std::vector<int64_t>&& xShapeDims, | ||
| std::vector<int64_t>&& yShapeDims, | ||
| std::string&& caseNote) | ||
| : xDims(std::move(xShapeDims)) | ||
| , xStrides(hipdnn_data_sdk::utilities::generateStrides(xDims)) | ||
| , yDims(std::move(yShapeDims)) | ||
| , yStrides(hipdnn_data_sdk::utilities::generateStrides(yDims)) | ||
| , outDims(xDims) | ||
| , outStrides(xStrides) | ||
| , note(std::move(caseNote)) | ||
| { | ||
| } | ||
|
|
||
| friend std::ostream& operator<<(std::ostream& ss, const BinaryPointwiseShapeCase& tc) | ||
| { | ||
| using namespace hipdnn_data_sdk::utilities; | ||
|
|
||
| ss << "(xDims:"; | ||
| vecToStream(ss, tc.xDims); | ||
| ss << " xStrides:"; | ||
| vecToStream(ss, tc.xStrides); | ||
| ss << " yDims:"; | ||
| vecToStream(ss, tc.yDims); | ||
| ss << " yStrides:"; | ||
| vecToStream(ss, tc.yStrides); | ||
| ss << " outDims:"; | ||
| vecToStream(ss, tc.outDims); | ||
| ss << " outStrides:"; | ||
| vecToStream(ss, tc.outStrides); | ||
| if(!tc.note.empty()) | ||
| { | ||
| ss << " note:" << tc.note; | ||
| } | ||
| ss << ")"; | ||
|
|
||
| return ss; | ||
| } | ||
| }; | ||
|
|
||
| inline std::vector<BinaryPointwiseShapeCase> createBinaryPointwiseShapeCases() | ||
| { | ||
| std::vector<BinaryPointwiseShapeCase> cases; | ||
|
|
||
| cases.push_back(BinaryPointwiseShapeCase{{2, 4, 8, 8}, "4d"}); | ||
| cases.push_back(BinaryPointwiseShapeCase{{2, 4, 8, 8}, {1, 4, 1, 1}, "Broadcast"}); | ||
| cases.push_back(BinaryPointwiseShapeCase{{2, 4, 8, 8, 2}, "5d"}); | ||
| cases.push_back(BinaryPointwiseShapeCase{{2, 8, 64}, "3d"}); | ||
|
|
||
| return cases; | ||
| } | ||
|
|
||
| inline std::vector<hipdnn_flatbuffers_sdk::data_objects::PointwiseMode> createBinaryPointwiseModes() | ||
| { | ||
| using PointwiseMode = hipdnn_flatbuffers_sdk::data_objects::PointwiseMode; | ||
| return {PointwiseMode::ADD, | ||
| PointwiseMode::SUB, | ||
| PointwiseMode::MUL, | ||
| PointwiseMode::MAX_OP, | ||
| PointwiseMode::MIN_OP}; | ||
| } | ||
|
|
||
| } // namespace test_binary_pointwise_common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ | |
|
|
||
| add_cpp_graph_test_sources( | ||
| IntegrationGpuActivationForward.cpp | ||
| IntegrationGpuPointwiseBinary.cpp | ||
| ) | ||
121 changes: 121 additions & 0 deletions
121
...iders/integration-tests/src/integration-tests/pointwise/IntegrationGpuPointwiseBinary.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| // Copyright © Advanced Micro Devices, Inc., or its affiliates. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| #include <hip/hip_runtime.h> | ||
|
|
||
| #include <tuple> | ||
|
|
||
| #include <hipdnn_data_sdk/utilities/PlatformUtils.hpp> | ||
| #include <hipdnn_test_sdk/utilities/CpuFpReferenceValidation.hpp> | ||
| #include <hipdnn_test_sdk/utilities/SdkFrontendTypeConversions.hpp> | ||
| #include <hipdnn_test_sdk/utilities/Seeds.hpp> | ||
| #include <hipdnn_test_sdk/utilities/TestUtilities.hpp> | ||
|
|
||
| #include "common/BinaryPointwiseCommon.hpp" | ||
| #include "harness/IntegrationGraphVerificationHarness.hpp" | ||
|
|
||
| using namespace hipdnn_frontend; | ||
| using namespace hipdnn_data_sdk::utilities; | ||
| using namespace hipdnn_test_sdk::utilities; | ||
| using namespace hipdnn_integration_tests; | ||
| using namespace test_binary_pointwise_common; | ||
|
|
||
| namespace | ||
| { | ||
|
|
||
| using SdkPointwiseMode = hipdnn_flatbuffers_sdk::data_objects::PointwiseMode; | ||
| using PointwiseBinaryTestCase = std::tuple<BinaryPointwiseShapeCase, SdkPointwiseMode>; | ||
|
|
||
| template <typename DataType> | ||
| class PointwiseBinary | ||
| : public IntegrationGraphVerificationHarness<DataType, PointwiseBinaryTestCase> | ||
| { | ||
| public: | ||
| struct GraphOutputs | ||
| { | ||
| std::shared_ptr<graph::TensorAttributes> out; | ||
| }; | ||
|
|
||
| static std::pair<graph::Graph, GraphOutputs> buildGraph(hipdnnHandle_t handle, | ||
| const PointwiseBinaryTestCase& tc) | ||
| { | ||
| const auto& [shape, mode] = tc; | ||
|
|
||
| graph::Graph graphObj; | ||
| graphObj.set_name("PointwiseBinaryTest"); | ||
|
|
||
| auto dataType = getDataTypeEnumFromType<DataType>(); | ||
| graphObj.set_intermediate_data_type(dataType) | ||
| .set_compute_data_type(hipdnn_frontend::DataType::FLOAT) | ||
| .set_io_data_type(dataType); | ||
|
|
||
| auto xAttr = graph::makeTensorAttributes("x", shape.xDims, shape.xStrides); | ||
| auto xTensorAttr = std::make_shared<graph::TensorAttributes>(std::move(xAttr)); | ||
|
|
||
| auto yAttr = graph::makeTensorAttributes("y", shape.yDims, shape.yStrides); | ||
| auto yTensorAttr = std::make_shared<graph::TensorAttributes>(std::move(yAttr)); | ||
|
|
||
| graph::PointwiseAttributes pwAttrs; | ||
| pwAttrs.set_mode(sdkToFrontendPointwiseMode(mode)); | ||
|
|
||
| auto outTensorAttr = graphObj.pointwise(xTensorAttr, yTensorAttr, pwAttrs); | ||
| outTensorAttr->set_output(true); | ||
|
|
||
| auto validateResult = graphObj.validate(); | ||
| if(validateResult.is_bad()) | ||
| { | ||
| throw std::runtime_error("Failed to validate graph: " + validateResult.get_message()); | ||
| } | ||
|
|
||
| auto buildResult = graphObj.build_operation_graph(handle); | ||
| if(buildResult.is_bad()) | ||
| { | ||
| throw std::runtime_error("Failed to build operation graph: " | ||
| + buildResult.get_message()); | ||
| } | ||
|
|
||
| return std::make_pair(std::move(graphObj), GraphOutputs{outTensorAttr}); | ||
| } | ||
|
|
||
| protected: | ||
| void runGraphTest() override | ||
| { | ||
| const auto& testCase = this->GetParam(); | ||
| const auto& shape = std::get<BinaryPointwiseShapeCase>(testCase); | ||
|
|
||
| auto [graphObj, outputs] = buildGraph(getSharedHandle(), testCase); | ||
|
|
||
| this->registerValidator(outputs.out, this->getTolerance(graphObj, outputs.out)); | ||
|
|
||
| this->setTestCaseNote(shape.note); | ||
| this->inputFillRecipes().setGlobalSeed(hipdnn_test_sdk::utilities::getGlobalTestSeed()); | ||
| this->verifyGraph(graphObj); | ||
| } | ||
| }; | ||
|
|
||
| using IntegrationGpuPointwiseBinaryFp32 = PointwiseBinary<float>; | ||
| using IntegrationGpuPointwiseBinaryFp16 = PointwiseBinary<half>; | ||
|
|
||
| } // namespace | ||
|
|
||
| GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntegrationGpuPointwiseBinaryFp32); | ||
| TEST_P(IntegrationGpuPointwiseBinaryFp32, Correctness) | ||
| { | ||
| runGraphTest(); | ||
| } | ||
|
|
||
| GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntegrationGpuPointwiseBinaryFp16); | ||
| TEST_P(IntegrationGpuPointwiseBinaryFp16, Correctness) | ||
| { | ||
| runGraphTest(); | ||
| } | ||
|
|
||
| INSTANTIATE_TEST_SUITE_P(Smoke, | ||
| IntegrationGpuPointwiseBinaryFp32, | ||
| testing::Combine(testing::ValuesIn(createBinaryPointwiseShapeCases()), | ||
| testing::ValuesIn(createBinaryPointwiseModes()))); | ||
|
|
||
| INSTANTIATE_TEST_SUITE_P(Smoke, | ||
| IntegrationGpuPointwiseBinaryFp16, | ||
| testing::Combine(testing::ValuesIn(createBinaryPointwiseShapeCases()), | ||
| testing::ValuesIn(createBinaryPointwiseModes()))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.