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

Hunt correctness for extend attention + RPE #504

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

nicolasvasilache
Copy link
Contributor

Avoid flex_attention for RPE as it is unclear there is a correct implementation possible given the
limitations of the create_block_mask re conditionals.

Instead we use the manual torch implementation that is known to be correct.

As we update the test and the extend_attention_rpe to use a static max_rpe_context_length,
a new error appears that suggests some issue with the indexing in extend_attention_rpe.

Repro:

pytest tests/kernel/wave/attention/extend_attention_test.py --run-e2e -v -k "rpe"

Errors out with:

Diagnostics:
  <stdin>:282:18: error: 'vector.gather' op operand #2 must be vector of integer or index values, but got 'index'
  %468 = "vector.gather"(%109, %39, %39, %467, %44) : (memref<?xf32, strided<[1], offset: ?>>, index, index, vector<4xi1>, vector<4xf32>) -> vector<4xf32>
                                ^

Signed-off-by: Nicolas Vasilache [email protected]

raikonenfnu and others added 12 commits February 12, 2025 23:11
Avoid flex_attention for RPE as it is unclear there is a correct implementation possible given the
limitations of the create_block_mask re conditionals.

Instead we use the manual torch implementation that is known to be correct.

As we update the test and the extend_attention_rpe to use a static max_rpe_context_length,
a new error appears that suggests some issue with the indexing in extend_attention_rpe.

Repro:
```
pytest tests/kernel/wave/attention/extend_attention_test.py --run-e2e -v -k "rpe"
```

Errors out with:
```
E               Diagnostics:
E               <stdin>:282:18: error: 'vector.gather' op operand iree-org#2 must be vector of integer or index values, but got 'index'
E                         %468 = "vector.gather"(%109, %39, %39, %467, %44) : (memref<?xf32, strided<[1], offset: ?>>, index, index, vector<4xi1>, vector<4xf32>) -> vector<4xf32>
E                                ^
```

Signed-off-by: Nicolas Vasilache <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants