Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metal: Failed Assertion / Crash when trying to create arrays in double-precision #16435

Open
johnjmolina opened this issue Jun 15, 2023 · 8 comments
Assignees
Labels
Apple GPU (Metal) plugin bug Something isn't working

Comments

@johnjmolina
Copy link

Description

There seems to be an issue with casting for the edge case of size zero arrays.

from jax import config
config.update("jax_enable_x64", True)
import jax.numpy as jnp
import numpy as np

jnp.array([1.0])           # OK : Array([1.], dtype=float64)
jnp.array(np.double(1.0))  # OK : Array(1., dtype=float64)
jnp.array(jnp.double(1.0)) # Crash
jnp.array(1.0)             # Crash  

The last two commands will crash the kernel

Metal device set to: Apple M1

systemMemory: 16.00 GB
maxCacheSize: 5.33 GB

/AppleInternal/Library/BuildRoots/c2cb9645-dafc-11ed-aa26-6ec1e3b3f7b3/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:1377: failed assertion `Incompatible element type for parameter at index 0, mlir module expected element type f64 but received f32'

What jax/jaxlib version are you using?

jax 0.4.11, jaxlib 0.4.10, jax-metal 0.0.2

Which accelerator(s) are you using?

Apple GPU

Additional system info

No response

NVIDIA GPU info

No response

@johnjmolina johnjmolina added the bug Something isn't working label Jun 15, 2023
@jakevdp
Copy link
Collaborator

jakevdp commented Jun 15, 2023

Just to confirm, this is on the Apple metal backend, yes? (All of this should work fine on non-experimental backends)

@hawkinsp
Copy link
Collaborator

I think the Metal plugin simply doesn't support f64, but it should report it more gracefully.

@kulinseth
Copy link
Collaborator

@hawkinsp , that's right. Metal doesn't have FP64 support, we will add support to fail more gracefully.

@kulinseth
Copy link
Collaborator

@johnjmolina , this issue is not related to Empty shapes. We don't have support for FP64 and we will add error-checks early to exit gracefully.

@hawkinsp hawkinsp changed the title Failed Assertion / Crash when trying to create size 0 arrays in double-precision Failed Assertion / Crash when trying to create arrays in double-precision Jun 15, 2023
@johnjmolina
Copy link
Author

Thanks for the prompt reply, I understand the issue now.

@johannahaffner
Copy link

@hawkinsp , that's right. Metal doesn't have FP64 support, we will add support to fail more gracefully.

Are you planning on adding FP64 support? I would be really keen on that.

@jakevdp jakevdp changed the title Failed Assertion / Crash when trying to create arrays in double-precision Metal: Failed Assertion / Crash when trying to create arrays in double-precision Mar 17, 2024
@shuhand0
Copy link
Collaborator

While we are looking into the issue, FP64 support will NOT be there for sometime.

@johannahaffner
Copy link

@shuhand0 thank you for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apple GPU (Metal) plugin bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants