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

Try to improve literal types #998

Merged
merged 27 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2b2af14
Try to improve literal types
vaithak Jul 22, 2024
61982a1
Try to improve literal types
vaithak Jul 22, 2024
4432e1f
Merge remote-tracking branch 'refs/remotes/vaithak/cuda-bug' into cud…
kchristin22 Aug 3, 2024
4b57f76
Get enum's underlying value type
kchristin22 Aug 3, 2024
1f4e2a3
Try to improve literal types
vaithak Jul 22, 2024
97acf5f
Get enum's underlying value type
kchristin22 Aug 3, 2024
aee91cd
Zero initialization based on type
kchristin22 Aug 8, 2024
6130c91
Fix pointer zero initialization
kchristin22 Aug 13, 2024
98352a8
Merge with master
kchristin22 Aug 13, 2024
1de6bbe
Merge remote-tracking branch 'vaithak/cuda-bug' into cuda-bug
kchristin22 Aug 13, 2024
17012c0
Fix format
kchristin22 Aug 13, 2024
9feae1b
Fix compatibility of zero initialization of unsigned ints in tests
kchristin22 Aug 13, 2024
03fbcec
Fix clang-tidy suggestions
kchristin22 Aug 13, 2024
1a1e25b
Remove unnecessary leftover casting for zero initilization
kchristin22 Aug 21, 2024
2dc1126
Merge branch 'master' into cuda-bug
kchristin22 Aug 21, 2024
ac042f9
Fix STL test
kchristin22 Aug 21, 2024
69075f1
Synthesize booleans separately from integers and cast type to int whe…
kchristin22 Aug 26, 2024
3a593d0
Create the boolean literal with the new keyword for compatibility rea…
kchristin22 Aug 26, 2024
d3740e4
Remove fail case of type for zero initialization
kchristin22 Aug 26, 2024
2e6b9d0
Add complex type test
kchristin22 Aug 26, 2024
2a8655e
Revert "Add complex type test"
kchristin22 Aug 26, 2024
df2617d
Remove check for nonRealType before calling synthesizeLiteral
kchristin22 Sep 2, 2024
6816d9a
Initialize pointers as nullptr and add a default int case for literal…
kchristin22 Sep 2, 2024
f7b3caa
Merge branch 'master' into cuda-bug
kchristin22 Sep 2, 2024
c74882d
Fix clang format
kchristin22 Sep 2, 2024
fd45301
Init chars as ints to remove suffix
kchristin22 Sep 3, 2024
0413ab7
Use AnyCharacterType check instead of plain CharType
kchristin22 Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/Differentiator/BaseForwardModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,9 @@ StmtDiff BaseForwardModeVisitor::VisitDeclRefExpr(const DeclRefExpr* DRE) {
// If DRE is of type pointer, then the derivative is a null pointer.
if (clonedDRE->getType()->isPointerType())
return StmtDiff(clonedDRE, nullptr);
QualType literalTy = utils::GetValueType(clonedDRE->getType());
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 extend visitorbase::getZeroInit as discussed here #989 (comment)

cc: @gojakuch

return StmtDiff(clonedDRE, ConstantFolder::synthesizeLiteral(
m_Context.IntTy, m_Context, /*val=*/0));
literalTy, m_Context, /*val=*/0));
}

