Skip to content

[AutoDiff] SILGen differentiability witnesses. #27652

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

@dan-zheng dan-zheng commented Oct 13, 2019

Generate SIL differentiability witnesses from AST @differentiable attributes,
using lowered parameter indices, result indices (currently with capacity 1 and
set index 0), and derivative generic signature.

Resolves TF-869.


The TF-866 master issue tracks all retroactive derivative registration tasks.

Todos related to this patch:

  • TF-835: lower @differentiating attribute to SIL [differentiable] attribute instead of creating implicit @differentiable attributes. This is blocked by full retroactive derivative registration, see issue comment for details.
  • TF-919: explore emitting serialized differentiability witnesses. Currently, SILGen never creates serialized differentiability witnesses to avoid deserialization issues.

@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Oct 13, 2019
@dan-zheng dan-zheng requested a review from rxwei October 13, 2019 12:28
@dan-zheng dan-zheng force-pushed the sil-differentiability-witness branch from 4d41c78 to ab624b2 Compare October 13, 2019 13:46
@dan-zheng dan-zheng force-pushed the sil-differentiability-witness branch from ab624b2 to 6f95bab Compare October 15, 2019 22:12
@dan-zheng dan-zheng marked this pull request as ready for review October 15, 2019 22:19
@dan-zheng dan-zheng force-pushed the sil-differentiability-witness branch from 6f95bab to b2f2dfe Compare October 15, 2019 22:23
@dan-zheng dan-zheng requested a review from marcrasi October 15, 2019 22:24
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

Generate SIL differentiability witnesses from AST `@differentiable` attributes,
using lowered parameter indices, result indices (currently with capacity 1 and
set index 0), and derivative generic signature.

Resolves TF-869.

The TF-866 master issue tracks all retroactive derivative registration tasks.
@dan-zheng dan-zheng force-pushed the sil-differentiability-witness branch 2 times, most recently from 10d1847 to 8688777 Compare October 15, 2019 23:44
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng
Copy link
Contributor Author

dan-zheng commented Oct 16, 2019

CI fails due to differentiability witness deserialization failures (see occurrences of UNKNOWN):

  Block ID #14 (SIL_BLOCK):
      Num Instances: 1
         Total Size: 12694b/1586.75B/396W
    Percent of file: 4.9487%
      Num SubBlocks: 0
        Num Abbrevs: 46
        Num Records: 56
    Percent Abbrevs: 100.0000%

	Record Histogram:
		  Count    # Bits     b/Rec   % Abv  Record Kind
		     16      3040     190.0  100.00  SIL_FUNCTION
		     10      2221     222.1  100.00  UnknownCode35
		      8       640      80.0  100.00  SIL_ONE_OPERAND
		      6      1144     190.7  100.00  SIL_INST_APPLY
		      4       452     113.0  100.00  SIL_ONE_TYPE_ONE_OPERAND
		      4       196      49.0  100.00  SIL_ONE_TYPE
		      4       792     198.0  100.00  SIL_BASIC_BLOCK
		      2       198      99.0  100.00  decls_block::PROTOCOL_CONFORMANCE_XREF
		      2       534     267.0  100.00  SIL_INST_WITNESS_METHOD

  Block ID #15 (SIL_INDEX_BLOCK):
      Num Instances: 1
         Total Size: 5686b/710.75B/177W
    Percent of file: 2.2167%
      Num SubBlocks: 0
        Num Abbrevs: 2
        Num Records: 4
    Percent Abbrevs: 100.0000%

	Record Histogram:
		  Count    # Bits     b/Rec   % Abv  Record Kind
		      1       324            100.00  SIL_DIFFERENTIABILITY_WITNESS_OFFSETS
		      1      1762            100.00  UnknownCode12
		      1       510            100.00  SIL_FUNC_OFFSETS
		      1      2936            100.00  SIL_FUNC_NAMES

These surfaced only after differentiability witness SILGen.

EDIT: Fixed in 4c4bc43.

Fix serialization for Serialization/differentia{ble,ting}_attr.swift.
Fix deserialization for Serialization/differentia{ble,ting}_attr.swift.
TF-919 has more info.
@dan-zheng dan-zheng force-pushed the sil-differentiability-witness branch from 8688777 to 1118fcd Compare October 16, 2019 02:26
@dan-zheng dan-zheng requested a review from rxwei October 16, 2019 02:28
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tensorflow This is for "tensorflow" branch PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants