-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[LoadableByAddr] Assertion failed: (srcAddr->getType() == destAddr->getType()) #72363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tagging @aschwaighofer The first testcase is triggering a bug somewhere in LoadableByAddress. It is again workarounded by |
The bug is happens on AddressAsignment inside %222 = tuple $(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (@in_guaranteed P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (@in_guaranteed P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (@in_guaranteed P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (@in_guaranteed P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double) (%82, %101, %111, %131, %141, %161, %171, %191, %201) // user: %226
...
%225 = pointer_to_address %224 : $Builtin.RawPointer to [strict] $*(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double) // user: %226
store %222 to %225 : $*(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double) // id: %226 The code is trying to create
to:
Before LoadableByAddress the code was fine: %202 = tuple $(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double,
@callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.Differe
ntiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double) (%80, %99, %109, %1
29, %139, %159, %169, %189, %199) // user: %206
...
%205 = pointer_to_address %204 : $Builtin.RawPointer to [strict] $*(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.Differentiab
leView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.Ta
ngentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guar
anteed (@inout Double) -> Double) // user: %206
store %202 to %205 : $*(predecessor: _AD__$s4main1LV1sAA1HVyF_bb2__Pred__src_0_wrt_0, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector
>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double, @callee_guaranteed (P.TangentVector) -> @owned Array<P.TangentVector>.DifferentiableView, @callee_guaranteed (@inout Double) -> Double) // id: %20
6 Looks like LoadableByAddress create improper tuple type for |
Ok, looks like the |
@fibrechannelscsi The second testcase is unrelated and is due to autodiff. I'm factoring it out into a separate issue. |
…dress is address of tuple type that should be rewritten. Fixes #72363
if the target address is address of tuple type that should be rewritten. Fixes #72363
if the target address is address of tuple type that should be rewritten. Fixes swiftlang#72363 (cherry picked from commit 2ad4a60)
if the target address is address of tuple type that should be rewritten. Fixes swiftlang#72363 (cherry picked from commit 2ad4a60)
if the target address is address of tuple type that should be rewritten. Fixes swiftlang#72363 (cherry picked from commit 2ad4a60) (cherry picked from commit 1457fe6)
if the target address is address of tuple type that should be rewritten. Fixes swiftlang#72363 (cherry picked from commit 2ad4a60)
Description
Enclosed are two reproducers that will reach the same assertion failure in the same line of code, however, the stack trace is different for each of them.
One stack trace contains the
SILPassManager
, and the other contains both theSILPassManager
andSILCloner
. Further details below.Based on the 2024-03-07a toolchain, the assertion failure is:
Assertion failed: (srcAddr->getType() == destAddr->getType()), function createCopyAddr, file SILBuilder.h, line 1177.
Reproduction
Compile either of the following reproducers in Debug mode using the 2024-03-07a or 2024-03-13a nightly toolchains:
Reproducer 1:
Reproducer 2:
Note that Reproducer 2 is a condensed version of "Crash 4" described here:
#59429
That is to say, Reproducer 1 is another way of reaching the same assertion failure as Reproducer 2, albeit via a different stack trace.
Expected behavior
The compilation should succeed for Reproducer 1.
For Reproducer 2, the compilation should succeed, or the compiler should produce an error message indicating why the compilation cannot succeed.
Environment
Reproducer 1 will fail to compile with the 2024-03-07a or 2024-03-13a nightly toolchains. However, compilation will succeed with the 2023-12-07a toolchain.
Reproducer 2 will fail to compile with all three toolchains listed above. That is, the issue is still open.
Additional information
Here are the stack traces for each issue (from the 2024-03-07a toolchain):
Reproducer 1:
Reproducer 2:
Note that, for Reproducer 1, all four
+=
operations are required to reproduce this crash. If one or more of them are commented out, then the compilation will succeed.In addition, commenting out the line containing
var e = 0.0
will also cause the compilation to succeed, even though the variablee
is not used anywhere.The text was updated successfully, but these errors were encountered: