8000 '>>' operator broken on MPS with uint8, pytorch 2.5.1 and nightlies · Issue #144190 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content
'>>' operator broken on MPS with uint8, pytorch 2.5.1 and nightlies #144190
@Vargol

Description

@Vargol

🐛 Describe the bug

rshift is not working on MPS for unit8, it gives the wrong result. It works for int32, uint8 is used throughout GGUF for quantisation which is getting more and more important.

>>> import torch
>>> x = torch.Tensor([255]).to(torch.uint8)
>>> print (x)
tensor([255], dtype=torch.uint8)
>>> x >> 4
tensor([15], dtype=torch.uint8)
>>> 
>>> print (x)
tensor([255], dtype=torch.uint8)
>>> y = x.to('mps')
>>> print (y)
tensor([255], device='mps:0', dtype=torch.uint8)
>>> 
>>> y >> 4
tensor([255], device='mps:0', dtype=torch.uint8)

Note int32 works

x = torch.Tensor([255]).to(torch.int32)
y = x.to('mps')
y >> 4
tensor([15], device='mps:0', dtype=torch.int32)

Versions

Collecting environment information...
PyTorch version: 2.6.0.dev20241226
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 15.2 (arm64)
GCC version: Could not collect
Clang version: 16.0.0 (clang-1600.0.26.6)
CMake version: version 3.29.5
Libc version: N/A

Python version: 3.11.10 (main, Sep 7 2024, 08:05:54) [Clang 16.0.0 (clang-1600.0.26.3)] (64-bit runtime)
Python platform: macOS-15.2-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M3

Versions of relevant libraries:
[pip3] numpy==2.1.2
[pip3] torch==2.6.0.dev20241226
[pip3] torchao==0.7.0
[pip3] torchvideo==0.0.0
[pip3] torchvision==0.22.0.dev20241226
[conda] Could not collect

cc @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen

Metadata

Metadata

Assignees

Labels

module: correctness (silent)issue that returns an incorrect result silentlymodule: mpsRelated to Apple Metal Performance Shaders frameworktriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0