Skip to content
New issue

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

[SR-14249] [AutoDiff] Assertion `fn->getLoweredFunctionType() == type' failing when building tensorflow/swift-apis #56609

Closed
swift-ci opened this issue Feb 17, 2021 · 1 comment
Assignees
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14249
Radar rdar://problem/74445948
Original Reporter BradLarson (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, AutoDiff
Assignee @rxwei
Priority Medium

md5: cead677a3aa9b7d31bece22f65cda5a8

Issue Description:

Using the latest nightly toolchains, building the tensorflow/swift-apis project results in the following assertion failure:

{{
swift-frontend: /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/swift/lib/SIL/IR/SILFunctionBuilder.cpp:25: swift::SILFunction *swift::SILFunctionBuilder::getOrCreateFunction(swift::SILLocation, llvm::StringRef, swift::SILLinkage, swift::CanSILFunctionType, swift::IsBare_t, swift::IsTransparent_t, swift::IsSerialized_t, swift::IsDynamicallyReplaceable_t, swift::ProfileCounter, swift::IsThunk_t, swift::SubclassScope): Assertion `fn->getLoweredFunctionType() == type' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /home/larson/swift/usr/bin/swift-frontend -frontend -c ../Sources/TensorFlow/BackwardsCompatibility.swift ../Sources/TensorFlow/Context.swift ../Sources/TensorFlow/Exports.swift ../Sources/TensorFlow/Freezable.swift ../Sources/TensorFlow/Initializers.swift -primary-file ../Sources/TensorFlow/Layer.swift ../Sources/TensorFlow/Loss.swift ../Sources/TensorFlow/StdlibExtensions.swift ../Sources/TensorFlow/Bindings/EagerExecution.swift ../Sources/TensorFlow/Bindings/RawOpsGenerated.swift ../Sources/TensorFlow/Bindings/TFTensorOperation.swift ../Sources/TensorFlow/Bindings/RawOpsAugmented.swift ../Sources/TensorFlow/Bindings/RawOpsDispatching.swift ../Sources/TensorFlow/Core/ArrayOps.swift ../Sources/TensorFlow/Core/CopyableToDevice.swift ../Sources/TensorFlow/Core/DataTypes.swift ../Sources/TensorFlow/Core/DifferentialOperators.swift ../Sources/TensorFlow/Core/Execution.swift ../Sources/TensorFlow/Core/LazyTensorContext.swift ../Sources/TensorFlow/Core/LazyTensorOperation.swift ../Sources/TensorFlow/Core/LazyTensorShapeInference.swift ../Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift ../Sources/TensorFlow/Core/LazyTensorTrace.swift ../Sources/TensorFlow/Core/LazyTensorTraceCache.swift ../Sources/TensorFlow/Core/BroadcastingPullback.swift ../Sources/TensorFlow/Core/MixedPrecision.swift ../Sources/TensorFlow/Core/Runtime.swift ../Sources/TensorFlow/Core/ShapedArray.swift ../Sources/TensorFlow/Core/StringTensor.swift ../Sources/TensorFlow/Core/Tensor.swift ../Sources/TensorFlow/Core/TensorGroup.swift ../Sources/TensorFlow/Core/TensorHandle.swift ../Sources/TensorFlow/Core/TensorShape.swift ../Sources/TensorFlow/Core/Threading.swift ../Sources/TensorFlow/Core/Utilities.swift ../Sources/TensorFlow/Core/KeyPathIterable.swift ../Sources/TensorFlow/Core/EuclideanDifferentiable.swift ../Sources/TensorFlow/Core/VectorProtocol.swift ../Sources/TensorFlow/Core/PointwiseMultiplicative.swift ../Sources/TensorFlow/Core/ElementaryFunctions.swift ../Sources/TensorFlow/Epochs/Algorithms.swift ../Sources/TensorFlow/Epochs/Backend.swift ../Sources/TensorFlow/Epochs/Collatable.swift ../Sources/TensorFlow/Epochs/NonuniformTrainingEpochs.swift ../Sources/TensorFlow/Epochs/Sampling.swift ../Sources/TensorFlow/Epochs/Slices.swift ../Sources/TensorFlow/Epochs/TrainingEpochs.swift ../Sources/TensorFlow/Layers/Convolutional.swift ../Sources/TensorFlow/Layers/Core.swift ../Sources/TensorFlow/Layers/Dense.swift ../Sources/TensorFlow/Layers/Dropout.swift ../Sources/TensorFlow/Layers/Embedding.swift ../Sources/TensorFlow/Layers/Initialization.swift ../Sources/TensorFlow/Layers/Morphological.swift ../Sources/TensorFlow/Layers/Normalization.swift ../Sources/TensorFlow/Layers/Pooling.swift ../Sources/TensorFlow/Layers/Recurrent.swift ../Sources/TensorFlow/Layers/Sequential.swift ../Sources/TensorFlow/Layers/Upsampling.swift ../Sources/TensorFlow/Operators/Basic.swift ../Sources/TensorFlow/Operators/Comparison.swift ../Sources/TensorFlow/Operators/Dataset.swift ../Sources/TensorFlow/Operators/Image.swift ../Sources/TensorFlow/Operators/LinearAlgebra.swift ../Sources/TensorFlow/Operators/Math.swift ../Sources/TensorFlow/Operators/NN.swift ../Sources/TensorFlow/Optimizers/MomentumBased.swift ../Sources/TensorFlow/Optimizers/Optimizer.swift ../Sources/TensorFlow/Optimizers/SGD.swift ../Sources/x10/swift_bindings/apis/CrossReplicaSum.swift ../Sources/x10/swift_bindings/apis/DeviceScope.swift ../Sources/x10/swift_bindings/apis/RawOpsManual.swift ../Sources/x10/swift_bindings/RawOpsXLAGenerated.swift ../Sources/x10/swift_bindings/Device.swift ../Sources/x10/swift_bindings/XLAScalarType.swift ../Sources/x10/swift_bindings/XLATensor.swift ../Sources/TensorFlow/Core/PythonConversion.swift -emit-module-path Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.swiftmodule -emit-module-doc-path Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.swiftdoc -emit-module-source-info-path Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.swiftsourceinfo -emit-dependencies-path Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.o.d -emit-reference-dependencies-path Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.o.swiftdeps -target x86_64-unknown-linux-gnu -disable-objc-interop -I ../Sources/CX10 -I ../Sources/CTensorFlow/include -I swift -I /home/larson/Library/tensorflow-2.4.0/usr/include -I swift-numerics-prefix/src/swift-numerics-build/swift -I swift-numerics-prefix/src/swift-numerics/Sources/_NumericsShims/include -enable-testing -module-link-name swiftTensorFlow -O -D DEFAULT_BACKEND_EAGER -D TENSORFLOW_USE_STANDARD_TOOLCHAIN -D TensorFlow_EXPORTS -Xllvm -sil-inline-generics -Xllvm -sil-partial-specialization -parse-as-library -module-name TensorFlow -o Sources/TensorFlow/CMakeFiles/TensorFlow.dir/Layer.swift.o

  1. Swift version 5.4-dev (LLVM 404bcd5, Swift 37d52fb)
  2. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for TensorFlow.TensorFlow)
  3. While running pass #​661 SILModuleTransform "Differentiation".
  4. While canonicalizing differentiable_function SIL node %10 = differentiable_function [parameters 1] [results 0] %6 : $@callee_guaranteed (@in_guaranteed τ_0_0.Input, @in_guaranteed τ_0_0) -> @out τ_0_0.Output // users: %15, %11
  5. While ...in SIL function "@$s10TensorFlow5LayerPAAE7forwardy6OutputQz5InputQzFAaBRzlTJrUSpSr".
    for 'forward(_:)' (at ../Sources/TensorFlow/Layer.swift:167:10)
    Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
    /home/larson/swift/usr/bin/swift-frontend[0x5cbd9b3]
    /home/larson/swift/usr/bin/swift-frontend[0x5cbb70e]
    /home/larson/swift/usr/bin/swift-frontend[0x5cbdd3c]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7fb0701a98a0]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fb06ea4bf47]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fb06ea4d8b1]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3042a)[0x7fb06ea3d42a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x304a2)[0x7fb06ea3d4a2]
    /home/larson/swift/usr/bin/swift-frontend[0x15ae7e6]
    /home/larson/swift/usr/bin/swift-frontend[0x15af65c]
    /home/larson/swift/usr/bin/swift-frontend[0x11e5e23]
    /home/larson/swift/usr/bin/swift-frontend[0x11e8b6e]
    /home/larson/swift/usr/bin/swift-frontend[0x11424da]
    /home/larson/swift/usr/bin/swift-frontend[0x113d659]
    /home/larson/swift/usr/bin/swift-frontend[0x113ac45]
    /home/larson/swift/usr/bin/swift-frontend[0xd328af]
    /home/larson/swift/usr/bin/swift-frontend[0xd35431]
    /home/larson/swift/usr/bin/swift-frontend[0xd2f0a8]
    /home/larson/swift/usr/bin/swift-frontend[0xd2f05b]
    /home/larson/swift/usr/bin/swift-frontend[0xd4c40a]
    /home/larson/swift/usr/bin/swift-frontend[0xd3a734]
    /home/larson/swift/usr/bin/swift-frontend[0xd2f275]
    /home/larson/swift/usr/bin/swift-frontend[0xd3c1a1]
    /home/larson/swift/usr/bin/swift-frontend[0x6b9099]
    /home/larson/swift/usr/bin/swift-frontend[0x524ac1]
    /home/larson/swift/usr/bin/swift-frontend[0x5243cc]
    /home/larson/swift/usr/bin/swift-frontend[0x5181d7]
    /home/larson/swift/usr/bin/swift-frontend[0x4ad906]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fb06ea2eb97]
    /home/larson/swift/usr/bin/swift-frontend[0x4ad57a]
    :0: error: unable to execute command: Aborted
    :0: error: compile command failed due to signal 6 (use -v to see invocation)
    ninja: build stopped: subcommand failed. }}

To reproduce, clone tensorflow/swift-apis, download a prebuilt X10 binary matching your platform, and unarchive that into your $HOME directory.

Within swift-apis, create a build directory and run the following:

cmake -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_Swift_COMPILER=$(which swiftc) -D TENSORFLOW_USE_STANDARD_TOOLCHAIN=YES -D BUILD_SHARED_LIBS=YES -D X10_LIBRARY=$HOME/Library/tensorflow-2.4.0/usr -D X10_INCLUDE_DIRS=$HOME/Library/tensorflow-2.4.0/usr/include -G Ninja -S ./

cmake --build ./build

@rxwei
Copy link
Member

rxwei commented Feb 17, 2021

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants