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 1 commit
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
3 changes: 3 additions & 0 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
return StmtDiff(Clone(CE));
}

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 @@ -504,6 +504,7 @@ double fn_memory(double *out, double *in) {
//CHECK-NEXT:}

void launch_add_kernel_4(int *out, int *in, const int N) {
printf("Launching add_kernel_4 for size: %d\n", N);
int *in_dev = nullptr;
cudaMalloc(&in_dev, N * sizeof(int));
cudaMemcpy(in_dev, in, N * sizeof(int), cudaMemcpyHostToDevice);
Expand All @@ -520,6 +521,7 @@ void launch_add_kernel_4(int *out, int *in, const int N) {

// CHECK: void launch_add_kernel_4_grad_0_1(int *out, int *in, const int N, int *_d_out, int *_d_in) {
//CHECK-NEXT: int _d_N = 0;
//CHECK-NEXT: printf("Launching add_kernel_4 for size: %d\n", N);
kchristin22 marked this conversation as resolved.
Show resolved Hide resolved
//CHECK-NEXT: int *_d_in_dev = nullptr;
//CHECK-NEXT: int *in_dev = nullptr;
//CHECK-NEXT: cudaMalloc(&_d_in_dev, N * sizeof(int));
Expand Down
Loading