Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AOT] Avoid call_extern() with incorrect argument count (apache#15301)
Prior to this commit, if device initialization is required, the AOT main function produced a `call_extern()` that included the device context as input. This commit updates the AOT main function to provide the device context only if the function being called accepts a device context as input. If an extra device context argument is included at the call site, the C codegen would produce a function signature that includes the device context for the caller's compilation unit, but a signature without the device context for the callee's compilation unit. While this can compile and run in some cases, it is undefined behavior for the signature to vary between compilation units, and should be avoided. This was initially discovered while debugging apache#14985, in which changes to the lowering flow resulted in the caller and callee being within the same compilation unit.
- Loading branch information