Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Compiling Parameterized struct results in Abort trap: 6 #60

Closed
dave-fernandes opened this issue Aug 28, 2018 · 4 comments
Closed

Compiling Parameterized struct results in Abort trap: 6 #60

dave-fernandes opened this issue Aug 28, 2018 · 4 comments

Comments

@dave-fernandes
Copy link

Source attached.

Compilation results:

/Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift:23:7: warning: initialization of immutable value 'w1' was never used; consider replacing with assignment to '_' or removing it
                let w1 = Tensor<Float64>(randomUniform: [4, 4, 3, 8])
                ~~~~^~
                _
/Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift:42:9: warning: immutable value 'yPredicted' was never used; consider replacing with '_' or removing it
                        let (yPredicted, loss, gradients) = evaluateCost(x: x, y: y)
                             ^~~~~~~~~~
                             _
Assertion failed: (loc.isValid() && "Diagnosing attribute with invalid location"), function diagnoseAndRemoveAttr, file /usr/local/src/swift-build/swift/lib/Sema/TypeCheckAttr.cpp, line 41.
0  swift                    0x000000010a168258 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010a167497 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x000000010a1688d2 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff583b0f5a _sigtramp + 26
4  swift                    0x000000010a108876 llvm::FoldingSetBase::FindNodeOrInsertPos(llvm::FoldingSetNodeID const&, void*&) + 166
5  libsystem_c.dylib        0x00007fff5814e1ae abort + 127
6  libsystem_c.dylib        0x00007fff581161ac basename_r + 0
7  swift                    0x00000001077cd9ba void (anonymous namespace)::AttributeChecker::diagnoseAndRemoveAttr<swift::Diag<swift::DeclName, swift::AccessLevel>&, swift::DeclName, swift::AccessLevel>(swift::DeclAttribute*, swift::Diag<swift::DeclName, swift::AccessLevel>&&&, swift::DeclName&&, swift::AccessLevel&&) + 234
8  swift                    0x00000001077c6b17 swift::ASTVisitor<(anonymous namespace)::AttributeChecker, void, void, void, void, void, void>::visit(swift::DeclAttribute*) + 5447
9  swift                    0x00000001077c55b1 swift::TypeChecker::checkDeclAttributes(swift::Decl*) + 49
10 swift                    0x000000010780d460 (anonymous namespace)::DeclChecker::visitStructDecl(swift::StructDecl*) + 144
11 swift                    0x0000000107800595 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 1381
12 swift                    0x0000000107800026 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
13 swift                    0x00000001078979ec typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 1420
14 swift                    0x0000000107898823 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 2179
15 swift                    0x00000001074b3b12 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 866
16 swift                    0x00000001074b2e79 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 505
17 swift                    0x000000010684a43e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1278
18 swift                    0x0000000106848ecf swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2943
19 swift                    0x00000001067fd0c8 main + 1128
20 libdyld.dylib            0x00007fff580a2015 start + 1
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-08-15-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift -emit-module-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftmodule -emit-module-doc-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftdoc -serialize-diagnostics-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.dia -emit-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.d -emit-reference-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Developer/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -F /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -enable-testing -g -module-cache-path /Users/davef/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -O -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/Shared/Development/Projects/TensorFlow/TFTests -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-generated-files.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-own-target-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-all-target-headers.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-project-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug/include -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources/x86_64 -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources -Xcc -DDEBUG=1 -parse-as-library -module-name TFTests -o /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.o 
1.	While type-checking 'Parameters' in module 'TFTests'

Test.swift.zip

@rxwei
Copy link
Contributor

rxwei commented Aug 28, 2018

I cannot reproduce the crasher using the latest head of the tree, so the crasher may have been fixed. However, I'm getting the following error:

Downloads swift -O test.swift
test.swift:23:7: warning: initialization of immutable value 'w1' was never used; consider replacing with assignment to '_' or removing it
                let w1 = Tensor<Float64>(randomUniform: [4, 4, 3, 8])
                ~~~~^~
                _
test.swift:42:9: warning: immutable value 'yPredicted' was never used; consider replacing with '_' or removing it
                        let (yPredicted, loss, gradients) = evaluateCost(x: x, y: y)
                             ^~~~~~~~~~
                             _
test.swift:45:4: error: overlapping accesses to 'self', but modification requires exclusive access; consider copying to a local variable
                        allParameters.update(withGradients: gradients)
                        ^~~~~~~~~~~~~
test.swift:47:21: note: conflicting access is here
                                param -= grad * learningRate
                                                ^~~~~~~~~~~~
test.swift:24:2: error: return from initializer without initializing all stored properties
        }
        ^
test.swift:15:19: note: 'self.w1' not initialized
        @TFParameter var w1: Tensor<Float64>
                         ^

I'll investigate this in the next few days.

@johndpope
Copy link
Contributor

try the github branch on referenced ticket

@johndpope
Copy link
Contributor

johndpope commented Sep 7, 2018

If I set ENABLE_TESTABILITY = NO;
then it builds.

UPDATE -
this helped compile / but then crashed at run time.
https://github.com/saschaschramm/SwiftReinforce/blob/master/SwiftReinforce/Common/DEPRECATEDModel.swift

The model was refactored without registering to parameters / and then works.
https://github.com/saschaschramm/SwiftReinforce/blob/master/SwiftReinforce/Common/Model.swift

johndpope referenced this issue in dan-zheng/swift Sep 7, 2018
…tribute.

No part of the compiler, including the Clang importer, should
synthesize an attribute that would fail early attribute
validation. When it happens, it would emit diagnostics with no
location information, which is really annoyingly hard to debug.

Instead, assert that this doesn't happen, i.e., both that the Clang
importer doesn't synthesize bogus attributes (as in the previous
commit) and that nothing synthesizes such attributes with empty source
location informations.

In non-asserting builds, just suppress the diagnostic.
@rxwei
Copy link
Contributor

rxwei commented Feb 12, 2019

Parameterized and @TFParameter have now been deprecated! Please check out https://github.com/tensorflow/swift-apis for deep learning APIs using the KeyPathIterable mechanism to iterate over and optimize parameters.

@rxwei rxwei closed this as completed Feb 12, 2019
brettkoonce pushed a commit to brettkoonce/swift that referenced this issue Mar 14, 2019
* Update samples to not use Ingress.

This is follow-up of knative/serving#1228.  We
moved to Istio v1alpha3 / Gateway which requires a different way to
get the external IP address to send traffic to our samples.

* Also update the command to find service domain.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants