Skip to content

[Autodiff upstream] Add build-script flag for differentiable programm… #27595

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

Merged

Conversation

dan-zheng
Copy link
Contributor

…ing.

Add --enable-experimental-differentiable-programming build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
#27446

Copy link
Contributor Author

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the following invocations:

  • utils/build-script --enable-experimental-differentiable-programming: enabled.
  • utils/build-script: enabled (by default).
  • utils/build-script --enable-experimental-differentiable-programming=false: disabled.

@dan-zheng dan-zheng requested review from rxwei and jckarter October 10, 2019 02:34
@dan-zheng
Copy link
Contributor Author

As discussed here, this PR adds the -enable-experimental-differentiable-programming build-script and CMake flag to gate standard library additions.

@jckarter: could you please help review (or loop in reviewers)? That would be a big help for enabling our progress.

@rxwei rxwei requested a review from DougGregor October 10, 2019 06:30
@DougGregor
Copy link
Member

Looks okay to me. @gottesmm does the build-script fu look good here?

# Compile differentiable programming sources only if enabled.
set(SWIFTLIB_DIFFERENTIABLE_PROGRAMMING_SOURCES)
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
# TODO: Add `_Differentiable` protocol.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: #27511 will add the _Differentiable protocol - separate patch to facilitate review.

@dan-zheng dan-zheng requested a review from gottesmm October 11, 2019 01:34
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 482f3e7514561a8dc370d9ee0930f35961f807f8

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 482f3e7514561a8dc370d9ee0930f35961f807f8

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 482f3e7514561a8dc370d9ee0930f35961f807f8

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 482f3e7514561a8dc370d9ee0930f35961f807f8

@dan-zheng
Copy link
Contributor Author

Pinging @gottesmm for review, as requested by him

@@ -601,6 +601,9 @@ class BuildScriptInvocation(object):
args.build_jobs)
]

if args.enable_experimental_differentiable_programming:
impl_args += ["--enable-experimental-differentiable-programming"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to do this in build-script-impl. You should be able to add this as a cmake option like this: https://github.com/apple/swift/blob/master/utils/swift_build_support/swift_build_support/products/swift.py

Copy link
Contributor Author

@dan-zheng dan-zheng Oct 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Done in 4bef66b - could you please re-review?

@dan-zheng dan-zheng requested a review from gottesmm October 14, 2019 03:20
Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests for this, no?

@dan-zheng
Copy link
Contributor Author

dan-zheng commented Oct 14, 2019

There are tests for this, no?

I updated the utils/build_swift/tests/expected_options.py test and did some manual verification. I feel that's reasonable - please let me know if you'd like further changes.

EDIT: @gottesmm shared that there are extra CMake flag tests. Added in cc2d822, mimicking existing tests:

$ python -m unittest discover -s utils/swift_build_support
Ran 140 tests in 0.236s

OK (skipped=3)

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you squash/make sure this passes pylint? Then LGTM

…ing.

Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
swiftlang#27446
@dan-zheng dan-zheng force-pushed the upstream-differentiable-programming branch from cc2d822 to 7f8d133 Compare October 14, 2019 18:00
@dan-zheng
Copy link
Contributor Author

Can you squash/make sure this passes pylint? Then LGTM

Squashed. (I tend to use "Squash and merge" when merging.)

I ran pylint with the default configuration and newly added Python code passes (or fails with the same errors as surrounding code, e.g. method name too long).

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 777ebcd7f2932cae83f8fd60ecd5a600b9c31e49

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 777ebcd7f2932cae83f8fd60ecd5a600b9c31e49

@dan-zheng
Copy link
Contributor Author

Linux CI failed due to a seemingly unrelated SourceKitLSP error:

12:35:59 2019-10-14 19:35:59.512 SourceKitLSPPackageTests.xctest[72164:9f7fe700] manifest parse error(s):
12:35:59 
/home/buildnode/jenkins/workspace/swift-PR-Linux/branch-master/tmp/TemporaryDirectory.N7tywe/pkg/Package.swift:3:5: error: type annotation missing in pattern
12:35:59 let pack
12:35:59     ^

I'll try triggering it again.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test linux

@dan-zheng
Copy link
Contributor Author

Thanks to reviewers!

@dan-zheng dan-zheng merged commit 2bd55f6 into swiftlang:master Oct 14, 2019
@dan-zheng dan-zheng deleted the upstream-differentiable-programming branch October 14, 2019 21:34
dan-zheng added a commit to dan-zheng/swift that referenced this pull request Oct 14, 2019
…ing. (swiftlang#27595)

Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
swiftlang#27446
dan-zheng added a commit that referenced this pull request Oct 20, 2019
)

Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
#27446

Mirror of #27595, with minor changes
specific to tensorflow branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants