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

Clone printf and fprintf calls #1147

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,10 @@
return StmtDiff(Clone(CE));
}

// FIXME: Revisit this when variadic functions are supported.

Check warning on line 1459 in lib/Differentiator/ReverseModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/ReverseModeVisitor.cpp#L1459

Added line #L1459 was not covered by tests
if (FD->getNameAsString() == "printf" || FD->getNameAsString() == "fprintf")
kchristin22 marked this conversation as resolved.
Show resolved Hide resolved
return StmtDiff(Clone(CE));

Expr* CUDAExecConfig = nullptr;
if (const auto* KCE = dyn_cast<CUDAKernelCallExpr>(CE))
CUDAExecConfig = Clone(KCE->getConfig());
Expand Down
2 changes: 2 additions & 0 deletions test/CUDA/GradientKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ double fn_memory(double *out, double *in) {
cudaMemcpy(out_host, out, 10 * sizeof(double), cudaMemcpyDeviceToHost);
double res = 0;
for (int i=0; i < 10; ++i) {
printf("Writing result of out[%d]\n", i);
res += out_host[i];
}
free(out_host);
Expand Down Expand Up @@ -469,6 +470,7 @@ double fn_memory(double *out, double *in) {
//CHECK-NEXT: break;
//CHECK-NEXT: }
//CHECK-NEXT: _t0++;
//CHECK-NEXT: printf("Writing result of out[%d]\n", i);
//CHECK-NEXT: clad::push(_t1, res);
//CHECK-NEXT: res += out_host[i];
//CHECK-NEXT: }
Expand Down
Loading