Skip to content

Commit

Permalink
Fix a bug where creating a TFRT buffer may access an unset byte_strid…
Browse files Browse the repository at this point in the history
…es object when the layout is packed.

PiperOrigin-RevId: 714992134
  • Loading branch information
Google-ML-Automation committed Jan 13, 2025
1 parent 8d06f36 commit 135717d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xla/pjrt/cpu/abstract_tfrt_cpu_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,9 @@ AbstractTfrtCpuBuffer::BufferFromHostBufferHelper(
options.elem_size_in_bytes = primitive_util::ByteWidth(type);
options.dims = dims;
options.permutation = permutation;
options.input_layout = TransposePlan::Striding{*byte_strides};
if (byte_strides) {
options.input_layout = TransposePlan::Striding{*byte_strides};
}
absl::MutexLock lock(transpose_mu);
TF_ASSIGN_OR_RETURN(transpose, transpose_cache->GetOrCreate(options));
}
Expand Down

0 comments on commit 135717d

Please sign in to comment.