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

Add support for array arguments in vector mode #614

Merged
merged 4 commits into from
Aug 9, 2023

Conversation

vaithak
Copy link
Collaborator

@vaithak vaithak commented Aug 6, 2023

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

There were too many comments to post at once. Showing the first 10 out of 21. Check the log or trigger a new build to see more.

demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
demos/VectorForwardMode.cpp Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Merging #614 (c921c07) into master (1d8f664) will increase coverage by 0.09%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #614      +/-   ##
==========================================
+ Coverage   93.73%   93.83%   +0.09%     
==========================================
  Files          41       41              
  Lines        5939     6032      +93     
==========================================
+ Hits         5567     5660      +93     
  Misses        372      372              
Files Changed Coverage Δ
...clude/clad/Differentiator/BaseForwardModeVisitor.h 100.00% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <ø> (ø)
lib/Differentiator/VectorForwardModeVisitor.cpp 100.00% <100.00%> (ø)
lib/Differentiator/VisitorBase.cpp 97.76% <100.00%> (+0.05%) ⬆️
Files Changed Coverage Δ
...clude/clad/Differentiator/BaseForwardModeVisitor.h 100.00% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <ø> (ø)
lib/Differentiator/VectorForwardModeVisitor.cpp 100.00% <100.00%> (ø)
lib/Differentiator/VisitorBase.cpp 97.76% <100.00%> (+0.05%) ⬆️

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

@@ -611,6 +611,25 @@
return InstantiateTemplate(GetCladArrayDecl(), {T});
}

TemplateDecl* VisitorBase::GetCladMatrixDecl() {
static TemplateDecl* Result = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'Result' provides global access to a non-const object; consider making the pointed-to data 'const' [cppcoreguidelines-avoid-non-const-global-variables]

    static TemplateDecl* Result = nullptr;
                         ^

Copy link
Owner

Choose a reason for hiding this comment

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

I am not sure I understand that diagnostics. Does it mean to add a const?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure about this, I don't get it either.

@vaithak vaithak force-pushed the vector-mode-array branch 2 times, most recently from d42ef1a to 06b006c Compare August 7, 2023 09: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.

This looks pretty good!

Comment on lines 134 to 139
if (!offsetExpr) {
offsetExpr = nonArrayIndVarCountExpr;
} else if (nonArrayIndVarCount != 0) {
offsetExpr = BuildOp(BinaryOperatorKind::BO_Add, offsetExpr,
nonArrayIndVarCountExpr);
}
Copy link
Owner

Choose a reason for hiding this comment

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

We should omit the { and }. Did clang-format add them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed manually 👍🏼 , clang-format wasn't able to fix this even after adding the RemoveBracesLLVM flag; maybe because it considers else if part as multi-line?

Copy link
Owner

Choose a reason for hiding this comment

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

Probably. It's just a lexer in the end.


// Push param types for derived params.
for (std::size_t i = 0; i < m_Function->getNumParams(); ++i)
for (std::size_t i = 0; i < m_Function->getNumParams(); ++i) {
Copy link
Owner

Choose a reason for hiding this comment

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

It seems we should fix clang-format's settings...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added RemoveBracesLLVM flag in clang-format, but this is not very reliable as stated here: https://clang.llvm.org/docs/ClangFormatStyleOptions.html

@@ -611,6 +611,25 @@
return InstantiateTemplate(GetCladArrayDecl(), {T});
}

TemplateDecl* VisitorBase::GetCladMatrixDecl() {
static TemplateDecl* Result = nullptr;
Copy link
Owner

Choose a reason for hiding this comment

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

I am not sure I understand that diagnostics. Does it mean to add a const?

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 790d978 into vgvassilev:master Aug 9, 2023
77 checks passed
@vaithak vaithak deleted the vector-mode-array branch August 9, 2023 13:15
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