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
2 changes: 1 addition & 1 deletion include/tvm/arith/bound.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ IntSet DeduceBound(PrimExpr v, PrimExpr cond,
* \param consider_stores If stores are considered.
* \return The domain that covers all the calls or provides within the given statement.
*/
Region DomainTouched(const Stmt& body, const tirx::Buffer& buffer, bool consider_loads,
Region DomainTouched(const Stmt& body, const tirx::BufferVar& buffer, bool consider_loads,
bool consider_stores);

} // namespace arith
Expand Down
12 changes: 6 additions & 6 deletions include/tvm/relax/distributed/axis_group_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace tirx {
// (var, axis)
using TIRVarAxis = std::pair<Var, int>;
// (buffer, axis)
using BufferAxis = std::pair<Buffer, int>;
using BufferAxis = std::pair<BufferVar, int>;
class BufferAxisHash {
public:
size_t operator()(const BufferAxis& buffer_axis) const {
Expand Down Expand Up @@ -70,15 +70,15 @@ class BufferAxisGraphExtractor : public StmtExprVisitor {
static std::vector<std::vector<TIRVarAxis>> GetTIRVarAxisGraph(const PrimFunc& prim_func) {
BufferAxisGraphExtractor extractor;
extractor(prim_func->body);
ffi::Map<Buffer, Var> inverse_buffer_map;
ffi::Map<BufferVar, Var> inverse_buffer_map;
for (const auto& pr : prim_func->buffer_map) {
inverse_buffer_map.Set(pr.second, pr.first);
}
std::vector<std::vector<TIRVarAxis>> tir_var_axis_group_list;
std::unordered_set<BufferAxis, BufferAxisHash> visited;
for (const auto& pr : prim_func->buffer_map) {
Var param = pr.first;
Buffer buffer = pr.second;
BufferVar buffer = pr.second;
for (int i = 0; i < static_cast<int>(buffer->shape.size()); i++) {
if (extractor.buffer_axis_graph_.count({buffer, i})) {
std::vector<BufferAxis> buffer_axis_group;
Expand Down Expand Up @@ -163,14 +163,14 @@ class BufferAxisGraphExtractor : public StmtExprVisitor {
}
arith::Analyzer analyzer;
for (const auto& access_pr : buffer_access_indices_) {
Buffer buffer = access_pr.first;
BufferVar buffer = access_pr.first;
ffi::Array<PrimExpr> indices = access_pr.second;
for (int i = 0; i < static_cast<int>(indices.size()); i++) {
for (const auto& another_access_pr : buffer_access_indices_) {
if (another_access_pr.first.same_as(buffer)) {
continue;
}
Buffer another_buffer = another_access_pr.first;
BufferVar another_buffer = another_access_pr.first;
ffi::Array<PrimExpr> another_indices = another_access_pr.second;
for (int j = 0; j < static_cast<int>(another_indices.size()); j++) {
if (Match(indices[i], buffer->shape[i], another_indices[j], another_buffer->shape[j],
Expand All @@ -194,7 +194,7 @@ class BufferAxisGraphExtractor : public StmtExprVisitor {
buffer_axis_graph_[axis2].push_back(axis1);
}

std::vector<std::pair<Buffer, ffi::Array<PrimExpr>>> buffer_access_indices_;
std::vector<std::pair<BufferVar, ffi::Array<PrimExpr>>> buffer_access_indices_;
std::unordered_map<BufferAxis, std::vector<BufferAxis>, BufferAxisHash> buffer_axis_graph_;
ffi::Map<Var, Range> iter_var_range_;
std::string func_name;
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/relax/tir_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MatchResultNode : public ffi::Object {
/*! \brief The evaluated values of symbolic vars. */
ffi::Array<PrimExpr> symbol_values;
/*! \brief The matched buffers of input and output. */
ffi::Array<tirx::Buffer> matched_buffers;
ffi::Array<tirx::BufferVar> matched_buffers;

static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
Expand All @@ -67,7 +67,7 @@ class MatchResult : public ffi::ObjectRef {
* \param matched_buffers The matched buffers of input and output.
*/
TVM_DLL explicit MatchResult(TIRPattern pattern, ffi::Array<PrimExpr> symbol_values,
ffi::Array<tirx::Buffer> matched_buffers);
ffi::Array<tirx::BufferVar> matched_buffers);

TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(MatchResult, ffi::ObjectRef, MatchResultNode);
};
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/s_tir/analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace tirx {
* - third: opaque regions
*/
TVM_DLL ffi::Array<ffi::Array<BufferRegion>> GetSBlockAccessRegion(
const SBlock& block, const ffi::Map<Var, Buffer>& buffer_var_map);
const SBlock& block, const ffi::Map<Var, BufferVar>& buffer_var_map);

/*!
* \brief Auto detect the block read/write region according to its body stmt. An opaque access will
Expand All @@ -59,7 +59,7 @@ TVM_DLL ffi::Array<ffi::Array<BufferRegion>> GetSBlockAccessRegion(
* \return An array only consisting of the read regions and write regions of the input block
*/
TVM_DLL ffi::Array<ffi::Array<BufferRegion>> GetSBlockReadWriteRegion(
const SBlock& block, const ffi::Map<Var, Buffer>& buffer_var_map);
const SBlock& block, const ffi::Map<Var, BufferVar>& buffer_var_map);

/*!
* \brief Detect the lowest common ancestor(LCA) of buffer access, including both high-level
Expand All @@ -69,7 +69,7 @@ TVM_DLL ffi::Array<ffi::Array<BufferRegion>> GetSBlockReadWriteRegion(
* \return The Map from buffer to the LCA of all access to it. The lca is function root if the
* return stmt is std::nullopt.
*/
TVM_DLL ffi::Map<Buffer, ffi::Optional<Stmt>> DetectBufferAccessLCA(const PrimFunc& func);
TVM_DLL ffi::Map<BufferVar, ffi::Optional<Stmt>> DetectBufferAccessLCA(const PrimFunc& func);

/*!
* \brief Find the "anchor block" of the given module.
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/s_tir/sblock_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class SBlockScopeNode : public ffi::Object {
std::unordered_map<StmtSRef, ffi::Array<Dependency>, ffi::ObjectPtrHash, ffi::ObjectPtrEqual>
dst2deps;
/*! \brief The mapping from the buffer to the blocks who write it */
std::unordered_map<Buffer, ffi::Array<StmtSRef>, ffi::ObjectPtrHash, ffi::ObjectPtrEqual>
std::unordered_map<BufferVar, ffi::Array<StmtSRef>, ffi::ObjectPtrHash, ffi::ObjectPtrEqual>
buffer_writers;

static void RegisterReflection() {
Expand Down
8 changes: 4 additions & 4 deletions include/tvm/te/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ class ExternOpNode : public OperationNode {
/*! \brief The input tensors */
ffi::Array<Tensor> inputs;
/*! \brief Symbolic placeholder representation of inputs */
ffi::Array<Buffer> input_placeholders;
ffi::Array<BufferVar> input_placeholders;
/*! \brief Symbolic placeholder representation of outputs */
ffi::Array<Buffer> output_placeholders;
ffi::Array<BufferVar> output_placeholders;
/*! \brief the statement that generates the computation. */
Stmt body;

Expand Down Expand Up @@ -289,8 +289,8 @@ class ExternOpNode : public OperationNode {
class ExternOp : public Operation {
public:
TVM_DLL ExternOp(std::string name, std::string tag, ffi::Map<ffi::String, ffi::Any> attrs,
ffi::Array<Tensor> inputs, ffi::Array<Buffer> input_placeholders,
ffi::Array<Buffer> output_placeholders, Stmt body);
ffi::Array<Tensor> inputs, ffi::Array<BufferVar> input_placeholders,
ffi::Array<BufferVar> output_placeholders, Stmt body);

TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(ExternOp, Operation, ExternOpNode);
};
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/tirx/async_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PipelineNode : public ffi::Object {
ffi::String name_hint;

/*! \brief The workspace of the pipeline. */
ffi::Map<ffi::String, tvm::tirx::Buffer> workspace;
ffi::Map<ffi::String, tvm::tirx::BufferVar> workspace;
/*! \brief The schedule config of the pipeline. */
ffi::Map<ffi::String, ffi::Any> schedule_config;

Expand All @@ -68,7 +68,7 @@ class Pipeline : public ffi::ObjectRef {
public:
TVM_DLL explicit Pipeline(ExecScope thread_scope, size_t depth = 0, bool separate_pc = false,
ffi::String name_hint = "",
ffi::Map<ffi::String, tvm::tirx::Buffer> workspace = {},
ffi::Map<ffi::String, tvm::tirx::BufferVar> workspace = {},
ffi::Map<ffi::String, ffi::Any> schedule_config = {});

TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Pipeline, ffi::ObjectRef, PipelineNode);
Expand All @@ -90,7 +90,7 @@ class CopyPipeline : public Pipeline {
public:
TVM_DLL explicit CopyPipeline(ExecScope thread_scope, size_t depth = 0, bool separate_pc = false,
ffi::String name_hint = "",
ffi::Map<ffi::String, tvm::tirx::Buffer> workspace = {},
ffi::Map<ffi::String, tvm::tirx::BufferVar> workspace = {},
ffi::Map<ffi::String, ffi::Any> schedule_config = {});

TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(CopyPipeline, Pipeline, CopyPipelineNode);
Expand Down
Loading
Loading