Metal backend: support 4-bit linear#17117
Open
manuelcandales wants to merge 5 commits intogh/manuelcandales/153/headfrom
Open
Metal backend: support 4-bit linear#17117manuelcandales wants to merge 5 commits intogh/manuelcandales/153/headfrom
manuelcandales wants to merge 5 commits intogh/manuelcandales/153/headfrom
Conversation
Contributor
Author
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17117
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 1 Unrelated FailureAs of commit c5a3c1a with merge base ba6de95 ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Feb 2, 2026
This was referenced Feb 4, 2026
mergennachin
reviewed
Feb 4, 2026
Comment on lines
+33
to
+50
| # Function to update and build torchao | ||
| update_and_build_torchao() { | ||
| echo "Building torchao..." | ||
| TORCHAO_DIR="$EXECUTORCH_ROOT/third-party/ao" | ||
| if [[ -d "$TORCHAO_DIR" ]]; then | ||
| cd "$TORCHAO_DIR" | ||
| echo "Pulling latest changes from ao repository..." | ||
| git checkout main | ||
| git pull origin main | ||
| USE_CPP=1 TORCHAO_BUILD_EXPERIMENTAL_MPS=1 pip install . --no-build-isolation | ||
| cd "$EXECUTORCH_ROOT" | ||
| echo "torchao build complete" | ||
| else | ||
| echo "Error: torchao directory not found at $TORCHAO_DIR" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
No need for this. Just upgrade the pin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for 4-bit quantized linear in the Metal backend
Dtype support improvements:
uint8dtype (PyTorch dtype code 0) in the AOTInductor shims, including new functionaoti_torch_dtype_uint8()and updates to dtype conversion utilities and supported dtype checks. (backends/aoti/common_shims.cpp,backends/aoti/common_shims.h,backends/aoti/utils.h,backends/apple/metal/runtime/shims/utils.cpp,backends/apple/metal/runtime/shims/utils.h) [1] [2] [3] [4] [5] [6]Metal backend kernel and operator integration:
torchao::_linear_fp_act_4bit_weightoperator as a supported fallback kernel and added its C shim signature for the Metal backend. (backends/apple/metal/metal_backend.py,backends/apple/metal/runtime/shims/et_metal_ops.h) [1] [2]Build and logging enhancements:
backends/apple/metal/metal_backend.py,backends/apple/metal/runtime/metal_backend.cpp) [1] [2] [3]