Skip to content
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

Differentiate global variables in the reverse mode #1153

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

PetroZarytskyi
Copy link
Collaborator

No description provided.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -286,6 +294,10 @@ class CladTimerGroup {
return P.ProcessDiffRequest(request);
}

void ProcessTopLevelDecl(CladPlugin& P, clang::Decl* D) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'ProcessTopLevelDecl' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]

    void ProcessTopLevelDecl(CladPlugin& P, clang::Decl* D) {
         ^
Additional context

tools/ClangPlugin.h:296: make as 'inline'

    void ProcessTopLevelDecl(CladPlugin& P, clang::Decl* D) {
         ^

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.57%. Comparing base (693b1bd) to head (7372dd0).

Files with missing lines Patch % Lines
tools/ClangPlugin.h 94.44% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1153      +/-   ##
==========================================
+ Coverage   94.56%   94.57%   +0.01%     
==========================================
  Files          51       51              
  Lines        8944     8979      +35     
==========================================
+ Hits         8458     8492      +34     
- Misses        486      487       +1     
Files with missing lines Coverage Δ
include/clad/Differentiator/DerivativeBuilder.h 100.00% <ø> (ø)
include/clad/Differentiator/ReverseModeVisitor.h 96.55% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <ø> (ø)
lib/Differentiator/ReverseModeVisitor.cpp 95.56% <100.00%> (-0.04%) ⬇️
lib/Differentiator/VisitorBase.cpp 97.63% <100.00%> (ø)
tools/ClangPlugin.h 94.18% <94.44%> (+0.39%) ⬆️

... and 1 file with indirect coverage changes

Files with missing lines Coverage Δ
include/clad/Differentiator/DerivativeBuilder.h 100.00% <ø> (ø)
include/clad/Differentiator/ReverseModeVisitor.h 96.55% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <ø> (ø)
lib/Differentiator/ReverseModeVisitor.cpp 95.56% <100.00%> (-0.04%) ⬇️
lib/Differentiator/VisitorBase.cpp 97.63% <100.00%> (ø)
tools/ClangPlugin.h 94.18% <94.44%> (+0.39%) ⬆️

... and 1 file with indirect coverage changes

---- 🚨 Try these New Features:

@PetroZarytskyi PetroZarytskyi marked this pull request as ready for review November 25, 2024 18:39
return StmtDiff(clonedDRE);
if (VD->isFileVarDecl() &&
!m_DiffReq->hasAttr<clang::CUDAGlobalAttr>()) {
Expr* DREDiff = DifferentiateGlobalVarDecl(VD);
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can detect if a needed variable is global in the DiffPlanner and schedule it as part of the diff graph. This would enable us to remove the ProcessTopLevelDecl which is a layering violation.

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.

2 participants