Skip to content

[SR-12493] SIL verification error regarding differentiable_function_extract #54935

Closed
@dan-zheng

Description

@dan-zheng
Previous ID SR-12493
Radar None
Original Reporter @dan-zheng
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee @marcrasi
Priority Medium

md5: d7f6b9063ad492b405128dddb14e2cb9

Issue Description:

import _Differentiation

func exampleVJP_1(_ x0: Float) -> (Float, (Float) -> (Float)) {
  (
    x0 * x0,
    { (2 * x0 * $0) }
  )
}

func bar() {
  let f = differentiableFunction(from: exampleVJP_1)
  let pb = pullback(at: 10, in: f)
  _ = pb(1)
}
$ swiftc -O crash.swift
SIL verification failed: substituted callee type does not match substitutions
  $@callee_guaranteed (@in_guaranteed Float) -> @out Float
  $@callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for <Float, Float>
Verifying instruction:
     %53 = apply %51(%52, %48) : $@noescape @callee_guaranteed (@in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float) // users: %62, %61
     %58 = alloc_stack $Float                     // users: %59, %64, %61
     %60 = alloc_stack $Float                     // users: %63, %61
->   %61 = apply %53(%60, %58) : $@callee_guaranteed (@in_guaranteed Float) -> @out Float
In function:
// bar()
sil hidden @$s5crash3baryyF : $@convention(thin) () -> () {
bb0:
...

This issue only occurs with -O on master branch. It does not occur on tensorflow branch.

The issue may be due to not-yet-upstreamed SILOptimizer logic on tensorflow branch.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions