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

Errors while switching to stock toolchain #610

Open
porterchild opened this issue Feb 15, 2021 · 9 comments
Open

Errors while switching to stock toolchain #610

porterchild opened this issue Feb 15, 2021 · 9 comments

Comments

@porterchild
Copy link
Contributor

While switching from the 0.12 S4TF release to a stock toolchain from https://swift.org/download/#releases, I've gotten some compiler errors.

  1. When extending Optional and using TangentVector, the compiler says 'TangentVector' is not a member type of 'Optional'. This surprises me. Am I missing something?
  2. When using the KeyPathIterable implementation from swift-apis, I get the error "Cannot find '_forEachFieldWithKeyPath' in scope ", which I thought would be fixed by this PR. I've made sure to use @_spi(Reflection) to import the special function.

Any help would be appreciated.

@dan-zheng
Copy link
Member

Hi Porter,

Thanks for reporting. Could you please share the stock toolchain that you've downloaded?

@porterchild
Copy link
Contributor Author

Sure it's the Tag: swift-5.3.3-RELEASE

@dan-zheng
Copy link
Member

Sure it's the Tag: swift-5.3.3-RELEASE

Could you try a trunk development snapshot instead? Those are tested in the "stock toolchain" migration PRs, be sure to follow the build instructions in the PR descriptions:

Trunk development snapshots are built from apple/swift:main branch, similar to the old Swift for TensorFlow toolchains.
Release toolchains are built from release branches and often are missing recent changes related to differentiable programming.

@porterchild
Copy link
Contributor Author

Thanks Dan, that fixed it!

@porterchild
Copy link
Contributor Author

I'm going to miss asking you obvious questions

@dan-zheng
Copy link
Member

dan-zheng commented Feb 15, 2021

I'm going to miss asking you obvious questions

I'm still around! Feel free to ping or email me anytime :)

@porterchild
Copy link
Contributor Author

Cool! Glad to know you'll still be around
I like TabNine

@porterchild
Copy link
Contributor Author

Many errors later :) , I have a few more questions:

  1. It seems like a lot of AdditiveArithmetic, KeyPathIterable, PointwiseMultiplicative.. etc. automatic synthesis is gone. I've pulled just the protocols I need from swift-apis, and I'm importing Numerics for ElementaryFunctions. I'd like to understand if I'm just missing bringing some code over from swift-apis or Numerics, or if automatic synthesis has changed since the 0.12 release compared to the latest swift mainline. I've had to write a lot more conformances manually compared to the 0.12 release.
  2. SIMDX<Float>.sum() is no longer automatically differentiable, I'm not sure why. I see no mention of it in swift-apis.

For context, I'm on the 1/14 snapshot (the latest snapshot has a new compiler crash

@porterchild porterchild reopened this Feb 18, 2021
@porterchild
Copy link
Contributor Author

Ah, I just found the comment // FIXME(TF-1103): Derivative registration does not yet support @_alwaysEmitIntoClient original functions like SIMD.sum() at https://github.com/apple/swift/blob/e3db926e0ce7bb5535e357623b8744c2c276b236/stdlib/public/Differentiation/SIMDDifferentiation.swift.gyb.
So that explains why SIMDX<Float>.sum() isn't differentiable.

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

2 participants