StmtDiff BaseForwardModeVisitor::VisitIntegerLiteral(const IntegerLiteral* IL) {
Expand Down Expand Up @@ -1374,8 +1375,10 @@ StmtDiff BaseForwardModeVisitor::VisitUnaryOperator(const UnaryOperator* UnOp) {
} else if (opKind == UnaryOperatorKind::UO_Deref) {
if (Expr* dx = diff.getExpr_dx())
return StmtDiff(op, BuildOp(opKind, dx));
return StmtDiff(op, ConstantFolder::synthesizeLiteral(
m_Context.IntTy, m_Context, /*val=*/0));
QualType literalTy =
utils::GetValueType(UnOp->getSubExpr()->getType()->getPointeeType());
return StmtDiff(
op, ConstantFolder::synthesizeLiteral(literalTy, m_Context, /*val=*/0));
} else if (opKind == UnaryOperatorKind::UO_AddrOf) {
return StmtDiff(op, BuildOp(opKind, diff.getExpr_dx()));
} else if (opKind == UnaryOperatorKind::UO_LNot) {
Expand Down
4 changes: 4 additions & 0 deletions lib/Differentiator/CladUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ namespace clad {
else if (T->isArrayType())
valueType =
T->getPointeeOrArrayElementType()->getCanonicalTypeInternal();
else if (T->isEnumeralType()) {
if (const auto* ET = dyn_cast<EnumType>(T))
valueType = ET->getDecl()->getIntegerType();
}
valueType.removeLocalConst();
return valueType;
}
Expand Down
32 changes: 27 additions & 5 deletions lib/Differentiator/ConstantFolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ namespace clad {
return FloatingLiteral::Create(C, val, /*isexact*/true, QT, noLoc);
}

static Expr* synthesizeLiteral(QualType QT, ASTContext& C, bool val) {
assert(QT->isBooleanType() && "Not a boolean type.");
SourceLocation noLoc;
return new (C) CXXBoolLiteralExpr(val, QT, noLoc);
}

static Expr* synthesizeLiteral(QualType QT, ASTContext& C) {
assert(QT->isPointerType() && "Not a pointer type.");
SourceLocation noLoc;
return new (C) CXXNullPtrLiteralExpr(QT, noLoc);
}

Expr* ConstantFolder::trivialFold(Expr* E) {
Expr::EvalResult Result;
if (E->EvaluateAsRValue(Result, m_Context)) {
Expand Down Expand Up @@ -126,18 +138,28 @@ namespace clad {

Expr* ConstantFolder::synthesizeLiteral(QualType QT, ASTContext& C,
uint64_t val) {
//SourceLocation noLoc;
// SourceLocation noLoc;
Expr* Result = 0;
if (QT->isIntegralType(C)) {
QT = QT.getCanonicalType();
if (QT->isPointerType()) {
Result = clad::synthesizeLiteral(QT, C);
} else if (QT->isBooleanType()) {
Result = clad::synthesizeLiteral(QT, C, (bool)val);
} else if (QT->isIntegralType(C)) {
if (QT->isAnyCharacterType())
QT = C.IntTy;
llvm::APInt APVal(C.getIntWidth(QT), val,
QT->isSignedIntegerOrEnumerationType());
Result = clad::synthesizeLiteral(QT, C, APVal);
}
else {
} else if (QT->isRealFloatingType()) {
llvm::APFloat APVal(C.getFloatTypeSemantics(QT), val);
Result = clad::synthesizeLiteral(QT, C, APVal);
} else {
// FIXME: Handle other types, like Complex, Structs, typedefs, etc.
// typecasting may be needed right now
Result = ConstantFolder::synthesizeLiteral(C.IntTy, C, val);
}
assert(Result && "Must not be zero.");
assert(Result && "Unsupported type for constant folding.");
return Result;
}
} // end namespace clad
7 changes: 3 additions & 4 deletions lib/Differentiator/VisitorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,10 @@ namespace clad {
// FIXME: Consolidate other uses of synthesizeLiteral for creation 0 or 1.
if (T->isVoidType())
return nullptr;
if (T->isScalarType()) {
if ((T->isScalarType() || T->isPointerType()) && !T->isReferenceType()) {
ExprResult Zero =
ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0);
CastKind CK = m_Sema.PrepareScalarCast(Zero, T);
return m_Sema.ImpCastExprToType(Zero.get(), T, CK).get();
ConstantFolder::synthesizeLiteral(T, m_Context, /*val=*/0);
return Zero.get();
}
vgvassilev marked this conversation as resolved.
Show resolved Hide resolved
return m_Sema.ActOnInitList(noLoc, {}, noLoc).get();
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 probably sink ActOnInitList into synthesizeLiteral but let's do it outside of this pr.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it makes sense to be in getZeroInit as we initialize with an empty list, while synthesizeLiteral is used in other places as well

}
Expand Down
12 changes: 6 additions & 6 deletions test/Analyses/TBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ double f1(double x) {
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: double _d_t = 0;
//CHECK-NEXT: double _d_t = 0.;
//CHECK-NEXT: double t = 1;
//CHECK-NEXT: unsigned {{int|long}} _t0 = {{0U|0UL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand All @@ -37,7 +37,7 @@ double f1(double x) {
//CHECK-NEXT: }
//CHECK-NEXT: t = clad::pop(_t1);
//CHECK-NEXT: double _r_d0 = _d_t;
//CHECK-NEXT: _d_t = 0;
//CHECK-NEXT: _d_t = 0.;
//CHECK-NEXT: _d_t += _r_d0 * x;
//CHECK-NEXT: *_d_x += t * _r_d0;
//CHECK-NEXT: }
Expand All @@ -58,7 +58,7 @@ double f2(double val) {
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<bool> _cond0 = {};
//CHECK-NEXT: clad::tape<unsigned {{int|long}}> _t1 = {};
//CHECK-NEXT: double _d_res = 0;
//CHECK-NEXT: double _d_res = 0.;
//CHECK-NEXT: double res = 0;
//CHECK-NEXT: unsigned {{int|long}} _t0 = {{0U|0UL}};
//CHECK-NEXT: for (i = 1; ; ++i) {
Expand Down Expand Up @@ -120,11 +120,11 @@ double f3 (double x){
//CHECK-NEXT: bool _cond0;
//CHECK-NEXT: bool _cond1;
//CHECK-NEXT: bool _cond2;
//CHECK-NEXT: double _d_i = 0;
//CHECK-NEXT: double _d_i = 0.;
//CHECK-NEXT: double i = 1;
//CHECK-NEXT: double _d_j = 0;
//CHECK-NEXT: double _d_j = 0.;
//CHECK-NEXT: double j = 0;
//CHECK-NEXT: double _d_res = 0;
//CHECK-NEXT: double _d_res = 0.;
//CHECK-NEXT: double res = 0;
//CHECK-NEXT: res += i * x;
//CHECK-NEXT: {
Expand Down
4 changes: 2 additions & 2 deletions test/Arrays/ArrayInputsForwardMode.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ double multiply(const double *arr) {
}

//CHECK: double multiply_darg0_1(const double *arr) {
//CHECK-NEXT: return 0 * arr[1] + arr[0] * 1.;
//CHECK-NEXT: return 0. * arr[1] + arr[0] * 1.;
//CHECK-NEXT: }

double divide(const double *arr) {
return arr[0] / arr[1];
}

//CHECK: double divide_darg0_1(const double *arr) {
//CHECK-NEXT: return (0 * arr[1] - arr[0] * 1.) / (arr[1] * arr[1]);
//CHECK-NEXT: return (0. * arr[1] - arr[0] * 1.) / (arr[1] * arr[1]);
//CHECK-NEXT: }

double addArr(const double *arr, int n) {
Expand Down
46 changes: 23 additions & 23 deletions test/Arrays/ArrayInputsReverseMode.C
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ float func(float* a, float* b) {
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
//CHECK-NEXT: clad::tape<float> _t2 = {};
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: float _d_sum = 0.F;
//CHECK-NEXT: float sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand Down Expand Up @@ -71,7 +71,7 @@ float func(float* a, float* b) {
//CHECK-NEXT: {
//CHECK-NEXT: a[i] = clad::pop(_t1);
//CHECK-NEXT: float _r_d0 = _d_a[i];
//CHECK-NEXT: _d_a[i] = 0;
//CHECK-NEXT: _d_a[i] = 0.F;
//CHECK-NEXT: _d_a[i] += _r_d0 * b[i];
//CHECK-NEXT: _d_b[i] += a[i] * _r_d0;
//CHECK-NEXT: }
Expand All @@ -95,7 +95,7 @@ float func2(float* a) {
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: float _d_sum = 0.F;
//CHECK-NEXT: float sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand All @@ -116,7 +116,7 @@ float func2(float* a) {
//CHECK-NEXT: i--;
//CHECK-NEXT: sum = clad::pop(_t1);
//CHECK-NEXT: float _r_d0 = _d_sum;
//CHECK-NEXT: float _r0 = 0;
//CHECK-NEXT: float _r0 = 0.F;
//CHECK-NEXT: helper_pullback(a[i], _r_d0, &_r0);
//CHECK-NEXT: _d_a[i] += _r0;
//CHECK-NEXT: }
Expand All @@ -134,7 +134,7 @@ float func3(float* a, float* b) {
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
//CHECK-NEXT: clad::tape<float> _t2 = {};
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: float _d_sum = 0.F;
//CHECK-NEXT: float sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand Down Expand Up @@ -178,7 +178,7 @@ double func4(double x) {
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: double _d_arr[3] = {0};
//CHECK-NEXT: double arr[3] = {x, 2 * x, x * x};
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: double _d_sum = 0.;
//CHECK-NEXT: double sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand Down Expand Up @@ -251,7 +251,7 @@ double func5(int k) {
//CHECK-NEXT: clad::push(_t1, arr[i]);
//CHECK-NEXT: arr[i] = k;
//CHECK-NEXT: }
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: double _d_sum = 0.;
//CHECK-NEXT: double sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t2 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i0 = 0; ; i0++) {
Expand Down Expand Up @@ -287,7 +287,7 @@ double func5(int k) {
//CHECK-NEXT: {
//CHECK-NEXT: arr[i] = clad::pop(_t1);
//CHECK-NEXT: double _r_d0 = _d_arr[i];
//CHECK-NEXT: _d_arr[i] = 0;
//CHECK-NEXT: _d_arr[i] = 0.;
//CHECK-NEXT: *_d_k += _r_d0;
//CHECK-NEXT: }
//CHECK-NEXT: }
Expand All @@ -310,7 +310,7 @@ double func6(double seed) {
//CHECK-NEXT: double _d_arr[3] = {0};
//CHECK-NEXT: clad::array<double> arr({{3U|3UL|3ULL}});
//CHECK-NEXT: clad::tape<double> _t2 = {};
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: double _d_sum = 0.;
//CHECK-NEXT: double sum = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand Down Expand Up @@ -364,13 +364,13 @@ double func7(double *params) {
}

//CHECK: void func7_grad(double *params, double *_d_params) {
//CHECK-NEXT: std::size_t _d_i = 0;
//CHECK-NEXT: std::size_t i = 0;
//CHECK-NEXT: std::size_t _d_i = {{0U|0UL}};
//CHECK-NEXT: std::size_t i = {{0U|0UL}};
//CHECK-NEXT: clad::tape<clad::array<double> > _t1 = {};
//CHECK-NEXT: double _d_paramsPrime[1] = {0};
//CHECK-NEXT: clad::array<double> paramsPrime({{1U|1UL|1ULL}});
//CHECK-NEXT: clad::tape<double> _t2 = {};
//CHECK-NEXT: double _d_out = 0;
//CHECK-NEXT: double _d_out = 0.;
//CHECK-NEXT: double out = 0.;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
// CHECK-NEXT: for (i = 0; ; ++i) {
Expand All @@ -393,7 +393,7 @@ double func7(double *params) {
//CHECK-NEXT: {
//CHECK-NEXT: out = clad::pop(_t2);
//CHECK-NEXT: double _r_d0 = _d_out;
//CHECK-NEXT: _d_out = 0;
//CHECK-NEXT: _d_out = 0.;
//CHECK-NEXT: _d_out += _r_d0;
//CHECK-NEXT: inv_square_pullback(paramsPrime, _r_d0, _d_paramsPrime);
//CHECK-NEXT: }
Expand All @@ -420,7 +420,7 @@ double func8(double i, double *arr, int n) {
}

//CHECK: void func8_grad(double i, double *arr, int n, double *_d_i, double *_d_arr, int *_d_n) {
//CHECK-NEXT: double _d_res = 0;
//CHECK-NEXT: double _d_res = 0.;
//CHECK-NEXT: double res = 0;
//CHECK-NEXT: double _t0 = arr[0];
//CHECK-NEXT: arr[0] = 1;
Expand All @@ -432,13 +432,13 @@ double func8(double i, double *arr, int n) {
//CHECK-NEXT: {
//CHECK-NEXT: arr[0] = _t2;
//CHECK-NEXT: double _r_d2 = _d_arr[0];
//CHECK-NEXT: _d_arr[0] = 0;
//CHECK-NEXT: _d_arr[0] = 0.;
//CHECK-NEXT: }
//CHECK-NEXT: {
//CHECK-NEXT: res = _t1;
//CHECK-NEXT: double _r_d1 = _d_res;
//CHECK-NEXT: _d_res = 0;
//CHECK-NEXT: double _r0 = 0;
//CHECK-NEXT: _d_res = 0.;
//CHECK-NEXT: double _r0 = 0.;
//CHECK-NEXT: int _r1 = 0;
//CHECK-NEXT: helper2_pullback(i, arr, n, _r_d1, &_r0, _d_arr, &_r1);
//CHECK-NEXT: *_d_i += _r0;
Expand All @@ -447,7 +447,7 @@ double func8(double i, double *arr, int n) {
//CHECK-NEXT: {
//CHECK-NEXT: arr[0] = _t0;
//CHECK-NEXT: double _r_d0 = _d_arr[0];
//CHECK-NEXT: _d_arr[0] = 0;
//CHECK-NEXT: _d_arr[0] = 0.;
//CHECK-NEXT: }
//CHECK-NEXT: }

Expand Down Expand Up @@ -497,7 +497,7 @@ double func9(double i, double j) {
//CHECK-NEXT: --idx;
//CHECK-NEXT: {
//CHECK-NEXT: arr[idx] = clad::back(_t1);
//CHECK-NEXT: double _r0 = 0;
//CHECK-NEXT: double _r0 = 0.;
//CHECK-NEXT: modify_pullback(clad::back(_t1), i, &_d_arr[idx], &_r0);
//CHECK-NEXT: clad::pop(_t1);
//CHECK-NEXT: *_d_i += _r0;
Expand Down Expand Up @@ -526,7 +526,7 @@ double func10(double *arr, int n) {
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: clad::tape<double> _t2 = {};
//CHECK-NEXT: double _d_res = 0;
//CHECK-NEXT: double _d_res = 0.;
//CHECK-NEXT: double res = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
// CHECK-NEXT: for (i = 0; ; ++i) {
Expand Down Expand Up @@ -626,7 +626,7 @@ int main() {
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: double _d_ret = 0;
//CHECK-NEXT: double _d_ret = 0.;
//CHECK-NEXT: double ret = 0;
//CHECK-NEXT: unsigned {{int|long|long long}} _t0 = {{0U|0UL|0ULL}};
// CHECK-NEXT: for (i = 0; ; i++) {
Expand Down Expand Up @@ -679,7 +679,7 @@ int main() {
//CHECK-NEXT: {
//CHECK-NEXT: elem = _t0;
//CHECK-NEXT: double _r_d0 = *_d_elem;
//CHECK-NEXT: *_d_elem = 0;
//CHECK-NEXT: *_d_elem = 0.;
//CHECK-NEXT: *_d_val += _r_d0;
//CHECK-NEXT: }
//CHECK-NEXT: }
Expand All @@ -691,7 +691,7 @@ int main() {
//CHECK-NEXT: {
//CHECK-NEXT: elem = _t0;
//CHECK-NEXT: double _r_d0 = *_d_elem;
//CHECK-NEXT: *_d_elem = 0;
//CHECK-NEXT: *_d_elem = 0.;
//CHECK-NEXT: *_d_elem += _r_d0 * elem;
//CHECK-NEXT: *_d_elem += elem * _r_d0;
//CHECK-NEXT: }
Expand Down
16 changes: 8 additions & 8 deletions test/CUDA/GradientCuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ __device__ __host__ double gauss(double* x, double* p, double sigma, int dim) {


// CHECK: void gauss_grad_1(double *x, double *p, double sigma, int dim, double *_d_p) __attribute__((device)) __attribute__((host)) {
//CHECK-NEXT: double _d_sigma = 0;
//CHECK-NEXT: double _d_sigma = 0.;
//CHECK-NEXT: int _d_dim = 0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: double _d_t = 0;
//CHECK-NEXT: double _d_t = 0.;
//CHECK-NEXT: double t = 0;
//CHECK-NEXT: unsigned long _t0 = {{0U|0UL|0ULL}};
//CHECK-NEXT: for (i = 0; ; i++) {
Expand All @@ -53,22 +53,22 @@ __device__ __host__ double gauss(double* x, double* p, double sigma, int dim) {
//CHECK-NEXT: double _t5 = std::pow(sigma, -0.5);
//CHECK-NEXT: double _t4 = std::exp(t);
//CHECK-NEXT: {
//CHECK-NEXT: double _r1 = 0;
//CHECK-NEXT: double _r2 = 0;
//CHECK-NEXT: double _r1 = 0.;
//CHECK-NEXT: double _r2 = 0.;
//CHECK-NEXT: clad::custom_derivatives{{(::std)?}}::pow_pullback(2 * 3.1415926535897931, -dim / 2., 1 * _t4 * _t5, &_r1, &_r2);
//CHECK-NEXT: _d_dim += -_r2 / 2.;
//CHECK-NEXT: double _r3 = 0;
//CHECK-NEXT: double _r4 = 0;
//CHECK-NEXT: double _r3 = 0.;
//CHECK-NEXT: double _r4 = 0.;
//CHECK-NEXT: clad::custom_derivatives{{(::std)?}}::pow_pullback(sigma, -0.5, _t6 * 1 * _t4, &_r3, &_r4);
//CHECK-NEXT: _d_sigma += _r3;
//CHECK-NEXT: double _r5 = 0;
//CHECK-NEXT: double _r5 = 0.;
//CHECK-NEXT: _r5 += _t6 * _t5 * 1 * clad::custom_derivatives::exp_pushforward(t, 1.).pushforward;
//CHECK-NEXT: _d_t += _r5;
//CHECK-NEXT: }
//CHECK-NEXT: {
//CHECK-NEXT: t = _t2;
//CHECK-NEXT: double _r_d1 = _d_t;
//CHECK-NEXT: _d_t = 0;
//CHECK-NEXT: _d_t = 0.;
//CHECK-NEXT: _d_t += -_r_d1 / _t3;
//CHECK-NEXT: double _r0 = _r_d1 * -(-t / (_t3 * _t3));
//CHECK-NEXT: _d_sigma += 2 * _r0 * sigma;
Expand Down
Loading
Loading