Open dan-zheng opened 4 years ago
@dan-zheng@marcrasi What remains to be done before they can be re-enabled?
The first step would be to uncomment SILVerifier::checkDifferentiableFunctionInst
: https://github.com/apple/swift/blob/27ece6f83db6bea5ee35a560c673c8eab415d1e3/lib/SIL/Verifier/SILVerifier.cpp#L4801
The verification condition for expected/actual JVP/VJP operand types can be relaxed to sth like checking for "function type ABI differences".
Re-enabling verification would be great. I think it may expose some latent issues in autodiff tests (like test/AutoDiff/reabstraction.swift
) that cause flaky test failures.
Currently, @differentiable
function types in SIL are quite difficult to correctly reabstract and transform because expected JVP/VJP types are computed from the original function type. I think your old idea of "creating a new SILDifferentiableFunctionType
" where all three types are distinct could still be a good idea. That would also enable optimization/specialization of the original function operand when the JVP/VJP operands cannot be optimized.
Thanks for the context. Disabling verification seemed like an suboptimal solution. There are a lot of weaker things that can be checked here, e.g. the equality of unsubstituted types or at least making sure the indirectness and ownership conventions are the same. Not checking these will lead to memory leaks (which happened to me when I make ownership-related changes) and other errors that are hard to debug.
@swift-ci create
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Sub-task | |Assignee | @rxwei | |Priority | Medium | md5: 3d2c6f9bc1f6178b50b1c770758eb175Parent-Task:
blocks:
relates to:
Issue Description: