Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 04e2ef9

Browse files
committed
more cleanup
1 parent 9ebe1f9 commit 04e2ef9

File tree

1 file changed

+0
-101
lines changed

1 file changed

+0
-101
lines changed

src/EWBinOp.cpp

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -410,104 +410,3 @@ ddptensor * EWBinOp::op(EWBinOpId op, const ddptensor & a, const py::object & b)
410410
}
411411

412412
FACTORY_INIT(DeferredEWBinOp, F_EWBINOP);
413-
414-
#if 0
415-
416-
template<typename OP, typename A, typename B>
417-
static ptr_type do_split_op(OP && op,
418-
const A & a, const B & b,
419-
const shape_type & gshape, const PVSlice & res_slc,
420-
const Buffer & rbuffa, const Buffer & rbuffb,
421-
uint64_t abuffsz, uint64_t bbuffsz, uint64_t asz,
422-
const std::array<uint64_t, 2> & adispl, const std::array<uint64_t, 2> & bdispl,
423-
const std::array<uint64_t, 5> & regs)
424-
{
425-
return do_split_op_<typename promote<typename A::value_type, typename B::value_type>::type>
426-
(std::move(op), a, b, gshape, res_slc, rbuffa, rbuffb, abuffsz, bbuffsz, asz, adispl, bdispl, regs);
427-
}
428-
429-
template<typename R, typename OP, typename A, typename B>
430-
static ptr_type do_split_op_(OP && op,
431-
const A & a, const B & b,
432-
const shape_type & gshape, const PVSlice & res_slc,
433-
const Buffer & rbuffa, const Buffer & rbuffb,
434-
uint64_t abuffsz, uint64_t bbuffsz, uint64_t asz,
435-
const std::array<uint64_t, 2> & adispl, const std::array<uint64_t, 2> & bdispl,
436-
const std::array<uint64_t, 5> & regs)
437-
{
438-
// allocate result
439-
typename xt::xarray<R>::shape_type shpx = {res_slc.local_size()};
440-
auto res_x = xt::empty<R>(shpx);
441-
442-
if(regs[0]) {
443-
// both from buffer
444-
auto av = xt::adapt(rbuffa, {regs[0]});
445-
auto bv = xt::adapt(rbuffb, {regs[0]});
446-
auto rv = xt::view(res_x, xt::range(_, regs[0]));
447-
rv = op(std::move(av), std::move(bv));
448-
} // else nothing in any buffer prepending local data
449-
uint64_t aoff = 0, boff = 0;
450-
if(regs[1] > regs[0]) {
451-
uint64_t _cnt = regs[1] - regs[0];
452-
if(regs[1] == adispl[1]) {
453-
// b comes from local, a from buffer
454-
const auto _a = reinterpret_cast<const typename A::value_type*>(rbuffa.data()); // raw pointer to buffer data of remote a
455-
auto av = xt::adapt(_a+regs[0], {_cnt});
456-
auto bv = xt::view(xt::reshape_view(b, {b.size()}), xt::range(bdispl[0], bdispl[0] + _cnt));
457-
auto rv = xt::view(res_x, xt::range(regs[0], regs[1]));
458-
rv = op(std::move(av), std::move(bv));
459-
boff = _cnt;
460-
} else {
461-
// a comes from local, b from buffer
462-
const auto _b = reinterpret_cast<const typename B::value_type*>(rbuffb.data()); // raw pointer to buffer data of remote b
463-
auto av = xt::view(xt::reshape_view(a, {a.size()}), xt::range(adispl[0], adispl[0] + _cnt));
464-
auto bv = xt::adapt(_b+regs[0], {_cnt});
465-
auto rv = xt::view(res_x, xt::range(regs[0], regs[1]));
466-
rv = op(std::move(av), std::move(bv));
467-
aoff = _cnt;
468-
}
469-
} // else both buffers have same amount of prepending data
470-
if(regs[2] > regs[1]) {
471-
// both come from local
472-
uint64_t _cnt = regs[2] - regs[1];
473-
auto av = xt::view(xt::reshape_view(a, {a.size()}), xt::range(adispl[0] + aoff, adispl[0] + aoff + _cnt));
474-
auto bv = xt::view(xt::reshape_view(b, {b.size()}), xt::range(bdispl[0] + boff, bdispl[0] + boff + _cnt));
475-
auto rv = xt::view(res_x, xt::range(regs[1], regs[2]));
476-
rv = op(std::move(av), std::move(bv));
477-
aoff += _cnt;
478-
boff += _cnt;
479-
} // else no overlap in local data
480-
if(regs[3] > regs[2]) {
481-
uint64_t _cnt = regs[3] - regs[2];
482-
if(regs[3] == adispl[1] + asz) {
483-
// a from local, b from buffer
484-
const auto _b = reinterpret_cast<const typename B::value_type*>(rbuffb.data()); // raw pointer to buffer data of remote b
485-
auto av = xt::view(xt::reshape_view(a, {a.size()}), xt::range(adispl[0] + aoff, adispl[0] + aoff + _cnt));
486-
auto bv = xt::adapt(_b + bdispl[1], {_cnt});
487-
auto rv = xt::view(res_x, xt::range(regs[2], regs[3]));
488-
rv = op(std::move(av), std::move(bv));
489-
} else {
490-
// b from local, a from buffer
491-
const auto _a = reinterpret_cast<const typename A::value_type*>(rbuffa.data()); // raw pointer to buffer data of remote a
492-
auto av = xt::adapt(_a + adispl[1], {_cnt});
493-
auto bv = xt::view(xt::reshape_view(b, {b.size()}), xt::range(bdispl[0] + boff, bdispl[0] + boff + _cnt));
494-
auto rv = xt::view(res_x, xt::range(regs[2], regs[3]));
495-
rv = op(std::move(av), std::move(bv));
496-
}
497-
} // local data of a an b end equally
498-
if(regs[4] > regs[3]) {
499-
// both from buffer
500-
uint64_t _cnt = regs[4] - regs[3];
501-
const auto _a = reinterpret_cast<const typename A::value_type*>(rbuffa.data()); // raw pointer to buffer data of remote a
502-
const auto _b = reinterpret_cast<const typename B::value_type*>(rbuffb.data()); // raw pointer to buffer data of remote b
503-
auto av = xt::adapt(_a + abuffsz - _cnt, {_cnt});
504-
auto bv = xt::adapt(_b + bbuffsz - _cnt, {_cnt});
505-
auto rv = xt::view(res_x, xt::range(regs[3], regs[4]));
506-
rv = op(std::move(av), std::move(bv));
507-
} // data data after last local
508-
509-
res_x.reshape(res_slc.local_shape());
510-
return operatorx<R>::mk_tx(gshape, res_x);
511-
}
512-
513-
#endif

0 commit comments

Comments
 (0)