Created
November 15, 2018 01:47
-
-
Save marcrasi/23b5a1b47b0f1bbe5901848d0d8f72ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sil_stage canonical | |
import Builtin | |
import Swift | |
import SwiftShims | |
protocol Proto { | |
@differentiable(reverse) | |
func f(_ x: Float) -> Float | |
} | |
func callF<T>(_ t: T, _ x: Float) -> Float where T : Proto | |
func gradFWrtX<T>(_ t: T, at x: Float) -> Float where T : Proto | |
struct MultiplyConstant : Proto { | |
@sil_stored let constant: Float { get } | |
@differentiable(reverse, adjoint: fAdj) | |
func f(_ x: Float) -> Float | |
func fAdj(_ x: Float, _ origResult: Float, _ seed: Float) -> Float | |
init(constant: Float) | |
} | |
struct AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1 { | |
@sil_stored @usableFromInline | |
var pv_0: () | |
@sil_stored @usableFromInline | |
var v_0: Float | |
} | |
// main | |
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
%2 = integer_literal $Builtin.Word, 1 // user: %4 | |
// function_ref specialized _allocateUninitializedArray<A>(_:) | |
%3 = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlFyp_Tg5 : $@convention(thin) (Builtin.Word) -> (@owned Array<Any>, Builtin.RawPointer) // user: %4 | |
%4 = apply %3(%2) : $@convention(thin) (Builtin.Word) -> (@owned Array<Any>, Builtin.RawPointer) // users: %5, %6 | |
%5 = tuple_extract %4 : $(Array<Any>, Builtin.RawPointer), 0 // users: %30, %27 | |
%6 = tuple_extract %4 : $(Array<Any>, Builtin.RawPointer), 1 // user: %7 | |
%7 = pointer_to_address %6 : $Builtin.RawPointer to [strict] $*Any // user: %20 | |
%8 = metatype $@thin MultiplyConstant.Type // user: %12 | |
%9 = float_literal $Builtin.FPIEEE32, 0x41200000 // 10 // user: %10 | |
%10 = struct $Float (%9 : $Builtin.FPIEEE32) // user: %12 | |
// function_ref MultiplyConstant.init(constant:) | |
%11 = function_ref @$s6dproto16MultiplyConstantV8constantACSf_tcfC : $@convention(method) (Float, @thin MultiplyConstant.Type) -> MultiplyConstant // user: %12 | |
%12 = apply %11(%10, %8) : $@convention(method) (Float, @thin MultiplyConstant.Type) -> MultiplyConstant // user: %14 | |
%13 = alloc_stack $MultiplyConstant // users: %14, %19, %18 | |
store %12 to %13 : $*MultiplyConstant // id: %14 | |
%15 = float_literal $Builtin.FPIEEE32, 0x0 // 0 // user: %16 | |
%16 = struct $Float (%15 : $Builtin.FPIEEE32) // user: %18 | |
// function_ref gradFWrtX<A>(_:at:) | |
%17 = function_ref @$s6dproto9gradFWrtX_2atSfx_SftAA5ProtoRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float // user: %18 | |
%18 = apply %17<MultiplyConstant>(%13, %16) : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float // user: %21 | |
dealloc_stack %13 : $*MultiplyConstant // id: %19 | |
%20 = init_existential_addr %7 : $*Any, $Float // user: %21 | |
store %18 to %20 : $*Float // id: %21 | |
// function_ref default argument 1 of print(_:separator:terminator:) | |
%22 = function_ref @$ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String // user: %23 | |
%23 = apply %22() : $@convention(thin) () -> @owned String // users: %29, %27 | |
// function_ref default argument 2 of print(_:separator:terminator:) | |
%24 = function_ref @$ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String // user: %25 | |
%25 = apply %24() : $@convention(thin) () -> @owned String // users: %28, %27 | |
// function_ref print(_:separator:terminator:) | |
%26 = function_ref @$ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %27 | |
%27 = apply %26(%5, %23, %25) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () | |
release_value %25 : $String // id: %28 | |
release_value %23 : $String // id: %29 | |
release_value %5 : $Array<Any> // id: %30 | |
%31 = integer_literal $Builtin.Int32, 0 // user: %32 | |
%32 = struct $Int32 (%31 : $Builtin.Int32) // user: %33 | |
return %32 : $Int32 // id: %33 | |
} // end sil function 'main' | |
// callF<A>(_:_:) | |
sil hidden [reverse_differentiable source 0 wrt 1 primal @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1 adjoint @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1] @$s6dproto5callFySfx_SftAA5ProtoRzlF : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float) -> Float { | |
// %0 // users: %5, %2 | |
// %1 // users: %5, %3 | |
bb0(%0 : $*T, %1 : $Float): | |
debug_value_addr %0 : $*T, let, name "t", argno 1 // id: %2 | |
debug_value %1 : $Float, let, name "x", argno 2 // id: %3 | |
%4 = witness_method $T, #Proto.f!1 : <Self where Self : Proto> (Self) -> (Float) -> Float : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, @in_guaranteed τ_0_0) -> Float // user: %5 | |
%5 = apply %4<T>(%1, %0) : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, @in_guaranteed τ_0_0) -> Float // user: %6 | |
return %5 : $Float // id: %6 | |
} // end sil function '$s6dproto5callFySfx_SftAA5ProtoRzlF' | |
// gradFWrtX<A>(_:at:) | |
sil hidden @$s6dproto9gradFWrtX_2atSfx_SftAA5ProtoRzlF : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float) -> Float { | |
// %0 // users: %8, %2 | |
// %1 // users: %8, %3 | |
bb0(%0 : $*T, %1 : $Float): | |
debug_value_addr %0 : $*T, let, name "t", argno 1 // id: %2 | |
debug_value %1 : $Float, let, name "x", argno 2 // id: %3 | |
// function_ref callF<A>(_:_:) | |
%4 = function_ref @$s6dproto5callFySfx_SftAA5ProtoRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float // user: %5 | |
%5 = partial_apply [callee_guaranteed] %4<T>() : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float | |
// function_ref AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1 | |
%6 = function_ref @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1 : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float // user: %7 | |
%7 = partial_apply [callee_guaranteed] %6<T>() : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> Float // users: %8, %9 | |
%8 = apply %7(%0, %1) : $@callee_guaranteed (@in_guaranteed T, Float) -> Float // user: %10 | |
strong_release %7 : $@callee_guaranteed (@in_guaranteed T, Float) -> Float // id: %9 | |
return %8 : $Float // id: %10 | |
} // end sil function '$s6dproto9gradFWrtX_2atSfx_SftAA5ProtoRzlF' | |
// MultiplyConstant.constant.getter | |
sil hidden [transparent] @$s6dproto16MultiplyConstantV8constantSfvg : $@convention(method) (MultiplyConstant) -> Float { | |
// %0 // users: %2, %1 | |
bb0(%0 : $MultiplyConstant): | |
debug_value %0 : $MultiplyConstant, let, name "self", argno 1 // id: %1 | |
%2 = struct_extract %0 : $MultiplyConstant, #MultiplyConstant.constant // user: %3 | |
return %2 : $Float // id: %3 | |
} // end sil function '$s6dproto16MultiplyConstantV8constantSfvg' | |
// MultiplyConstant.f(_:) | |
sil hidden [reverse_differentiable source 0 wrt 0 primal @$s6dproto16MultiplyConstantV1fyS2fF adjoint @$s6dproto16MultiplyConstantV4fAdjyS2f_S2ftF primitive] @$s6dproto16MultiplyConstantV1fyS2fF : $@convention(method) (Float, MultiplyConstant) -> Float { | |
// %0 // users: %6, %2 | |
// %1 // users: %4, %3 | |
bb0(%0 : $Float, %1 : $MultiplyConstant): | |
debug_value %0 : $Float, let, name "x", argno 1 // id: %2 | |
debug_value %1 : $MultiplyConstant, let, name "self", argno 2 // id: %3 | |
%4 = struct_extract %1 : $MultiplyConstant, #MultiplyConstant.constant // user: %5 | |
%5 = struct_extract %4 : $Float, #Float._value // user: %7 | |
%6 = struct_extract %0 : $Float, #Float._value // user: %7 | |
%7 = builtin "fmul_FPIEEE32"(%5 : $Builtin.FPIEEE32, %6 : $Builtin.FPIEEE32) : $Builtin.FPIEEE32 // user: %8 | |
%8 = struct $Float (%7 : $Builtin.FPIEEE32) // user: %9 | |
return %8 : $Float // id: %9 | |
} // end sil function '$s6dproto16MultiplyConstantV1fyS2fF' | |
// MultiplyConstant.fAdj(_:_:_:) | |
sil hidden @$s6dproto16MultiplyConstantV4fAdjyS2f_S2ftF : $@convention(method) (Float, Float, Float, MultiplyConstant) -> Float { | |
// %0 // user: %4 | |
// %1 // user: %5 | |
// %2 // users: %10, %6 | |
// %3 // users: %8, %7 | |
bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $MultiplyConstant): | |
debug_value %0 : $Float, let, name "x", argno 1 // id: %4 | |
debug_value %1 : $Float, let, name "origResult", argno 2 // id: %5 | |
debug_value %2 : $Float, let, name "seed", argno 3 // id: %6 | |
debug_value %3 : $MultiplyConstant, let, name "self", argno 4 // id: %7 | |
%8 = struct_extract %3 : $MultiplyConstant, #MultiplyConstant.constant // user: %9 | |
%9 = struct_extract %8 : $Float, #Float._value // user: %11 | |
%10 = struct_extract %2 : $Float, #Float._value // user: %11 | |
%11 = builtin "fmul_FPIEEE32"(%9 : $Builtin.FPIEEE32, %10 : $Builtin.FPIEEE32) : $Builtin.FPIEEE32 // user: %12 | |
%12 = struct $Float (%11 : $Builtin.FPIEEE32) // user: %13 | |
return %12 : $Float // id: %13 | |
} // end sil function '$s6dproto16MultiplyConstantV4fAdjyS2f_S2ftF' | |
// static Float.* infix(_:_:) | |
sil public_external [transparent] [serialized] [reverse_differentiable source 0 wrt 0, 1 primal @$sSf1moiyS2f_SftFZ adjoint @$sSf16_adjointMultiply__13originalValue0A0Sf_SftSf_S3ftFZ primitive] @$sSf1moiyS2f_SftFZ : $@convention(method) (Float, Float, @thin Float.Type) -> Float { | |
// %0 // user: %3 | |
// %1 // user: %4 | |
bb0(%0 : $Float, %1 : $Float, %2 : $@thin Float.Type): | |
%3 = struct_extract %0 : $Float, #Float._value // user: %5 | |
%4 = struct_extract %1 : $Float, #Float._value // user: %5 | |
%5 = builtin "fmul_FPIEEE32"(%3 : $Builtin.FPIEEE32, %4 : $Builtin.FPIEEE32) : $Builtin.FPIEEE32 // user: %6 | |
%6 = struct $Float (%5 : $Builtin.FPIEEE32) // user: %7 | |
return %6 : $Float // id: %7 | |
} // end sil function '$sSf1moiyS2f_SftFZ' | |
// MultiplyConstant.init(constant:) | |
sil hidden @$s6dproto16MultiplyConstantV8constantACSf_tcfC : $@convention(method) (Float, @thin MultiplyConstant.Type) -> MultiplyConstant { | |
// %0 // user: %2 | |
bb0(%0 : $Float, %1 : $@thin MultiplyConstant.Type): | |
%2 = struct $MultiplyConstant (%0 : $Float) // user: %3 | |
return %2 : $MultiplyConstant // id: %3 | |
} // end sil function '$s6dproto16MultiplyConstantV8constantACSf_tcfC' | |
// protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
sil private [transparent] [thunk] @$s6dproto16MultiplyConstantVAA5ProtoA2aDP1fyS2fFTW : $@convention(witness_method: Proto) (Float, @in_guaranteed MultiplyConstant) -> Float { | |
// %0 // user: %4 | |
// %1 // user: %2 | |
bb0(%0 : $Float, %1 : $*MultiplyConstant): | |
%2 = load %1 : $*MultiplyConstant // user: %4 | |
// function_ref MultiplyConstant.f(_:) | |
%3 = function_ref @$s6dproto16MultiplyConstantV1fyS2fF : $@convention(method) (Float, MultiplyConstant) -> Float // user: %4 | |
%4 = apply %3(%0, %2) : $@convention(method) (Float, MultiplyConstant) -> Float // user: %5 | |
return %4 : $Float // id: %5 | |
} // end sil function '$s6dproto16MultiplyConstantVAA5ProtoA2aDP1fyS2fFTW' | |
// Primal protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
sil private [transparent] [thunk] @$s0012Primal_gpJCa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW : $@convention(witness_method: Proto) (Float, @in_guaranteed MultiplyConstant) -> Float { | |
// %0 // user: %4 | |
// %1 // user: %2 | |
bb0(%0 : $Float, %1 : $*MultiplyConstant): | |
%2 = load %1 : $*MultiplyConstant // user: %4 | |
// function_ref MultiplyConstant.f(_:) | |
%3 = function_ref @$s6dproto16MultiplyConstantV1fyS2fF : $@convention(method) (Float, MultiplyConstant) -> Float // user: %4 | |
%4 = apply %3(%0, %2) : $@convention(method) (Float, MultiplyConstant) -> Float // user: %5 | |
return %4 : $Float // id: %5 | |
} // end sil function '$s0012Primal_gpJCa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW' | |
// Adjoint protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
sil private [transparent] [thunk] @$s0013Adjoint_mrEHa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW : $@convention(witness_method: Proto) (Float, Float, Float, @in_guaranteed MultiplyConstant) -> Float { | |
// %0 // user: %6 | |
// %1 // user: %6 | |
// %2 // user: %6 | |
// %3 // user: %4 | |
bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $*MultiplyConstant): | |
%4 = load %3 : $*MultiplyConstant // user: %6 | |
// function_ref MultiplyConstant.fAdj(_:_:_:) | |
%5 = function_ref @$s6dproto16MultiplyConstantV4fAdjyS2f_S2ftF : $@convention(method) (Float, Float, Float, MultiplyConstant) -> Float // user: %6 | |
%6 = apply %5(%0, %1, %2, %4) : $@convention(method) (Float, Float, Float, MultiplyConstant) -> Float // user: %7 | |
return %6 : $Float // id: %7 | |
} // end sil function '$s0013Adjoint_mrEHa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW' | |
// _allocateUninitializedArray<A>(_:) | |
sil [serialized] [always_inline] @$ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) | |
// Float.init(_builtinIntegerLiteral:) | |
sil public_external [transparent] [serialized] @$sSf22_builtinIntegerLiteralSfBi2048__tcfC : $@convention(method) (Builtin.Int2048, @thin Float.Type) -> Float { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.Int2048, %1 : $@thin Float.Type): | |
%2 = builtin "itofp_with_overflow_Int2048_FPIEEE32"(%0 : $Builtin.Int2048) : $Builtin.FPIEEE32 // user: %3 | |
%3 = struct $Float (%2 : $Builtin.FPIEEE32) // user: %4 | |
return %3 : $Float // id: %4 | |
} // end sil function '$sSf22_builtinIntegerLiteralSfBi2048__tcfC' | |
// default argument 1 of print(_:separator:terminator:) | |
sil shared_external [serialized] @$ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String { | |
bb0: | |
%0 = string_literal utf8 " " // user: %5 | |
%1 = integer_literal $Builtin.Word, 1 // user: %5 | |
%2 = integer_literal $Builtin.Int1, -1 // user: %5 | |
%3 = metatype $@thin String.Type // user: %5 | |
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
%4 = function_ref @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %5 | |
%5 = apply %4(%0, %1, %2, %3) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %6 | |
return %5 : $String // id: %6 | |
} // end sil function '$ss5print_9separator10terminatoryypd_S2StFfA0_' | |
// default argument 2 of print(_:separator:terminator:) | |
sil shared_external [serialized] @$ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String { | |
bb0: | |
%0 = string_literal utf8 "\n" // user: %5 | |
%1 = integer_literal $Builtin.Word, 1 // user: %5 | |
%2 = integer_literal $Builtin.Int1, -1 // user: %5 | |
%3 = metatype $@thin String.Type // user: %5 | |
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
%4 = function_ref @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %5 | |
%5 = apply %4(%0, %1, %2, %3) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %6 | |
return %5 : $String // id: %6 | |
} // end sil function '$ss5print_9separator10terminatoryypd_S2StFfA1_' | |
// print(_:separator:terminator:) | |
sil @$ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () | |
// String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
sil [serialized] [always_inline] [readonly] [_semantics "string.makeUTF8"] @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String | |
// static Float._adjointMultiply(_:_:originalValue:adjoint:) | |
sil [transparent] @$sSf16_adjointMultiply__13originalValue0A0Sf_SftSf_S3ftFZ : $@convention(method) (Float, Float, Float, Float, @thin Float.Type) -> (Float, Float) | |
// AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1_s_p | |
sil hidden @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1_s_p : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float, Float) -> (Float, Float) { | |
// %0 // users: %8, %4 | |
// %1 // users: %8, %4 | |
// %2 // user: %8 | |
bb0(%0 : $*T, %1 : $Float, %2 : $Float): | |
// function_ref AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1 | |
%3 = function_ref @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1 : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> (@owned AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float) // user: %4 | |
%4 = apply %3<T>(%0, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float) -> (@owned AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float) // users: %6, %5 | |
%5 = tuple_extract %4 : $(AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float), 0 // user: %8 | |
%6 = tuple_extract %4 : $(AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float), 1 // users: %9, %8 | |
// function_ref AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1 | |
%7 = function_ref @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1 : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float, AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float, Float) -> Float // user: %8 | |
%8 = apply %7<T>(%0, %1, %5, %6, %2) : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float, AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float, Float) -> Float // user: %9 | |
%9 = tuple (%6 : $Float, %8 : $Float) // user: %10 | |
return %9 : $(Float, Float) // id: %10 | |
} // end sil function 'AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1_s_p' | |
// AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1 | |
sil hidden @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1 : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float) -> Float { | |
// %0 // user: %17 | |
// %1 // user: %17 | |
bb0(%0 : $*T, %1 : $Float): | |
%2 = alloc_stack $Float // users: %15, %12, %10 | |
%3 = integer_literal $Builtin.Int2048, 1 // user: %7 | |
%4 = metatype $@thick Int64.Type // user: %7 | |
%5 = witness_method $Int64, #_ExpressibleByBuiltinIntegerLiteral.init!allocator.1 : <Self where Self : _ExpressibleByBuiltinIntegerLiteral> (Self.Type) -> (Builtin.Int2048) -> Self : $@convention(witness_method: _ExpressibleByBuiltinIntegerLiteral) <τ_0_0 where τ_0_0 : _ExpressibleByBuiltinIntegerLiteral> (Builtin.Int2048, @thick τ_0_0.Type) -> @out τ_0_0 // user: %7 | |
%6 = alloc_stack $Int64 // users: %11, %10, %7 | |
%7 = apply %5<Int64>(%6, %3, %4) : $@convention(witness_method: _ExpressibleByBuiltinIntegerLiteral) <τ_0_0 where τ_0_0 : _ExpressibleByBuiltinIntegerLiteral> (Builtin.Int2048, @thick τ_0_0.Type) -> @out τ_0_0 | |
%8 = metatype $@thick Float.Type // user: %10 | |
%9 = witness_method $Float, #ExpressibleByIntegerLiteral.init!allocator.1 : <Self where Self : ExpressibleByIntegerLiteral> (Self.Type) -> (Self.IntegerLiteralType) -> Self : $@convention(witness_method: ExpressibleByIntegerLiteral) <τ_0_0 where τ_0_0 : ExpressibleByIntegerLiteral> (@in τ_0_0.IntegerLiteralType, @thick τ_0_0.Type) -> @out τ_0_0 // user: %10 | |
%10 = apply %9<Float>(%2, %6, %8) : $@convention(witness_method: ExpressibleByIntegerLiteral) <τ_0_0 where τ_0_0 : ExpressibleByIntegerLiteral> (@in τ_0_0.IntegerLiteralType, @thick τ_0_0.Type) -> @out τ_0_0 | |
dealloc_stack %6 : $*Int64 // id: %11 | |
%12 = begin_access [read] [static] %2 : $*Float // users: %14, %13 | |
%13 = load %12 : $*Float // user: %17 | |
end_access %12 : $*Float // id: %14 | |
dealloc_stack %2 : $*Float // id: %15 | |
// function_ref AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1_s_p | |
%16 = function_ref @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1_s_p : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float, Float) -> (Float, Float) // user: %17 | |
%17 = apply %16<T>(%0, %1, %13) : $@convention(thin) <τ_0_0 where τ_0_0 : Proto> (@in_guaranteed τ_0_0, Float, Float) -> (Float, Float) // user: %18 | |
%18 = tuple_extract %17 : $(Float, Float), 1 // user: %19 | |
return %18 : $Float // id: %19 | |
} // end sil function 'AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__grad_src_0_wrt_1' | |
// protocol witness for _ExpressibleByBuiltinIntegerLiteral.init(_builtinIntegerLiteral:) in conformance Int64 | |
sil shared_external [transparent] [serialized] [thunk] @$ss5Int64Vs35_ExpressibleByBuiltinIntegerLiteralssACP08_builtineF0xBi2048__tcfCTW : $@convention(witness_method: _ExpressibleByBuiltinIntegerLiteral) (Builtin.Int2048, @thick Int64.Type) -> @out Int64 | |
// protocol witness for ExpressibleByIntegerLiteral.init(integerLiteral:) in conformance Float | |
sil shared_external [transparent] [serialized] [thunk] @$sSfs27ExpressibleByIntegerLiteralssAAP07integerD0x0cD4TypeQz_tcfCTW : $@convention(witness_method: ExpressibleByIntegerLiteral) (@in Int64, @thick Float.Type) -> @out Float | |
// AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1 | |
sil hidden @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1 : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float) -> (@owned AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float) { | |
// %0 // users: %5, %2 | |
// %1 // users: %5, %3 | |
bb0(%0 : $*T, %1 : $Float): | |
debug_value_addr %0 : $*T, let, name "t", argno 1 // id: %2 | |
debug_value %1 : $Float, let, name "x", argno 2 // id: %3 | |
%4 = witness_method $T, #Proto.f!differentiationfunc.primal.1 : <Self where Self : Proto> (Self) -> (Float) -> Float : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, @in_guaranteed τ_0_0) -> Float // user: %5 | |
%5 = apply %4<T>(%1, %0) : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, @in_guaranteed τ_0_0) -> Float // users: %8, %7 | |
%6 = tuple () // user: %7 | |
%7 = struct $AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1 (%6 : $(), %5 : $Float) // user: %8 | |
%8 = tuple (%7 : $AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, %5 : $Float) // user: %9 | |
return %8 : $(AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float) // id: %9 | |
} // end sil function 'AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__primal_src_0_wrt_1' | |
// AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1 | |
sil hidden @AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1 : $@convention(thin) <T where T : Proto> (@in_guaranteed T, Float, AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, Float, Float) -> Float { | |
// %0 // user: %17 | |
// %1 // user: %17 | |
// %2 // users: %6, %5 | |
// %4 // user: %10 | |
bb0(%0 : $*T, %1 : $Float, %2 : $AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, %3 : $Float, %4 : $Float): | |
%5 = struct_extract %2 : $AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, #AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1.pv_0 | |
%6 = struct_extract %2 : $AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1, #AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__Type__src_0_wrt_1.v_0 // user: %17 | |
%7 = alloc_stack $Float // users: %18, %13, %8 | |
%8 = begin_access [init] [static] [no_nested_conflict] %7 : $*Float // users: %12, %9 | |
%9 = begin_access [init] [static] [no_nested_conflict] %8 : $*Float // users: %11, %10 | |
store %4 to %9 : $*Float // id: %10 | |
end_access %9 : $*Float // id: %11 | |
end_access %8 : $*Float // id: %12 | |
%13 = begin_access [read] [static] [no_nested_conflict] %7 : $*Float // users: %15, %14 | |
%14 = load %13 : $*Float // user: %17 | |
end_access %13 : $*Float // id: %15 | |
%16 = witness_method $T, #Proto.f!differentiationfunc.adjoint.1 : <Self where Self : Proto> (Self) -> (Float) -> Float : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, Float, Float, @in_guaranteed τ_0_0) -> Float // user: %17 | |
%17 = apply %16<T>(%1, %6, %14, %0) : $@convention(witness_method: Proto) <τ_0_0 where τ_0_0 : Proto> (Float, Float, Float, @in_guaranteed τ_0_0) -> Float // user: %19 | |
dealloc_stack %7 : $*Float // id: %18 | |
return %17 : $Float // id: %19 | |
} // end sil function 'AD__$s6dproto5callFySfx_SftAA5ProtoRzlF__adjoint_src_0_wrt_1' | |
// specialized _allocateUninitializedArray<A>(_:) | |
sil [always_inline] @$ss27_allocateUninitializedArrayySayxG_BptBwlFyp_Tg5 : $@convention(thin) (Builtin.Word) -> (@owned Array<Any>, Builtin.RawPointer) | |
sil_witness_table hidden MultiplyConstant: Proto module dproto { | |
method #Proto.f!1: <Self where Self : Proto> (Self) -> (Float) -> Float : @$s6dproto16MultiplyConstantVAA5ProtoA2aDP1fyS2fFTW // protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
method #Proto.f!differentiationfunc.primal.1: <Self where Self : Proto> (Self) -> (Float) -> Float : @$s0012Primal_gpJCa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW // Primal protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
method #Proto.f!differentiationfunc.adjoint.1: <Self where Self : Proto> (Self) -> (Float) -> Float : @$s0013Adjoint_mrEHa6dproto16MultiplyConstantVAB5ProtoA2bEP1fyS2fFTW // Adjoint protocol witness for Proto.f(_:) in conformance MultiplyConstant | |
} | |
sil_witness_table public_external [serialized] Int64: _ExpressibleByBuiltinIntegerLiteral module Swift { | |
method #_ExpressibleByBuiltinIntegerLiteral.init!allocator.1: <Self where Self : _ExpressibleByBuiltinIntegerLiteral> (Self.Type) -> (Builtin.Int2048) -> Self : @$ss5Int64Vs35_ExpressibleByBuiltinIntegerLiteralssACP08_builtineF0xBi2048__tcfCTW // protocol witness for _ExpressibleByBuiltinIntegerLiteral.init(_builtinIntegerLiteral:) in conformance Int64 | |
} | |
sil_witness_table public_external [serialized] Float: ExpressibleByIntegerLiteral module Swift { | |
associated_type_protocol (IntegerLiteralType: _ExpressibleByBuiltinIntegerLiteral): Int64: _ExpressibleByBuiltinIntegerLiteral module Swift | |
associated_type IntegerLiteralType: Int64 | |
method #ExpressibleByIntegerLiteral.init!allocator.1: <Self where Self : ExpressibleByIntegerLiteral> (Self.Type) -> (Self.IntegerLiteralType) -> Self : @$sSfs27ExpressibleByIntegerLiteralssAAP07integerD0x0cD4TypeQz_tcfCTW // protocol witness for ExpressibleByIntegerLiteral.init(integerLiteral:) in conformance Float | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment