Skip to content
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

The AutodiffClosureSpecialization pass creates SIL with invalid ownership when enabling OSSA modules #78847

Open
eeckstein opened this issue Jan 23, 2025 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@eeckstein
Copy link
Contributor

Description

When running the test AutoDiff/validation-test/array.swift in optimize mode, the compiler crashes with

Begin Error in Function: '$sSa16_DifferentiationAA14DifferentiableRzlE0B4ViewVyADySf_G_GA2FIeggoo_TJSpSSUpSrUSUP07$sSa16_a4AA14b47RzlE15_vjpConcatenateySayxG5value_SaA2aBRzlE0B4c54Vy13TangentVectorQz_G_AJtAJc8pullbacktAD_ADtFZAKL_yAJ_v3AjaO11FSaySfG_Tg5SaySaySfGGAITf1nc_n'
Found over consume?!
Value:   %4 = partial_apply [callee_guaranteed] %3(%1, %2) : $@convention(thin) (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView, @guaranteed Array<Array<Float>>, @guaranteed Array<Array<Float>>) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView) // users: %11, %6
User:   %6 = partial_apply [callee_guaranteed] %5(%4) : $@convention(thin) (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView, @guaranteed @callee_guaranteed (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView)) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView) // users: %12, %7
Block: bb0
Consuming Users:
  destroy_value %4 : $@callee_guaranteed (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView) // id: %11
  %6 = partial_apply [callee_guaranteed] %5(%4) : $@convention(thin) (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView, @guaranteed @callee_guaranteed (@guaranteed Array<Array<Float>.DifferentiableView>.DifferentiableView) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView)) -> (@owned Array<Array<Float>.DifferentiableView>.DifferentiableView, @owned Array<Array<Float>.DifferentiableView>.DifferentiableView) // users: %12, %7

Reproduction

  • Enable OSSA modules, e.g. by cherry-picking cb4db5a
  • Run the test AutoDiff/validation-test/array.swift in optimized mode, e.g. with ninja check-swift-optimize

Expected behavior

no crash

Environment

Additional information

No response

@eeckstein eeckstein added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Jan 23, 2025
@eeckstein
Copy link
Contributor Author

@jkshtj would you be able to take care of this?

eeckstein added a commit to eeckstein/swift that referenced this issue Jan 23, 2025
Disable the closure specializer optimization for closures in OSSA until the underlying problem is fixed.
swiftlang#78847

Part of rdar://140229560
@eeckstein
Copy link
Contributor Author

I'm temporarily disabling this optimization for OSSA: #78849

@jkshtj
Copy link
Contributor

jkshtj commented Jan 23, 2025

@jkshtj would you be able to take care of this?

@eeckstein I haven't been working on Swift Autodiff for a while now. May be @asl can?

@asl
Copy link
Contributor

asl commented Jan 23, 2025

Tagging @kovdan01 @JaapWijnen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

3 participants