Skip to content

Interface with new Metal primitives#725

Open
maleadt wants to merge 4 commits into
FluxML:masterfrom
maleadt:metal
Open

Interface with new Metal primitives#725
maleadt wants to merge 4 commits into
FluxML:masterfrom
maleadt:metal

Conversation

@maleadt

@maleadt maleadt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@maleadt

maleadt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

I did wonder about moving this into Metal.jl though. The MPS/MPSGraph interfaces used by the extension aren't exactly stable, while the NNlib ones presumably are? Although looking at e.g. #718 it seems like the interfaces are changing here too, so not sure what's best.

@CarloLucibello

CarloLucibello commented Jun 22, 2026

Copy link
Copy Markdown
Member

You can consider the current interface of NNlib stable. The only deprecation planned is for dot_product_attention, which will be replaced by a new method that doesn't returns the weight along the output (so that we can support flash attention).

I think having these methods here nicely parallels the CUDA/cuDNN/NNlib interaction, so I think it is very reasonable.

Buildkite tests are failing...

@maleadt

maleadt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Yes, Metal.jl hasn't been released with these changes yet. But I wanted to put up the PR already.

@maleadt

maleadt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

You can consider the current interface of NNlib stable.

Then I think we should consider moving the extensions into the GPU back-ends, no? The code they call is far less stable than the NNlib interfaces (e.g. the low-level cuDNN or MPS APIs).

@CarloLucibello

Copy link
Copy Markdown
Member

I think the current division, which also this PR follows, is fine. The dispatch structure of NNlib's methods can be understood by just looking at NNlib's repo.

@CarloLucibello

Copy link
Copy Markdown
Member

tag a Metal.jl release?

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.

2 participants