[TensorExpr] Resubmit: Introduce ExternalCall nodes to TE IR.
ExternalCall nodes represent opaque calls to external functions to fill a
tensor (buffer) with values. It could be used to include nodes that are
otherwise not-representable as TE, or whose TE representation is currently too
slow.
To make an external function available in NNC as ExternalCall, one needs to
implement a "bridge" function that would take raw (void*) pointers to the data
along with the arrays containing dimension info. This function would then
internally call the desired external function and make sure the results of the
call are correctly placed in the provided raw data buffers.
The reason the PR was previously reverted was that the LLVM generated
calls to bridge functions were breaking unwind tables. This is now fixed
by requiring bridge functions to never throw and setting the
corresponding attribute in the LLVM generated code.
ghstack-source-id: 39079759e55fafbe5f2facc2ed732389bbc6db05
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51594
Author
Mikhail Zolotukhin