We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@differentiable
md5: 8728a0dec6cf21c06e279713d5fddcc3
relates to:
Issue Description:
import _Differentiation func caller(_ f: @differentiable @escaping (Float, Float) -> Float) {} func fn(_ t: Float, _ y: Float) -> Float { t } let diffFn: @differentiable (Float, Float) -> Float = fn let _ = caller(withoutDerivative(at: diffFn))
$ swift crash.swift Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Library/Caches/swift-build/llvm-project/llvm/include/llvm/Support/Casting.h, line 264. Stack dump: 0. Program arguments: /Library/Caches/swift-build/build/Xcode-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/Debug/bin/swift -frontend -interpret crash.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -target-sdk-version 10.15.4 -module-name crash 1. Swift version 5.3-dev (LLVM 55d27a5828, Swift 946595fde3) 2. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module crash) 3. While emitting reabstraction thunk in SIL function "@$sS6fIegnrr_Iegnnro_S6fIegydd_Iegyydo_TR". for <<debugloc at "<compiler-generated>":0:0>>4. While emitting reabstraction thunk in SIL function "@$sS3fIegnrr_S3fIegydd_TR". for <<debugloc at "<compiler-generated>":0:0>>0 swift 0x000000010fa9f538 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 1 swift 0x000000010fa9e498 llvm::sys::RunSignalHandlers() + 248 2 swift 0x000000010fa9fb4d SignalHandler(int) + 285 3 libsystem_platform.dylib 0x00007fff716875fd _sigtramp + 29 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338613492256 5 libsystem_c.dylib 0x00007fff7155d808 abort + 120 6 libsystem_c.dylib 0x00007fff7155cac6 err + 0 7 swift 0x000000010bb0c7a2 llvm::cast_retty<swift::TupleType, swift::TypeBase*>::ret_type llvm::cast<swift::TupleType, swift::TypeBase>(swift::TypeBase*) + 98 8 swift 0x000000010bb06d60 swift::CanTypeWrapper<swift::TupleType> swift::cast<swift::TupleType>(swift::CanType) + 32 9 swift 0x000000010acc9342 swift::CanTypeWrapperTraits<swift::TupleType>::type swift::SILType::castTo<swift::TupleType>() const + 34 10 swift 0x000000010acb800f swift::SILType::getTupleElementType(unsigned int) const + 31 11 swift 0x000000010adeeebb swift::SILBuilder::createTupleElementAddr(swift::SILLocation, swift::SILValue, unsigned int) + 187 12 swift 0x0000000109d53924 (anonymous namespace)::ResultPlanner::planTupleFromIndirectResult(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::TupleType>, (anonymous namespace)::ResultPlanner::PlanData&, swift::SILValue) + 516 13 swift 0x0000000109d51bad (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData&) + 2509 14 swift 0x0000000109d2a2aa (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::SmallVectorImpl<swift::SILValue>&) + 778 15 swift 0x0000000109d47667 buildThunkBody(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::CanType) + 1399 16 swift 0x0000000109d462b8 createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 2120 17 swift 0x0000000109d437c6 (anonymous namespace)::Transform::transformFunction(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 1078 18 swift 0x0000000109d25ff5 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 2517 19 swift 0x0000000109d243a4 swift::Lowering::SILGenFunction::emitTransformedValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 468 20 swift 0x0000000109d579a0 (anonymous namespace)::ResultPlanner::execute(llvm::ArrayRef<swift::SILValue>, llvm::SmallVectorImpl<swift::SILValue>&)::$_22::operator()((anonymous namespace)::ResultPlanner::Operation&, bool, bool) const + 928 21 swift 0x0000000109d56b39 (anonymous namespace)::ResultPlanner::execute(llvm::ArrayRef<swift::SILValue>, llvm::SmallVectorImpl<swift::SILValue>&) + 1209 22 swift 0x0000000109d2a6be (anonymous namespace)::ResultPlanner::execute(swift::SILValue) + 478 23 swift 0x0000000109d478af buildThunkBody(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::CanType) + 1983 24 swift 0x0000000109d462b8 createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 2120 25 swift 0x0000000109d47fa7 createDifferentiableFunctionThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>)::$_17::operator()(swift::AutoDiffDerivativeFunctionKind) const + 1335 26 swift 0x0000000109d46f1e createDifferentiableFunctionThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>) + 1998
The issue is related to @differentiable function reabstraction. LLDB debug output from SILGenPoly.cpp:
(lldb) p sourceType->dump() (sil_function_type type=@differentiable @callee_guaranteed (@in_guaranteed Float, @in_guaranteed Float) -> @out Float (input=struct_type decl=Swift.(file).Float) (input=struct_type decl=Swift.(file).Float) (result=struct_type decl=Swift.(file).Float) (substitution_map generic_signature=<nullptr>) (substitution_map generic_signature=<nullptr>)) (lldb) p expectedType->dump() (sil_function_type type=@differentiable @callee_guaranteed (Float, Float) -> Float (input=struct_type decl=Swift.(file).Float) (input=struct_type decl=Swift.(file).Float) (result=struct_type decl=Swift.(file).Float) (substitution_map generic_signature=<nullptr>) (substitution_map generic_signature=<nullptr>)) (lldb) p inputOrigType.dump() AP::Type<τ_0_0>((generic_type_param_type depth=0 index=0) ) (lldb) p inputSubstType->dump() (function_type escaping (input=function_params num_params=2 (param (struct_type decl=Swift.(file).Float)) (param (struct_type decl=Swift.(file).Float))) (output=struct_type decl=Swift.(file).Float)) (lldb) p outputOrigType.dump() AP::Type((function_type escaping (input=function_params num_params=2 (param (struct_type decl=Swift.(file).Float)) (param (struct_type decl=Swift.(file).Float))) (output=struct_type decl=Swift.(file).Float)) ) (lldb) p outputSubstType->dump() (function_type escaping (input=function_params num_params=2 (param (struct_type decl=Swift.(file).Float)) (param (struct_type decl=Swift.(file).Float))) (output=struct_type decl=Swift.(file).Float))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Additional Detail from JIRA
md5: 8728a0dec6cf21c06e279713d5fddcc3
relates to:
Issue Description:
The issue is related to
@differentiable
function reabstraction. LLDB debug output from SILGenPoly.cpp:The text was updated successfully, but these errors were encountered: