You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Fixed SR-7913: remove the call to SILModule::linkFunction(String) … (#11)
* 1. Resolves [SR-7913](https://bugs.swift.org/browse/SR-7913): remove the call to SILModule::linkFunction(String) in TFUtilities.cpp
In the new code, after calling fn = module.findFunction(..), fn->isDefinition()
returns false. In the old code, the result of module.findFunction() returns true
for isDefinition().
The fix is to load and link the function via module.loadFunction() and
module.linkFunction() after finding the function, such that fn->isDefinition()
returns true. This makes fn->getForwardingSubstitutions().size() == 1, as
required in getSingletonSubstitutionFromFunction().
Also tried the alternative as suggested by Richard, but the code below crashed:
```
ty->getMemberSubstitutionMap(
fn->getModule().getSwiftModule(),
funcDecl,
ctx.getProtocol(KnownProtocolKind::TensorSendableReceivable)->getGenericEnvironment())
```
Here ty is `(struct_type decl=Swift.(file).Float).`
funcDecl is
```
(func_decl "receiveFromDevice(_:_:)" interface type='<Scalar where Scalar : AccelerableByTensorFlow> (TensorHandle<Scalar>.Type) -> (_TensorComputation, Int) -> TensorHandle<Scalar>' access=internal final type
(parameter_list
(parameter "self" interface type='TensorHandle<Scalar>.Type'))
(parameter_list
(parameter "computation" interface type='_TensorComputation')
(parameter "tensorId" interface type='Int')))
```
crash point:
> swift: /usr/local/google/home/hongm/ssd_part/swift-private/swift/lib/AST/Type.cpp:3198: swift::Type swift::TypeBase::getSuperclassForDecl(const swift::ClassDecl *): Assertion `isa<ClassDecl>(nominalDecl) && "expected a class here"' failed.
2. Resolves [SR-7915](https://bugs.swift.org/browse/SR-7915): for a string attr of an tfop inst, the new SIL for such an
attr can be %3 below.
```
%0 = string_literal utf8 "foo" // user: %4
%1 = integer_literal $Builtin.Word, 3 // users: %6, %4
%2 = integer_literal $Builtin.Int1, -1 // users: %6, %4
// function_ref specialized String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%3 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfCTf4nnnd_n : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1) -> @owned String // users: %6, %4
%4 = apply %3(%0, %1, %2) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1) -> @owned String // user: %7
```
0 commit comments