2025-02-03 15:58:02 -08:00
|
|
|
// Copyright © 2023-2024 Apple Inc.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-03-06 19:23:38 -08:00
|
|
|
#include <optional>
|
|
|
|
|
|
2025-02-03 15:58:02 -08:00
|
|
|
#include "mlx/array.h"
|
|
|
|
|
#include "mlx/backend/common/copy.h"
|
|
|
|
|
#include "mlx/backend/common/utils.h"
|
|
|
|
|
|
|
|
|
|
namespace mlx::core {
|
|
|
|
|
|
2025-07-16 23:34:24 +09:00
|
|
|
void copy_cpu(const array& src, array& dst, CopyType ctype, Stream stream);
|
|
|
|
|
void copy_cpu_inplace(
|
|
|
|
|
const array& src,
|
|
|
|
|
array& dst,
|
|
|
|
|
CopyType ctype,
|
|
|
|
|
Stream stream);
|
2025-02-03 15:58:02 -08:00
|
|
|
|
2025-07-16 23:34:24 +09:00
|
|
|
void copy_cpu_inplace(
|
2025-02-03 15:58:02 -08:00
|
|
|
const array& src,
|
|
|
|
|
array& dst,
|
|
|
|
|
const Shape& data_shape,
|
|
|
|
|
const Strides& i_strides,
|
|
|
|
|
const Strides& o_strides,
|
|
|
|
|
int64_t i_offset,
|
|
|
|
|
int64_t o_offset,
|
2025-03-06 19:23:38 -08:00
|
|
|
CopyType ctype,
|
|
|
|
|
Stream stream,
|
|
|
|
|
const std::optional<array>& dynamic_i_offset = std::nullopt,
|
|
|
|
|
const std::optional<array>& dynamic_o_offset = std::nullopt);
|
2025-02-03 15:58:02 -08:00
|
|
|
|
2025-07-21 23:30:35 +09:00
|
|
|
// Return a contiguous array with same shape that copies the data of |arr|.
|
|
|
|
|
array contiguous_copy_cpu(const array& arr, Stream stream);
|
|
|
|
|
|
2025-02-03 15:58:02 -08:00
|
|
|
} // namespace mlx::core
|