Skip to content

[SR-12154] Fix vtable entry type mismatch verification error for @differentiable(wrt: self) #53490

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

Open
Tracked by #52130
dan-zheng opened this issue Jul 10, 2019 · 1 comment
Labels
attributes Feature: Declaration and type attributes AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself

Comments

@dan-zheng
Copy link
Contributor

dan-zheng commented Jul 10, 2019

Previous ID SR-12154
Radar None
Original Reporter @dan-zheng
Type Sub-task
Additional Detail from JIRA
Votes 0
Component/s
Labels Sub-task
Assignee None
Priority Medium

md5: 66daea3fab4a15a8539d2d766d092b41

is blocked by:

  • TF-625 [AD] Change differentials/pullbacks to be maximally indirect

Issue Description:

Reproducer:

class Super : Differentiable {
  var base: Float = 0
  // Dummy to make `Super.AllDifferentiableVariables` be nontrivial.
  // var _nontrivial: [Float] = []

  @differentiable(wrt: self)
  func f() -> Float {
    return 1
  }
}

class Sub : Super {
  @differentiable(wrt: self)
  override func f() -> Float {
    return 1
  }
}
SIL verification failed: vtable entry for #Super.f!1.jvp.1.S must be ABI-compatible
  ABI incompatible return values
  @convention(method) (@guaranteed Super) -> (Float, @owned @callee_guaranteed (@guaranteed Super.AllDifferentiableVariables) -> Float)
  @convention(method) (@guaranteed Sub) -> (Float, @owned @callee_guaranteed (Super.AllDifferentiableVariables) -> Float)

This error occurs because class Super is non-trivial but struct Super.AllDifferentiableVariables is trivial.
Should be fixed by TF-625 by making differentials/pullbacks maximally indirect.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself attributes Feature: Declaration and type attributes labels May 12, 2023
@jkshtj
Copy link
Contributor

jkshtj commented May 3, 2024

Still crashes on 05/24 toolchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes Feature: Declaration and type attributes AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself
Projects
None yet
Development

No branches or pull requests

4 participants