Skip to content

[ASTGen] Generate AutoDiff attributes #79808

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
merged 1 commit into from
Mar 7, 2025

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 5, 2025

@differentiable, @derivative and @transpose

@rintaro
Copy link
Member Author

rintaro commented Mar 5, 2025

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Mar 6, 2025

@swift-ci Please smoke test Linux

@@ -879,6 +942,30 @@ BridgedCustomAttr BridgedCustomAttr_createParsed(
BridgedNullableCustomAttributeInitializer cInitContext,
BridgedNullableArgumentList cArgumentList);

SWIFT_NAME("BridgedDerivativeAttr.createParsed(_:atLoc:range:baseType:"
"orignalName:originalNameLoc:accessorKind:params:)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"orignalName:originalNameLoc:accessorKind:params:)")
"originalName:originalNameLoc:accessorKind:params:)")

BridgedDerivativeAttr BridgedDerivativeAttr_createParsed(
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
BridgedSourceRange cRange, BridgedNullableTypeRepr cBaseType,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOriginalNameLoc,

BridgedAccessorKind cAccessorKind, BridgedArrayRef cParams);

SWIFT_NAME("BridgedDerivativeAttr.createParsed(_:atLoc:range:baseType:"
"orignalName:originalNameLoc:params:)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"orignalName:originalNameLoc:params:)")
"originalName:originalNameLoc:params:)")

BridgedDerivativeAttr BridgedDerivativeAttr_createParsed(
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
BridgedSourceRange cRange, BridgedNullableTypeRepr cBaseType,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOriginalNameLoc,

@@ -1260,6 +1347,15 @@ BridgedSILGenNameAttr BridgedSILGenNameAttr_createParsed(
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
BridgedSourceRange cRange, BridgedStringRef cName, bool isRaw);

SWIFT_NAME(
"BridgedTransposeAttr.createParsed(_:atLoc:range:baseType:orignalName:"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"BridgedTransposeAttr.createParsed(_:atLoc:range:baseType:orignalName:"
"BridgedTransposeAttr.createParsed(_:atLoc:range:baseType:originalName:"

BridgedTransposeAttr BridgedTransposeAttr_createParsed(
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
BridgedSourceRange cRange, BridgedNullableTypeRepr cBaseType,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOrignalNameLoc,
BridgedDeclNameRef cOriginalName, BridgedDeclNameLoc cOriginalNameLoc,

@@ -553,6 +553,176 @@ extension ASTGenVisitor {
)
}

struct GeneratedDerivativeOrignalDecl {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
struct GeneratedDerivativeOrignalDecl {
struct GeneratedDerivativeOriginalDecl {

`@differentiable`, `@derivative` and `@transpose`
@rintaro
Copy link
Member Author

rintaro commented Mar 6, 2025

@swift-ci Please smoke test

@rintaro rintaro enabled auto-merge March 6, 2025 20:13
@rintaro
Copy link
Member Author

rintaro commented Mar 7, 2025

swiftlang/swift-testing#1002
@swift-ci Please smoke test

@rintaro rintaro merged commit 35beeca into swiftlang:main Mar 7, 2025
3 checks passed

// RUN: %target-typecheck-verify-swift

import _Differentiation
Copy link
Contributor

Choose a reason for hiding this comment

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

This test might want to add REQUIRED: differentiable_programming or be moved into the test/AutoDiff/ directory.

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.

3 participants