Skip to content
Merged
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
19 changes: 2 additions & 17 deletions include/tvm/topi/detail/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ namespace detail {

using namespace tvm::te;

/*!
* \brief Construct a buffer to pass to an external function
*
* \param shape The shape of the buffer
* \param dtype The type of the buffer elements
* \param name The name of the buffer
*
* \return The Buffer object
*/
inline Buffer DeclExternBuffer(Array<PrimExpr> shape, DataType dtype, std::string name) {
auto data = var(name, DataType::Handle());
auto elem_offset = PrimExpr();
return Buffer(data, dtype, shape, Array<PrimExpr>(), elem_offset, name, -1, 0, kDefault);
}

/*!
* \brief A function which constructs an Expr representing the invocation of an external
* function. The function expects two arguments: an array of Buffers holding the input
Expand Down Expand Up @@ -84,11 +69,11 @@ inline Array<Tensor> make_extern(const Array<Array<PrimExpr>>& out_shapes,

Array<Buffer> input_placeholders;
for (auto t : inputs) {
input_placeholders.push_back(DeclExternBuffer(t->shape, t->dtype, t->op->name));
input_placeholders.push_back(tvm::tir::decl_buffer(t->shape, t->dtype, t->op->name));
}
Array<Buffer> output_placeholders;
for (size_t i = 0; i < out_shapes.size(); ++i) {
output_placeholders.push_back(DeclExternBuffer(out_shapes[i], out_types[i], name));
output_placeholders.push_back(tvm::tir::decl_buffer(out_shapes[i], out_types[i], name));
}

auto body = fextern(input_placeholders, output_placeholders);
Expand Down