add aten::_scaled_dot_product_flash_attention to perf model#217
Merged
add aten::_scaled_dot_product_flash_attention to perf model#217
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for flash attention in the performance model by introducing the aten::_scaled_dot_product_flash_attention operator.
- Adds a new mapping to link the operator in torch_op_mapping.py.
- Implements a new SDPA subclass in perf_model.py to handle flash attention-specific parameters.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TraceLens/PerfModel/torch_op_mapping.py | Added mapping for aten::_scaled_dot_product_flash_attention to invoke the new handler. |
| TraceLens/PerfModel/perf_model.py | Introduced a new class for flash attention with custom parameter parsing in get_param_details. |
| except (ValueError, TypeError): | ||
| pass | ||
| is_causal = concrete_inputs[4].lower() == 'true' if concrete_inputs[4] not in ('', 'None') else False | ||
| # scale = float(concrete_inputs[5]) if concrete_inputs[5] not in ('', 'None') else None |
There was a problem hiding this comment.
Consider removing the commented scale conversion code or fully implementing it to avoid confusion in future maintenance.
| try: | ||
| dropout_p = float(concrete_inputs[3]) | ||
| except (ValueError, TypeError): | ||
| pass |
There was a problem hiding this comment.
[nitpick] Consider logging a warning when the conversion of dropout_p fails in order to aid debugging instead of silently swallowing the error.
Suggested change
| pass | |
| logging.warning(f"Failed to convert dropout_p value '{concrete_inputs[3]}' to float.") |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.