swift icon indicating copy to clipboard operation
swift copied to clipboard

Errors while switching to stock toolchain

Open porterchild opened this issue 3 years ago • 9 comments

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.

porterchild avatar Feb 15 '21 22:02 porterchild

Hi Porter,

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

dan-zheng avatar Feb 15 '21 22:02 dan-zheng

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

porterchild avatar Feb 15 '21 22:02 porterchild

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.

dan-zheng avatar Feb 15 '21 22:02 dan-zheng

Thanks Dan, that fixed it!

porterchild avatar Feb 15 '21 22:02 porterchild

I'm going to miss asking you obvious questions

porterchild avatar Feb 15 '21 22:02 porterchild

I'm going to miss asking you obvious questions

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

dan-zheng avatar Feb 15 '21 22:02 dan-zheng

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

porterchild avatar Feb 15 '21 22:02 porterchild

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 avatar Feb 18 '21 21:02 porterchild

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.

porterchild avatar Feb 18 '21 21:02 porterchild