tqchen commented on code in PR #13569:
URL: https://github.com/apache/tvm/pull/13569#discussion_r1087093102
##########
include/tvm/ir/function.h:
##########
@@ -63,6 +63,43 @@ enum class CallingConv : int {
* - Implementation: defined by device runtime(e.g. runtime/cuda)
*/
kDeviceKernelLaunch = 2,
+ /*!
+ * \brief For functions only called by other functions within the same IR
module.
+ *
+ * This calling convention exists to support one PrimFunc calling another
PrimFunc
+ * within the same IRModule.
+ *
+ * Overview / Purpose:
+ *
+ * - This calling convention is intended only for PrimFuncs whose callers
reside in
+ * the same IRModule. This is the only supported use case.
+ *
+ * - The details of the calling convention may change frequently as TVM
evolves.
+ * Therefore users are discouraged from attempting to use this calling
convention
+ * outside of the supported use case(s).
+ *
+ * Current mechanics / usage requirements:
+ *
+ * - A PrimFunc with this calling convention will NOT undergo any of the
signature
+ * transformations provided by the MakePackedAPI pass.
+ *
+ * - Supported use cases, and their corresponding unit tests, are all
expressed as
+ * TVMScript.
+ *
+ * - The callsite must use `T.call_extern`.
Review Comment:
Just want to get some clarity here. That boils down how we map this cross
function call in codegen phase.
- If the call maps into call_extern => caller side LLVM call, callee side
just present the function as LLVM function. Then it is the common calling
convention(either known as default per defined by platform)
- The reason why it is related to "C" calling convention is that if the
callee side say was implemented as a C function with the same signature(and
compile that say through hexagon-llvm, or platform-c), and we compile caller
side as it is, it will still work
If the cross function call will be further lowered(and the behavior), then
it might be useful to give it a different name. IntraModule might be slightly
too generic(since we can also use Packed call intra module), also the caller
side might need a different intrinsic(as call_extern implies call into a
function with C calling convention). So if we want to state that this is a
convention that will be further lowered, just a strawman: (e.g.
InternalModuleCall, call_internal)
After reading the context, seems we lean towards later. So the main comment
to clarify this is to relate the calling convention as much as possible to
existing known ones, or clarify it so it is differentiated from existing known
ones(by different intrinsics and name).
--
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]