-
Notifications
You must be signed in to change notification settings - Fork 113
Fix bug in eliminate_datatype, attempt to convert to int32 instead #4535
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
kahmed10
wants to merge
5
commits into
develop
Choose a base branch
from
int64_elim_type
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.
+108
−2
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b49aaa6
try to convert int64 to int32 or don't eliminate it with flag
kahmed10 e9f0f0e
formatting
kahmed10 ee4dacb
Merge branch 'develop' of https://github.com/ROCm/AMDMIGraphX into in…
kahmed10 cb8ac2e
fix test
kahmed10 cdbcc68
update doc
kahmed10 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 |
|---|---|---|
|
|
@@ -90,6 +90,7 @@ MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_ENABLE_CK) | |
| #endif | ||
| MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_SET_GEMM_PROVIDER) | ||
| MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_ENABLE_FULL_DYNAMIC) | ||
| MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_DISABLE_ELIMINATE_INT64) | ||
|
|
||
| std::vector<pass> target::get_passes(migraphx::context& gctx, const compile_options& options) const | ||
| { | ||
|
|
@@ -107,6 +108,13 @@ std::vector<pass> target::get_passes(migraphx::context& gctx, const compile_opti | |
| unsupported_types.erase(shape::type_t::int8_type); | ||
| unsupported_types.erase(shape::type_t::uint8_type); | ||
| unsupported_types.erase(shape::type_t::int32_type); | ||
| // int64_type handling: If MIGRAPHX_DISABLE_ELIMINATE_INT64=1, support int64 natively. | ||
| // Otherwise, it will be converted to int32_type via a separate pass below | ||
| // to preserve integer semantics for operations like mod, gather, slice. | ||
| if(enabled(MIGRAPHX_DISABLE_ELIMINATE_INT64{})) | ||
| { | ||
| unsupported_types.erase(shape::type_t::int64_type); | ||
| } | ||
| unsupported_types.erase(shape::type_t::tuple_type); | ||
|
|
||
| // No BF-16 Support on Navi21 | ||
|
|
@@ -197,6 +205,10 @@ std::vector<pass> target::get_passes(migraphx::context& gctx, const compile_opti | |
| dead_code_elimination{}, | ||
| // workaround for rocBLAS unsupported error when using uint8 in quant_dot, quant_convolution & pooling | ||
| eliminate_data_type{{migraphx::shape::uint8_type}, shape::float_type, {"quant_convolution", "quant_dot", "pooling"}}, | ||
| // Convert int64 to int32 to preserve integer semantics (mod, gather, slice need exact integers) | ||
| // This must run before the general float elimination to avoid int64 -> float conversion | ||
| // Set MIGRAPHX_DISABLE_ELIMINATE_INT64=1 to keep native int64 support | ||
| enable_pass(disabled(MIGRAPHX_DISABLE_ELIMINATE_INT64{}), eliminate_data_type{{shape::type_t::int64_type}, shape::type_t::int32_type}), | ||
|
Collaborator
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. It would be better to have a one pass to convert float types to fp32 and another to convert integer types to int32. Also think all these |
||
| eliminate_data_type{unsupported_types, shape::type_t::float_type}, | ||
| simplify_reshapes{}, | ||
| eliminate_identity{}, | ||
|
|
||
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.
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.
I dont think we should have a warning for this, especially here in the pass as the
MIGRAPHX_DISABLE_ELIMINATE_INT64variable doesnt change the behavior of the class. It would be better to have a more general env variable to skip type elimination in the pass withMIGRAPHX_DISABLE_ELIMINATE_TYPES=int64_t,uint64_t.