Skip to content

Commit

Permalink
Debug self host: Atomic ops on non-global memory not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Oct 8, 2024
1 parent 54c8954 commit 880a77b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
}

bool ReverseModeVisitor::shouldUseCudaAtomicOps() {
return m_DiffReq->hasAttr<clang::CUDAGlobalAttr>() ||
(m_DiffReq->hasAttr<clang::CUDADeviceAttr>() &&
!m_DiffReq->hasAttr<clang::CUDAHostAttr>());
return m_DiffReq->hasAttr<clang::CUDAGlobalAttr>();
}

clang::Expr* ReverseModeVisitor::BuildCallToCudaAtomicAdd(clang::Expr* LHS,
Expand Down
4 changes: 2 additions & 2 deletions test/CUDA/GradientKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ double fn_memory(double *out, double *in) {

// CHECK: __attribute__((device)) void device_fn_pullback(double in, double val, double _d_y, double *_d_in, double *_d_val) {
//CHECK-NEXT: {
//CHECK-NEXT: atomicAdd(_d_in, _d_y);
//CHECK-NEXT: atomicAdd(_d_val, _d_y);
//CHECK-NEXT: *_d_in += _d_y;
//CHECK-NEXT: *_d_val += _d_y;
//CHECK-NEXT: }
//CHECK-NEXT:}

Expand Down

0 comments on commit 880a77b

Please sign in to comment.