Description
Currently, matrix multiplication on TPUs (with float32 dtypes) defaults to bfloat16 multiplication with float32 accumulation. This allows for really fantastic performance for neural nets.
Using higher precision requires explicitly setting it, e.g., jax.numpy.matmul(x, y, precision=jax.lax.Precision.HIGHEST)
. (We could conceivably shorten this by supporting strings, e.g., jax.numpy.matmul(x, y, precision='highest')
)
Is this the right default behavior for functions like jax.numpy.matmul
and the @
matmul operator? Or should we switch precision
to default to full float32 precision, at the price of extra matrix-multiplication passes? This would probably be a little more annoying for neural network users, but it is arguably less surprising, especially for users who are using matrix-multiplication for other uses.