Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

How to make basic AD works? #9

Closed
@wangtz

Description

@wangtz

I found some tests here: https://github.com/google/swift/blob/tensorflow/test/TensorFlow/tensor_autodiff.swift
But neither XCode nor the CLI tool is able to run it.

Error message during compiling.

Assertion failed: (isParsing || !getFunction().hasQualifiedOwnership()), function createRetainValue, file /Users/danielzheng/swift-new/swift/include/swift/SIL/SILBuilder.h, line 984.
0 swift 0x0000000112bf4d78 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x0000000112bf5486 SignalHandler(int) + 694
2 libsystem_platform.dylib 0x00007fff52e6bf5a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2904113344
4 libsystem_c.dylib 0x00007fff52c96312 abort + 127
5 libsystem_c.dylib 0x00007fff52c5e368 basename_r + 0
6 swift 0x00000001100fb764 swift::SILBuilder::createRetainValue(swift::SILLocation, swift::SILValue, swift::RefCountingInst::Atomicity) + 484
7 swift 0x000000010fd1e576 swift::SILClonerswift::SILInliner::visitRetainValueInst(swift::RetainValueInst*) + 390
8 swift 0x000000010fd03fb3 swift::SILClonerswift::SILInliner::visitSILBasicBlock(swift::SILBasicBlock*) + 83
9 swift 0x000000010fd036d8 swift::SILInliner::inlineFunction(swift::FullApplySite, llvm::ArrayRefswift::SILValue) + 1656
10 swift 0x000000010fdba4b9 runOnFunctionRecursively(swift::SILFunction*, swift::FullApplySite, swift::SILOptions::LinkingMode, llvm::DenseSet<swift::SILFunction*, llvm::DenseMapInfoswift::SILFunction* >&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >::Factory&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >, swift::ClassHierarchyAnalysis*, swift::SILInliner::InlineKind, std::__1::function<bool (swift::FullApplySite, swift::SILFunction const&)> const&) + 5545
11 swift 0x000000010fdb9f64 runOnFunctionRecursively(swift::SILFunction*, swift::FullApplySite, swift::SILOptions::LinkingMode, llvm::DenseSet<swift::SILFunction*, llvm::DenseMapInfoswift::SILFunction* >&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >::Factory&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >, swift::ClassHierarchyAnalysis*, swift::SILInliner::InlineKind, std::__1::function<bool (swift::FullApplySite, swift::SILFunction const&)> const&) + 4180
12 swift 0x000000010fdb9f64 runOnFunctionRecursively(swift::SILFunction*, swift::FullApplySite, swift::SILOptions::LinkingMode, llvm::DenseSet<swift::SILFunction*, llvm::DenseMapInfoswift::SILFunction* >&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >::Factory&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfoswift::SILFunction* >, swift::ClassHierarchyAnalysis*, swift::SILInliner::InlineKind, std::__1::function<bool (swift::FullApplySite, swift::SILFunction const&)> const&) + 4180
13 swift 0x000000010fdb8e9d swift::inlineForTFDeabstraction(swift::SILFunction&, std::__1::function<bool (swift::FullApplySite, swift::SILFunction const&)> const&) + 269
14 swift 0x000000010fdcd634 (anonymous namespace)::TFDeabstraction::doIt() + 404
15 swift 0x000000010fdcd352 (anonymous namespace)::TFDeabstractionPass::run() + 658
16 swift 0x000000010fd31e7a swift::SILPassManager::runModulePass(unsigned int) + 346
17 swift 0x000000010fd327d7 swift::SILPassManager::execute() + 775
18 swift 0x000000010f56f63b swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
19 swift 0x000000010fd3b51c swift::runSILDiagnosticPasses(swift::SILModule&) + 172
20 swift 0x000000010f40063f performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 12799
21 swift 0x000000010f3fc42e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
22 swift 0x000000010f3b2f83 main + 2051
23 libdyld.dylib 0x00007fff52bea115 start + 1
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/wangtz/Projects/swift/Example/TensotFlowSwiftTest/TensotFlowTest/main.swift -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Products/Debug -F /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Products/Debug -enable-testing -gnone -module-cache-path /Users/wangtz/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4 -O -D DEBUG -serialize-debugging-options -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/TensotFlowTest-generated-files.hmap -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/TensotFlowTest-own-target-headers.hmap -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/TensotFlowTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/TensotFlowTest-project-headers.hmap -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Products/Debug/include -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/DerivedSources/x86_64 -Xcc -I/Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/wangtz/Projects/swift/Example/TensotFlowSwiftTest -emit-module-doc-path /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/mainpartial.swiftdoc -serialize-diagnostics-path /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/main.dia -module-name TensotFlowTest -emit-module-path /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/mainpartial.swiftmodule -emit-dependencies-path /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/main.d -emit-reference-dependencies-path /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/main.swiftdeps -o /Users/wangtz/Library/Developer/Xcode/DerivedData/TensotFlowTest-fuvaitqezlugrqgwukmtlrcfypbx/Build/Intermediates.noindex/TensotFlowTest.build/Debug/TensotFlowTest.build/Objects-normal/x86_64/main.o

  1. While running pass Allow breaks before member access dots. #254 SILModuleTransform "TFDeabstraction".
  2. TFDeabstraction on function main�
  3. TFDeabstraction::inlineCalls�

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions