-
Notifications
You must be signed in to change notification settings - Fork 131
Sym reshapes #4832
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
Open
shivadbhavsar
wants to merge
15
commits into
develop
Choose a base branch
from
sym_reshapes
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sym reshapes #4832
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e61d4c0
make dynamic shape conversion semantics clear
shivadbhavsar f1c088a
revert to_dynamic logic to before sym_dim_integration change
shivadbhavsar 44c9b15
style
shivadbhavsar 1db4ecc
fix bug with to_static
shivadbhavsar c0cd5d5
Merge branch 'develop' into to_symbolic_helper
shivadbhavsar 9a5f281
refactor dim attribute of reshape op to support
shivadbhavsar 36439ce
fix license
shivadbhavsar ff2ff45
Merge branch 'develop' into sym_reshapes
shivadbhavsar ee012c3
Merge branch 'develop' into sym_reshapes
shivadbhavsar afa9d9f
Merge remote-tracking branch 'origin/develop' into sym_reshapes
shivadbhavsar 4498317
refactor to use picked_variant
shivadbhavsar b513adb
Merge remote-tracking branch 'origin/develop' into sym_reshapes
shivadbhavsar 09ffc69
Apply suggestion from @github-actions[bot]
shivadbhavsar 462eea8
Merge branch 'develop' into sym_reshapes
shivadbhavsar 1040763
review comments
shivadbhavsar 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
|
|
||
| #include <migraphx/dim_like.hpp> | ||
| #include <migraphx/serialize.hpp> | ||
| #include <migraphx/value.hpp> | ||
|
|
||
| namespace migraphx { | ||
| inline namespace MIGRAPHX_INLINE_NS { | ||
|
|
||
| void migraphx_to_value(value& v, const dim_like& d) | ||
| { | ||
| v = visit([](const auto& x) { return migraphx::to_value(x); }, d); | ||
| } | ||
|
|
||
| void migraphx_from_value(const value& v, dim_like& d) | ||
| { | ||
| if(v.is_object()) | ||
| { | ||
| shape::dynamic_dimension dd; | ||
| migraphx::from_value(v, dd); | ||
| d = std::move(dd); | ||
| return; | ||
| } | ||
| d = v.to<int64_t>(); | ||
| } | ||
|
|
||
| } // namespace MIGRAPHX_INLINE_NS | ||
| } // namespace migraphx |
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,68 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
| #ifndef MIGRAPHX_GUARD_MIGRAPHLIB_DIM_LIKE_HPP | ||
| #define MIGRAPHX_GUARD_MIGRAPHLIB_DIM_LIKE_HPP | ||
|
|
||
| #include <cstdint> | ||
| #include <ostream> | ||
| #include <type_traits> | ||
|
|
||
| #include <migraphx/config.hpp> | ||
| #include <migraphx/picked_variant.hpp> | ||
| #include <migraphx/requires.hpp> | ||
| #include <migraphx/shape.hpp> | ||
|
|
||
| namespace migraphx { | ||
| inline namespace MIGRAPHX_INLINE_NS { | ||
|
|
||
| struct value; | ||
|
|
||
| // Routes any integral type through int64_t so call sites don't need casts. | ||
| struct dim_like_picker | ||
| { | ||
| template <class T, MIGRAPHX_REQUIRES(std::is_integral<T>{})> | ||
| static int64_t apply(T v) | ||
| { | ||
| return static_cast<int64_t>(v); | ||
| } | ||
|
|
||
| static shape::dynamic_dimension apply(shape::dynamic_dimension d) { return d; } | ||
| }; | ||
|
|
||
| // A dim attribute entry that may be either a plain int64_t or a dynamic_dimension. | ||
| using dim_like = picked_variant<dim_like_picker, int64_t, shape::dynamic_dimension>; | ||
|
|
||
| inline std::ostream& operator<<(std::ostream& os, const dim_like& d) | ||
| { | ||
| visit([&](const auto& x) { os << x; }, d); | ||
| return os; | ||
| } | ||
|
|
||
| MIGRAPHX_EXPORT void migraphx_to_value(value& v, const dim_like& d); | ||
| MIGRAPHX_EXPORT void migraphx_from_value(const value& v, dim_like& d); | ||
|
|
||
| } // namespace MIGRAPHX_INLINE_NS | ||
| } // namespace migraphx | ||
|
|
||
| #endif |
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.