Skip to content
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: WIP] First version of attention fusion #1986

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

gramalingam
Copy link
Collaborator

First version of attention fusion.

Limitations:

  • Targetting only static shapes for now. Dynamic shapes will alter the pattern.
  • Targetting only MHA and the new onnx Attention op.

val_217 = val_216 * 32.0
val_218 = opset18.Cast(val_217, to=7)
val_219 = opset18.Concat(val_209, val_212, val_218, axis=0)
_scaled_dot_product_flash_attention_for_cpu__1 = opset18.Expand(0.0, val_219)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _scaled_dot_product_flash_attention_for_cpu__1 is not used.
Copy link

codecov bot commented Dec 27, 2024

❌ 57 Tests Failed:

Tests completed Failed Passed Skipped
8388 57 8331 3751
View the top 3 failed tests by shortest run time
::onnxscript.rewriter.onnxruntime.xformers._test_models
Stack Traces | 0s run time
No failure message available
onnxscript.rewriter.generic_pattern_test.GenericPatternTest_0::test_shared_root_value_test
Stack Traces | 0.001s run time
onnxscript/rewriter/generic_pattern_test.py:282: in test_shared_root_value_test
    rule.apply_to_model(ir_model)
onnxscript/rewriter/pattern.py:1364: in apply_to_model
    return RewriteRuleSet([self], commute=commute).apply_to_model(model, verbose=verbose)
onnxscript/rewriter/pattern.py:1535: in apply_to_model
    count = self._apply_to_graph_or_function(model, model.graph, verbose=verbose)
onnxscript/rewriter/pattern.py:1509: in _apply_to_graph_or_function
    delta = rule.try_rewrite(model, graph_or_function, node, verbose=verbose)
onnxscript/rewriter/pattern.py:1334: in try_rewrite
    match = self._matcher.match(
E   TypeError: match() got an unexpected keyword argument 'remove_nodes'
onnxscript.rewriter.generic_pattern_test.GenericPatternTest_0::test_transpose_transpose_onnxscript
Stack Traces | 0.001s run time
onnxscript/rewriter/generic_pattern_test.py:594: in test_transpose_transpose_onnxscript
    rule.apply_to_model(ir_model)
onnxscript/rewriter/pattern.py:1364: in apply_to_model
    return RewriteRuleSet([self], commute=commute).apply_to_model(model, verbose=verbose)
onnxscript/rewriter/pattern.py:1535: in apply_to_model
    count = self._apply_to_graph_or_function(model, model.graph, verbose=verbose)
onnxscript/rewriter/pattern.py:1509: in _apply_to_graph_or_function
    delta = rule.try_rewrite(model, graph_or_function, node, verbose=verbose)
onnxscript/rewriter/pattern.py:1334: in try_rewrite
    match = self._matcher.match(
E   TypeError: match() got an unexpected keyword argument 'remove_nodes'

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lintrunner found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

1 participant