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

Fix tape push expr for clad array in reverse mode #640

Merged
merged 1 commit into from
Oct 14, 2023

Conversation

vaithak
Copy link
Collaborator

@vaithak vaithak commented Oct 14, 2023

Using comma expressions for pushing a clad array onto a tape generated a warning and also resulted in invalid results in some cases.

Fixes #635

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

@@ -95,7 +95,12 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
Expr* exprToPush = E;
if (auto AT = dyn_cast<ArrayType>(E->getType())) {
Expr* init = getArraySizeExpr(AT, m_Context, *this);
exprToPush = BuildOp(BO_Comma, E, init);
Expr* pushArgs[] = {E, init};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

      Expr* pushArgs[] = {E, init};
      ^

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

Merging #640 (2fe70c4) into master (41699e8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #640   +/-   ##
=======================================
  Coverage   94.05%   94.05%           
=======================================
  Files          43       43           
  Lines        6237     6241    +4     
=======================================
+ Hits         5866     5870    +4     
  Misses        371      371           
Files Coverage Δ
lib/Differentiator/ReverseModeVisitor.cpp 95.78% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
lib/Differentiator/ReverseModeVisitor.cpp 95.78% <100.00%> (+<0.01%) ⬆️

Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@vgvassilev vgvassilev merged commit c468fa8 into vgvassilev:master Oct 14, 2023
77 checks passed
@vaithak vaithak deleted the loop-fix branch March 13, 2024 13:23
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.

Bug: Adding dummy loop breaks gradient in special circumstances
2 participants