Skip to content

Commit

Permalink
Add FIXME and print loop index
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 22, 2024
1 parent 0e87928 commit 1ef0d23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
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")
return StmtDiff(Clone(CE));

Expand Down
4 changes: 2 additions & 2 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 Expand Up @@ -504,7 +506,6 @@ 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 @@ -521,7 +522,6 @@ 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);
//CHECK-NEXT: int *_d_in_dev = nullptr;
//CHECK-NEXT: int *in_dev = nullptr;
//CHECK-NEXT: cudaMalloc(&_d_in_dev, N * sizeof(int));
Expand Down

0 comments on commit 1ef0d23

Please sign in to comment.