Hello serialization experts,
Serialization for the
@differentiable attribute isn't working properly. Below is a reproducer: I test whether
@differentiable attributes are serialized correctly and show up where referenced from another module during SILGen.
@differentiableattributes (on tensorflow branch).
- For comparison,
// fail.swift Float(1) + 1 ["", ""].joined()
When I emit SILGen for the program, the SIL
[differentiable] attribute doesn't show up, but the
[_specialize] attribute does.
$ swiftc -emit-silgen fail.swift ... // static Float.+ infix(_:_:) // BUG: 'differentiable' attribute doesn't show up. sil [transparent] [serialized] @$sSf1poiyS2f_SftFZ : $@convention(method) (Float, Float, @thin Float.Type) -> Float // BidirectionalCollection<>.joined(separator:) // 'specialize' attribute shows up. sil [_specialize exported: false, kind: full, where τ_0_0 == Array<String>] @$sSKsSS7ElementRtzrlE6joined9separatorS2S_tF : $@convention(method) <τ_0_0 where τ_0_0 : BidirectionalCollection, τ_0_0.Element == String> (@guaranteed String, @in_guaranteed τ_0_0) -> @owned String
Here are some relevant code paths regarding
@differentaible attribute serialization. (The implementations were copied from serialization for other attributes.)
- AST serialization:
- AST deserialization:
- SIL serialization:
- SIL deserialization:
There are two serialization tests for
@differentiable, but they don't catch this bug.
Does anyone know what might be causing this? I imagine the bug is likely that
@differentiable attribute isn't getting (de)serialized at all, rather than one part of (de)serialization being missing.
Any tips would be greatly appreciated!