Skip to content

Commit

Permalink
Fix bad cast in tpu_ext.cc
Browse files Browse the repository at this point in the history
The argument to the cast value is of type ssize_t. Mismatch between int64_t and ssize_t happens in Mac and causes build to fail:
`error: const_cast from 'const pybind11::ssize_t *' (aka 'const long *') to 'int64_t *' (aka 'long long *') is not allowed`

PiperOrigin-RevId: 584451928
  • Loading branch information
tlongeri authored and jax authors committed Nov 21, 2023
1 parent 5c03dbc commit 1c4ae9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jaxlib/mlir/_mlir_libs/tpu_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ PYBIND11_MODULE(_tpu_ext, m) {
if constexpr (std::is_same_v<ssize_t, int64_t>) {
// TODO(tlongeri): Find a way to avoid the const_cast
return mlirTpuAssemble(getDefaultInsertionPoint(), ty, layout,
{{const_cast<int64_t*>(np_arr.shape()),
{{const_cast<ssize_t*>(np_arr.shape()),
static_cast<size_t>(np_arr.ndim())},
vals.data()},
TARGET_SHAPE);
Expand Down

0 comments on commit 1c4ae9a

Please sign in to comment.