Fix Metal API validation for empty concat (#1183)

This commit is contained in:
Awni Hannun
2024-06-04 13:17:08 -07:00
committed by GitHub
parent 375a8bbdcc
commit 83b11bc58d
2 changed files with 10 additions and 3 deletions

View File

@@ -33,9 +33,6 @@ void copy_gpu(const array& in, array& out, CopyType ctype, const Stream& s) {
} else {
out.set_data(allocator::malloc_or_wait(out.nbytes()));
}
if (out.size() == 0) {
return;
}
if (ctype == CopyType::GeneralGeneral) {
ctype = CopyType::General;
}
@@ -57,6 +54,10 @@ void copy_gpu_inplace(
int64_t out_offset,
CopyType ctype,
const Stream& s) {
if (out.size() == 0) {
return;
}
// Try to collapse contiguous dims
auto [shape, strides] = collapse_contiguous_dims(
data_shape, std::vector{strides_in_pre, strides_out_pre});