Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions enzyme/Enzyme/CApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,18 @@ void EnzymeTypeTreeInsertEq(CTypeTreeRef CTT, const int64_t *indices,
}
((TypeTree *)CTT)->insert(seq, eunwrap(ct, *unwrap(ctx)));
}
void EnzymeTypeTreeInsertRangeEq(CTypeTreeRef CTT, const int64_t *indices,
size_t len, size_t rangePos, int64_t stride,
int64_t count, CConcreteType ct,
LLVMContextRef ctx) {
std::vector<int> seq;
for (size_t i = 0; i < len; i++) {
seq.push_back(indices[i]);
}
((TypeTree *)CTT)
->insertRange(seq, rangePos, (int)stride, (int)count,
eunwrap(ct, *unwrap(ctx)));
}
const char *EnzymeTypeTreeToString(CTypeTreeRef src) {
std::string tmp = ((TypeTree *)src)->str();
char *cstr = new char[tmp.length() + 1];
Expand Down
6 changes: 6 additions & 0 deletions enzyme/Enzyme/CApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ void EnzymeTypeTreeShiftIndiciesEq(CTypeTreeRef dst, const char *datalayout,
uint64_t addOffset);
void EnzymeTypeTreeInsertEq(CTypeTreeRef dst, const int64_t *indices,
size_t len, CConcreteType ct, LLVMContextRef ctx);
/// Insert a compact strided range. `indices[rangePos]` is the start offset;
/// the range covers start + k*stride for k in 0..count.
void EnzymeTypeTreeInsertRangeEq(CTypeTreeRef dst, const int64_t *indices,
size_t len, size_t rangePos, int64_t stride,
int64_t count, CConcreteType ct,
LLVMContextRef ctx);
const char *EnzymeTypeTreeToString(CTypeTreeRef src);
void EnzymeTypeTreeToStringFree(const char *cstr);

Expand Down
Loading
Loading