You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/07/06 23:38:36 UTC
[GitHub] [tvm] masahi commented on a change in pull request #8366: [Refactor] Enforce attaching storage scope to PointerType
masahi commented on a change in pull request #8366:
URL: https://github.com/apache/tvm/pull/8366#discussion_r664941694
##########
File path: src/tir/ir/buffer.cc
##########
@@ -45,12 +45,27 @@ Array<PrimExpr> SimplifyArray(arith::Analyzer* ana, Array<PrimExpr> array) {
return array;
}
-Buffer decl_buffer(Array<PrimExpr> shape, DataType dtype, String name, Span span) {
+Buffer decl_buffer(Array<PrimExpr> shape, DataType dtype, String name, String storage_scope,
+ Span span) {
DataType storage_dtype = (dtype == DataType::Bool() ? DataType::Int(8) : dtype);
- return Buffer(Var(name, PointerType(PrimType(storage_dtype)), span), dtype, shape,
+ return Buffer(Var(name, PointerType(PrimType(storage_dtype), storage_scope), span), dtype, shape,
Array<PrimExpr>(), PrimExpr(), name, "", 0, 0, kDefault, span);
}
+String GetStorageScope(Var buffer_var) {
+ auto type = buffer_var->type_annotation;
+ const auto* ptr_type = type.as<PointerTypeNode>();
+ ICHECK(ptr_type) << "The provided variable is not of pointer type";
+ return ptr_type->storage_scope;
+}
+
+Var UpdateStorageScope(Var buffer_var, String storage_scope) {
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org