-
Notifications
You must be signed in to change notification settings - Fork 144
Proto data dependent symbolics #5077
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
Draft
CharlieL7
wants to merge
52
commits into
sym_slice_refactor
Choose a base branch
from
proto_data_dependent_symbolics
base: sym_slice_refactor
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.
Draft
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
e1a7bc7
allow sym slice attributes
shivadbhavsar 5b33c64
Merge remote-tracking branch 'origin/develop' into sym_slice
shivadbhavsar bbf66e9
fix tests
shivadbhavsar 88c5a61
Merge branch 'develop' into sym_slice
shivadbhavsar 5e79955
licensing and copilot comments
shivadbhavsar 37a5d6e
Merge branch 'sym_slice' of https://github.com/ROCm/AMDMIGraphX into …
shivadbhavsar ed88b6a
tidy
shivadbhavsar d4d32a6
Merge remote-tracking branch 'origin/develop' into sym_slice
shivadbhavsar 786f994
add attribure normalization for symbolic
shivadbhavsar 13dc8fe
Update test/op_shape_test.cpp format
shivadbhavsar aafa767
inital
CharlieL7 37b21c0
Update to use bind_symbolic
CharlieL7 7048749
Add bind_symbolic op and update NMS and slice
CharlieL7 f6654e1
Comment update
CharlieL7 860242a
TopK changes
CharlieL7 8fb0cb7
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into proto_data…
CharlieL7 806f28b
Remove bind_symbolic
CharlieL7 3e4b25e
Slice to use 2+ inputs for all symbolics
CharlieL7 aa7ce6d
Refine constraints on symbolic slice attributes
CharlieL7 82f335f
add runtime symbol resolution op
shivadbhavsar 30b3e07
copilot review
shivadbhavsar f21aa3d
Add bit flag enum and update parse_slice to set slice_mode
CharlieL7 9db601b
Retain old behavior but add symbolics support
CharlieL7 7c31007
tidy
shivadbhavsar 0e0afa8
Slice updates and tests
CharlieL7 9a224a2
Other changes around slice
CharlieL7 e92d11a
NMS: Early exit ref 0 boxes, add tests for 0 and 1 box edge cases (#4…
mvanhorn 9b410a2
[AIMIGRAPHX-1151] Add pytest bridge for unit tests (#5006)
eddieliao 5c50d0c
Fix nonzero for non-standard input layouts (#5046)
ikalinic e4736b3
Bump gitpython from 3.1.50 to 3.1.52 in /docs/sphinx (#5091)
dependabot[bot] 82f2328
Update MIGraphX version number to 2.17 (#5080)
causten 8c5dbe2
Add missing hsa-amd-aqlprofile package (#5083)
pfultz2 6b9fc74
update to simplify IR
shivadbhavsar a0803a1
ci fix
shivadbhavsar 1416391
format
shivadbhavsar 6e490a9
tidy
shivadbhavsar f6f858b
fix lowering
shivadbhavsar 4c03db9
Merge branch 'develop' into sym_resolve_op
shivadbhavsar e4981d3
Generate API sources in the build directory (#4961)
pfultz2 a73a3aa
symbolic reshape ops (#4977)
shivadbhavsar ae1b9c3
Update torchkit to support full converter refactor (#5060)
shivadbhavsar 3f80d98
cppcheck
shivadbhavsar 20a1f49
Merge branch 'develop' into sym_resolve_op
shivadbhavsar c488cd1
Enable hipBLASLt GEMM for gfx115x (#5082)
jomohamm 0c17c0a
Fix bug in reshape_dims when taking a static shape (#5093)
pfultz2 aff1a33
refactor to update input_shape attr through finalize
shivadbhavsar 3c3908c
Merge branch 'sym_resolve_op' of https://github.com/ROCm/AMDMIGraphX …
shivadbhavsar 49f842b
[AIMIGRAPHX-1209] optimize kernel 2 for non kv cache flash decoding a…
bdevorem 0910e3e
fix merge error
shivadbhavsar 8e44892
Merge branch 'develop' into sym_resolve_op
shivadbhavsar 872fefa
Merge branch 'sym_resolve_op' of github.com:ROCm/AMDMIGraphX into pro…
CharlieL7 d1c9f3b
Revert "Merge branch 'sym_resolve_op' of github.com:ROCm/AMDMIGraphX …
CharlieL7 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |||||
|
|
||||||
| #include <algorithm> | ||||||
| #include <array> | ||||||
| #include <cstdint> | ||||||
| #include <iterator> | ||||||
| #include <string> | ||||||
| #include <type_traits> | ||||||
|
|
@@ -141,6 +142,76 @@ struct is_named_enum<T, std::void_t<decltype(migraphx_enum_entries(std::declval< | |||||
| { | ||||||
| }; | ||||||
|
|
||||||
| // Detects enums declared with MIGRAPHX_BIT_FLAG_ENUM: those provide a migraphx_is_bit_flag hook and | ||||||
| // therefore support the type-safe bitwise operators below. | ||||||
| template <class T, class = void> | ||||||
| struct is_bit_flag : std::false_type | ||||||
| { | ||||||
| }; | ||||||
|
|
||||||
| template <class T> | ||||||
| struct is_bit_flag<T, std::void_t<decltype(migraphx_is_bit_flag(std::declval<T>()))>> | ||||||
| : std::true_type | ||||||
| { | ||||||
| }; | ||||||
|
|
||||||
| // Type-safe bitwise operators for enums declared with MIGRAPHX_BIT_FLAG_ENUM. They operate on the | ||||||
| // enum's underlying integer and return the enum type, so combining values never leaks to a raw | ||||||
| // integer and different flag enums cannot be mixed. | ||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E operator|(E lhs, E rhs) | ||||||
| { | ||||||
| using U = std::underlying_type_t<E>; | ||||||
| return static_cast<E>(static_cast<U>(lhs) | static_cast<U>(rhs)); | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E operator&(E lhs, E rhs) | ||||||
| { | ||||||
| using U = std::underlying_type_t<E>; | ||||||
| return static_cast<E>(static_cast<U>(lhs) & static_cast<U>(rhs)); | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E operator^(E lhs, E rhs) | ||||||
| { | ||||||
| using U = std::underlying_type_t<E>; | ||||||
| return static_cast<E>(static_cast<U>(lhs) ^ static_cast<U>(rhs)); | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E operator~(E val) | ||||||
| { | ||||||
| using U = std::underlying_type_t<E>; | ||||||
| return static_cast<E>(~static_cast<U>(val)); | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E& operator|=(E& lhs, E rhs) | ||||||
| { | ||||||
| return lhs = lhs | rhs; | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E& operator&=(E& lhs, E rhs) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [format.py] reported by reviewdog 🐶
Suggested change
|
||||||
| { | ||||||
| return lhs = lhs & rhs; | ||||||
| } | ||||||
|
|
||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr E& operator^=(E& lhs, E rhs) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [format.py] reported by reviewdog 🐶
Suggested change
|
||||||
| { | ||||||
| return lhs = lhs ^ rhs; | ||||||
| } | ||||||
|
|
||||||
| // Returns true when every bit set in flag is also set in val. | ||||||
| template <class E, MIGRAPHX_REQUIRES(is_bit_flag<E>{})> | ||||||
| constexpr bool has_flag(E val, E flag) | ||||||
| { | ||||||
| using U = std::underlying_type_t<E>; | ||||||
| return (static_cast<U>(val) & static_cast<U>(flag)) == static_cast<U>(flag); | ||||||
| } | ||||||
|
|
||||||
| // Returns the array of enumerator values for an enum declared with MIGRAPHX_ENUM. | ||||||
| template <class Enum, MIGRAPHX_REQUIRES(is_named_enum<Enum>{})> | ||||||
| auto enum_entries() | ||||||
|
|
@@ -285,4 +356,43 @@ Enum from_string(const std::string& name) | |||||
| MIGRAPHX_DETAIL_ENUM_HELPERS( \ | ||||||
| friend, name, MIGRAPHX_DETAIL_ENUM_CLASS_CAPTURE, using enum_scope = name;, __VA_ARGS__) | ||||||
|
|
||||||
| // Emits the ADL hook that marks an enum as a bit flag, which is_bit_flag detects to enable the | ||||||
| // bitwise operators. `linkage` is `inline` at namespace scope or `friend` at class scope, mirroring | ||||||
| // MIGRAPHX_DETAIL_ENUM_HELPERS. | ||||||
| // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) | ||||||
| #define MIGRAPHX_DETAIL_BIT_FLAG_ENUM(linkage, name) \ | ||||||
| linkage constexpr bool migraphx_is_bit_flag(name) { return true; } | ||||||
|
|
||||||
| // Declares a scoped enum (enum class) with the given underlying type and enables the type-safe | ||||||
| // bitwise operators |, &, ^, ~, |=, &=, ^= and has_flag() on it. Use it at namespace scope: | ||||||
| // | ||||||
| // MIGRAPHX_BIT_FLAG_ENUM(access, std::uint8_t, | ||||||
| // none = 0, | ||||||
| // read = 1 << 0, | ||||||
| // write = 1 << 1) | ||||||
| // | ||||||
| // auto rw = access::read | access::write; | ||||||
| // if(has_flag(rw, access::read)) { /* ... */ } | ||||||
| // | ||||||
| // Unlike MIGRAPHX_ENUM_CLASS, no to_string/from_string helpers are generated, so enumerator values | ||||||
| // should be self-contained bit masks. | ||||||
| // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) | ||||||
| #define MIGRAPHX_BIT_FLAG_ENUM(name, type, ...) \ | ||||||
| enum class name : type \ | ||||||
| { \ | ||||||
| __VA_ARGS__ \ | ||||||
| }; \ | ||||||
| MIGRAPHX_DETAIL_BIT_FLAG_ENUM(inline, name) | ||||||
|
|
||||||
| // Like MIGRAPHX_BIT_FLAG_ENUM, but for a scoped enum declared inside a class or struct; the hook is | ||||||
| // generated as a hidden friend so argument-dependent lookup still finds it. Use it inside the | ||||||
| // class/struct body. | ||||||
| // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) | ||||||
| #define MIGRAPHX_NESTED_BIT_FLAG_ENUM(name, type, ...) \ | ||||||
| enum class name : type \ | ||||||
| { \ | ||||||
| __VA_ARGS__ \ | ||||||
| }; \ | ||||||
| MIGRAPHX_DETAIL_BIT_FLAG_ENUM(friend, name) | ||||||
|
|
||||||
| #endif // MIGRAPHX_GUARD_MIGRAPHX_ENUM_HPP | ||||||
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.
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.
[format.py] reported by reviewdog 🐶