Skip to content

[don't merge] port flash-attn-ops using the porting tool - #1100

Closed
sayakpaul wants to merge 2 commits into
mainfrom
flash-ops-port
Closed

sayakpaul wants to merge 2 commits into
mainfrom
flash-ops-port

Conversation

@sayakpaul

Copy link
Copy Markdown
Member

Similar to #1092.

@github-actions github-actions Bot added the chore Version bumps, releases, misc maintenance label Aug 25, 2026
# The models we train have hidden dim up to 8k anyway (e.g. Llama 70B), so this is fine.

import math
from typing import List, Optional

@sayakpaul sayakpaul Aug 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Quite a bit of rewrite going on in this file with the porting tool. Some of them are formatting-related, though.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yea I think we must have ran a formatter and made some small changes manually in the past. its kinda nice that this surfaced those divergence

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But I would argue that it makes it difficult to catch the actual changes significantly more, especially on the existing kernels that we maintain in kernels-community. It becomes difficult to validate if those changes are purely formatting or if we should validate them with additional testing.

sayakpaul and others added 2 commits August 25, 2026 09:35
The repo ignores all dotfiles (`.*`), which silently swallows `.ports/`
recipes and the generated `.port-provenance.json`. Negate both so a new
port directory is visible to git rather than quietly dropped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dresidual.reshape(-1, dresidual.shape[-1])
)
dresidual = maybe_contiguous_lastdim(dresidual.reshape(-1, dresidual.shape[-1]))
assert dresidual.shape == x.shape

@sayakpaul sayakpaul Aug 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one seems out of the ordinary.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we must have run some formatter at some point since I think the changed version is what matches upstream on the pinned commit https://github.com/Dao-AILab/flash-attention/blob/b02b07e1a10238fe12831b80a8937ed59b1353a5/flash_attn/ops/triton/layer_norm.py#L1196

torch.cuda.get_device_properties(torch.cuda.current_device()),
"warp_size",
32,
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removes duplicate. So, that is a nice side-effect!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@drbh

drbh commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

this was a great exploration and its nice that it uncovered some divergences with upstream! its a good argument for us to use the tool on flash-ops once stabilized (the only thing this PR would need to change is the location of the port folder) - so we can either close this PR and reopen or make those changes to this PR

@sayakpaul sayakpaul closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Version bumps, releases, misc maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants