Skip to content

Commit 4d4e633

Browse files
committed
refactor: remove unused runtime convenience APIs
1 parent f565b1c commit 4d4e633

24 files changed

Lines changed: 10 additions & 1039 deletions

‎csrc/pybind11/runtime/analyzer.hpp‎

Lines changed: 0 additions & 55 deletions
This file was deleted.

‎csrc/pybind11/runtime/bindings.cc‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,20 @@
44
#include "runtime/utils.hpp"
55
#include "context.hpp"
66
#include "device.hpp"
7-
#include "device_event.hpp"
87
#include "dtype.hpp"
9-
#include "graph.hpp"
10-
#include "io.hpp"
11-
#include "ops.hpp"
8+
#include "ops/add.hpp"
9+
#include "ops/cat.hpp"
1210
#include "tensor.hpp"
1311

14-
#ifdef ENABLE_MUTUAL_AWARENESS
15-
#include "analyzer.hpp"
16-
#endif
17-
1812
namespace infinilm::runtime {
1913

2014
void bind_runtime(pybind11::module_ &m) {
2115
context::bind(m);
2216
device::bind(m);
23-
device_event::bind(m);
2417
dtype::bind(m);
25-
ops::bind(m);
18+
ops::bind_add(m);
19+
ops::bind_cat(m);
2620
tensor::bind(m);
27-
io::bind(m);
28-
::infinilm::execution::graph::bind(m);
29-
30-
#ifdef ENABLE_MUTUAL_AWARENESS
31-
::infinilm::execution::trace::pybind::bind(m);
32-
#endif
3321
}
3422

3523
} // namespace infinilm::runtime

‎csrc/pybind11/runtime/device_event.hpp‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎csrc/pybind11/runtime/graph.hpp‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎csrc/pybind11/runtime/io.hpp‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎csrc/pybind11/runtime/ops.hpp‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎csrc/pybind11/runtime/ops/add.hpp‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ inline void bind_add(py::module &m) {
2828
py::arg("b"),
2929
R"doc(Addition of two tensors.)doc");
3030

31-
m.def("add_",
32-
[](Tensor c, const Tensor &a, const Tensor &b) {
33-
{
34-
if (!c) throw std::invalid_argument("Add output is null");
35-
auto owner = c->allocation_owner();
36-
if (!owner || owner->device() != c->device()) owner = context::resolveRuntime(c->device());
37-
auto &ops_runtime = *owner;
38-
infinilm::execution::submit<infini::ops::Add>(
39-
ops_runtime, infini::ops::Add::DefaultConfig(ops_runtime.device().type()), a, b, c);
40-
INFINILM_TRACE_OP(Add, c);
41-
}
42-
},
43-
py::arg("c"),
44-
py::arg("a"),
45-
py::arg("b"),
46-
R"doc(In-place tensor addition.)doc");
4731
}
4832

4933
} // namespace infinilm::runtime::ops

‎csrc/pybind11/runtime/ops/cat.hpp‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,6 @@ inline void bind_cat(py::module &m) {
4040
py::arg("dim") = 0,
4141
R"doc(opertor: torch.cat, out-of-place mode)doc");
4242

43-
m.def("cat_",
44-
[](Tensor out, std::vector<Tensor> tensors, int dim) {
45-
if (!out) throw std::invalid_argument("Cat output is null");
46-
auto owner = out->allocation_owner();
47-
if (!owner || owner->device() != out->device()) owner = context::resolveRuntime(out->device());
48-
auto &runtime = *owner;
49-
const auto rank = out->ndim();
50-
if (!rank || dim < -static_cast<int64_t>(rank) || dim >= static_cast<int64_t>(rank))
51-
throw std::invalid_argument("Cat dimension is outside the output rank");
52-
const auto axis = static_cast<size_t>(dim < 0 ? dim + static_cast<int64_t>(rank) : dim);
53-
infinilm::execution::tensor_checks::cat::validate(runtime, out, tensors, {nullptr, axis, 0});
54-
tensors.erase(std::remove_if(tensors.begin(), tensors.end(),
55-
infinilm::execution::tensor_checks::cat::empty_vector), tensors.end());
56-
if (out->numel()) {
57-
infinilm::execution::submit<infini::ops::Cat>(runtime,
58-
infini::ops::Cat::DefaultConfig(runtime.device().type()),
59-
tensors, static_cast<int64_t>(axis), out);
60-
}
61-
},
62-
py::arg("out"),
63-
py::arg("tensors"),
64-
py::arg("dim") = 0,
65-
R"doc(opertor: torch.cat, in-place mode)doc");
6643
}
6744

6845
} // namespace infinilm::runtime::ops

‎csrc/pybind11/runtime/ops/matmul.hpp‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎csrc/pybind11/runtime/tensor.hpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ inline void bind(py::module &m) {
4444
.def("is_pinned", [](const Tensor &tensor) { return tensor->is_pinned(); })
4545
.def("info", [](const Tensor &tensor) { return tensor->info(); })
4646

47-
.def("debug", [](const Tensor &tensor) { return tensor->debug(); })
48-
.def("debug", [](const Tensor &tensor, const std::string &filename) { return tensor->debug(filename); })
49-
5047
.def("copy_", [](Tensor &tensor, const Tensor &other) { tensor->copy_from(other); })
5148
.def("to", [](const Tensor &tensor, const Device &device) { return tensor->to(device); })
5249
.def("contiguous", [](const Tensor &tensor) { return tensor->contiguous(); })

0 commit comments

Comments
 (0)