slyubomirsky commented on code in PR #14394:
URL: https://github.com/apache/tvm/pull/14394#discussion_r1183172935
##########
src/relax/op/op.cc:
##########
@@ -73,6 +73,40 @@ StructInfo InferStructInfoShapeOf(const Call& call, const
BlockBuilder& ctx) {
return ShapeStructInfo(tensor_shape->values);
}
+// call_pure_packed
+
+StructInfo InferStructInfoCallPurePacked(const Call& call, const BlockBuilder&
ctx) {
+ if (call->args.size() < 1) {
+ ctx->ReportFatal(Diagnostic::Error(call)
+ << "call_pure_packed must be called with at least one
argument");
+ }
+
+ // the callee must be an opaque function
+ auto callee = call->args[0];
+ ICHECK(!callee.as<OpNode>()) << "call_pure_packed cannot be used with an op
node";
+ auto opt = MatchStructInfo<FuncStructInfo>(callee);
+ ICHECK(opt) << "Callee must have a function struct info";
+ FuncStructInfo finfo = opt.value();
+ ICHECK(finfo->IsOpaque()) << "call_pure_packed must be called with an opaque
function, but "
+ << callee << " is not opaque";
+
+ // derives the struct info of the result as it would for a call to the inner
args
+ auto hypothetical_call = UnwrapCallPure(call);
Review Comment:
This is doing the exactly same thing as the StructInfo inference for packed
calls, in fact. I adapted it from `BlockBuilder::InferStructInfo`. I unwrapped
the call to avoid code duplication
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]