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

Commit 59a1eee

Browse files
authored
fixing no output vals (#9)
don't pass output buffer if no return value; adding some debug helpers
1 parent aeb99ce commit 59a1eee

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed

src/Creator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
#include <mlir/Dialect/Tensor/IR/Tensor.h>
1919
#include <mlir/IR/Builders.h>
2020

21+
static const char *FORCE_DIST = getenv("DDPT_FORCE_DIST");
22+
2123
inline uint64_t mkTeam(uint64_t team) {
22-
if (team && getTransceiver()->nranks() > 1) {
24+
if (team && (FORCE_DIST || getTransceiver()->nranks() > 1)) {
2325
return 1;
2426
}
2527
return 0;

src/Deferred.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ void process_promises() {
9999
// Create the jit func
100100
// create dummy type, we'll replace it with the actual type later
101101
auto dummyFuncType = builder.getFunctionType({}, {});
102+
if (false) {
103+
::mlir::OpBuilder::InsertionGuard guard(builder);
104+
// Insert before module terminator.
105+
builder.setInsertionPoint(module.getBody(),
106+
std::prev(module.getBody()->end()));
107+
auto func = builder.create<::mlir::func::FuncOp>(loc, "_debugFunc",
108+
dummyFuncType);
109+
func.setPrivate();
110+
}
102111
std::string fname("ddpt_jit");
103112
auto function =
104113
builder.create<::mlir::func::FuncOp>(loc, fname, dummyFuncType);

src/idtr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,5 @@ void _idtr_extractslice(int64_t *slcOffs, int64_t *slcSizes,
422422
<< std::endl;
423423
}
424424

425+
void _debugFunc() { std::cerr << "_debugfunc\n"; }
425426
} // extern "C"

src/include/ddptensor/tensor_i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TensorMeta {
4343
// @ return team, 0 means non-distributed
4444
int team() const { return _team; }
4545

46-
/// @return rank (number of dims) of future tensor
46+
/// @return if future tensor will have balanced partitions
4747
int balanced() const { return _balanced; }
4848

4949
void set_guid(id_type guid) { _guid = guid; }

src/jit/mlir.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ std::vector<intptr_t> JIT::run(::mlir::ModuleOp &module,
375375
std::vector<intptr_t> out(osz);
376376
auto tmp = out.data();
377377
// first arg must be the result ptr
378-
args.push_back(&tmp);
378+
if (osz) {
379+
args.push_back(&tmp);
380+
}
379381
// we need a void*& for every input tensor
380382
// we refer directly to the storage in inp
381383
for (auto &arg : inp) {

test/stencil-2d.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def main():
144144
W[r + j, r + j] = +1.0 / (4 * j * r)
145145
W[r - j, r - j] = -1.0 / (4 * j * r)
146146

147-
# A = np.empty((n, n), dtype=np.float64)
148147
A = np.numpy.fromfunction(lambda i, j: i + j, (n, n), dtype=np.float64)
149148

150149
for k in range(iterations + 1):

0 commit comments

Comments
 (0)