Skip to content

feat: Add MLXFast.fromFp8 bindings#12

Open
solderzzc wants to merge 2 commits intomainfrom
feat/add-fp8-fast
Open

feat: Add MLXFast.fromFp8 bindings#12
solderzzc wants to merge 2 commits intomainfrom
feat/add-fp8-fast

Conversation

@solderzzc
Copy link
Copy Markdown
Member

Expose fromFp8 for Qwen35 FP8 inference natively.

Copilot AI review requested due to automatic review settings May 7, 2026 06:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Swift binding for MLX’s FP8 (E4M3) → floating-point conversion to support FP8-weight inference workflows, and adjusts an upstream sync workflow to try to preserve local GitHub Actions workflows during sync.

Changes:

  • Add MLXFast.fromFp8(_:, dtype:, stream:) wrapper around mlx_from_fp8.
  • Update .github/workflows/upstream-sync.yml sync-branch creation logic to base on origin/main, overlay upstream/main, and restore .github/workflows from origin/main.
  • Switch GitHub CLI auth env var from GITHUB_TOKEN to GH_TOKEN for PR creation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Source/MLX/MLXFast.swift Exposes mlx_from_fp8 as MLXFast.fromFp8 with API docs.
.github/workflows/upstream-sync.yml Changes upstream sync procedure and PR creation token env var.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

git reset --hard upstream/main
git checkout -B sync/upstream-latest origin/main
git checkout upstream/main -- .
git checkout origin/main -- .github/workflows
Comment on lines 41 to 43
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Comment thread Source/MLX/MLXFast.swift
/// - Returns: Array in the requested dtype with correctly converted FP8 values
public static func fromFp8(
_ x: MLXArray, dtype: DType = .bfloat16, stream: StreamOrDevice = .default
) -> MLXArray {
Comment thread Source/MLX/MLXFast.swift
Comment on lines +434 to +439
public static func fromFp8(
_ x: MLXArray, dtype: DType = .bfloat16, stream: StreamOrDevice = .default
) -> MLXArray {
var result = mlx_array_new()
mlx_from_fp8(&result, x.ctx, dtype.cmlxDtype, stream.ctx)
return MLXArray(result)
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