Skip to content

Commit ef5f620

Browse files
bottlerfacebook-github-bot
authored andcommitted
nondeterminism warnings
Summary: do like xformers. Reviewed By: shapovalov Differential Revision: D44541873 fbshipit-source-id: 2c23160591cd9026fcd4972998d1bc90adba1356
1 parent 3e3644e commit ef5f620

File tree

7 files changed

+24
-1
lines changed

7 files changed

+24
-1
lines changed

pytorch3d/csrc/face_areas_normals/face_areas_normals.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ at::Tensor FaceAreasNormalsBackwardCuda(
266266
grad_normals_t{grad_normals, "grad_normals", 4};
267267
at::CheckedFrom c = "FaceAreasNormalsBackwardCuda";
268268
at::checkAllSameGPU(c, {verts_t, faces_t, grad_areas_t, grad_normals_t});
269+
// This is nondeterministic because atomicAdd
270+
at::globalContext().alertNotDeterministic("FaceAreasNormalsBackwardCuda");
269271

270272
// Set the device for the kernel launch based on the device of verts
271273
at::cuda::CUDAGuard device_guard(verts.device());

pytorch3d/csrc/interp_face_attrs/interp_face_attrs.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ std::tuple<at::Tensor, at::Tensor> InterpFaceAttrsBackwardCuda(
130130
at::checkAllSameType(
131131
c, {barycentric_coords_t, face_attrs_t, grad_pix_attrs_t});
132132

133+
// This is nondeterministic because atomicAdd
134+
at::globalContext().alertNotDeterministic("InterpFaceAttrsBackwardCuda");
135+
133136
// Set the device for the kernel launch based on the input
134137
at::cuda::CUDAGuard device_guard(pix_to_face.device());
135138
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

pytorch3d/csrc/knn/knn.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ std::tuple<at::Tensor, at::Tensor> KNearestNeighborBackwardCuda(
534534
c, {p1_t, p2_t, lengths1_t, lengths2_t, idxs_t, grad_dists_t});
535535
at::checkAllSameType(c, {p1_t, p2_t, grad_dists_t});
536536

537+
// This is nondeterministic because atomicAdd
538+
at::globalContext().alertNotDeterministic("KNearestNeighborBackwardCuda");
539+
537540
// Set the device for the kernel launch based on the device of the input
538541
at::cuda::CUDAGuard device_guard(p1.device());
539542
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

pytorch3d/csrc/point_mesh/point_mesh_cuda.cu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ std::tuple<at::Tensor, at::Tensor> DistanceBackwardCuda(
305305
at::CheckedFrom c = "DistanceBackwardCuda";
306306
at::checkAllSameGPU(c, {objects_t, targets_t, idx_objects_t, grad_dists_t});
307307
at::checkAllSameType(c, {objects_t, targets_t, grad_dists_t});
308+
// This is nondeterministic because atomicAdd
309+
at::globalContext().alertNotDeterministic("DistanceBackwardCuda");
308310

309311
// Set the device for the kernel launch based on the device of the input
310312
at::cuda::CUDAGuard device_guard(objects.device());
@@ -624,6 +626,9 @@ std::tuple<at::Tensor, at::Tensor> PointFaceArrayDistanceBackwardCuda(
624626
at::CheckedFrom c = "PointFaceArrayDistanceBackwardCuda";
625627
at::checkAllSameGPU(c, {points_t, tris_t, grad_dists_t});
626628
at::checkAllSameType(c, {points_t, tris_t, grad_dists_t});
629+
// This is nondeterministic because atomicAdd
630+
at::globalContext().alertNotDeterministic(
631+
"PointFaceArrayDistanceBackwardCuda");
627632

628633
// Set the device for the kernel launch based on the device of the input
629634
at::cuda::CUDAGuard device_guard(points.device());
@@ -787,6 +792,9 @@ std::tuple<at::Tensor, at::Tensor> PointEdgeArrayDistanceBackwardCuda(
787792
at::CheckedFrom c = "PointEdgeArrayDistanceBackwardCuda";
788793
at::checkAllSameGPU(c, {points_t, segms_t, grad_dists_t});
789794
at::checkAllSameType(c, {points_t, segms_t, grad_dists_t});
795+
// This is nondeterministic because atomicAdd
796+
at::globalContext().alertNotDeterministic(
797+
"PointEdgeArrayDistanceBackwardCuda");
790798

791799
// Set the device for the kernel launch based on the device of the input
792800
at::cuda::CUDAGuard device_guard(points.device());

pytorch3d/csrc/points_to_volumes/points_to_volumes.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ void PointsToVolumesForwardCuda(
141141
grid_sizes_t,
142142
mask_t});
143143

144+
// This is nondeterministic because atomicAdd
145+
at::globalContext().alertNotDeterministic("PointsToVolumesForwardCuda");
146+
144147
// Set the device for the kernel launch based on the device of the input
145148
at::cuda::CUDAGuard device_guard(points_3d.device());
146149
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

pytorch3d/csrc/rasterize_meshes/rasterize_meshes.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ at::Tensor RasterizeMeshesBackwardCuda(
583583
at::checkAllSameType(
584584
c, {face_verts_t, grad_zbuf_t, grad_bary_t, grad_dists_t});
585585

586+
// This is nondeterministic because atomicAdd
587+
at::globalContext().alertNotDeterministic("RasterizeMeshesBackwardCuda");
588+
586589
// Set the device for the kernel launch based on the device of the input
587590
at::cuda::CUDAGuard device_guard(face_verts.device());
588591
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

pytorch3d/csrc/rasterize_points/rasterize_points.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ at::Tensor RasterizePointsBackwardCuda(
423423
at::CheckedFrom c = "RasterizePointsBackwardCuda";
424424
at::checkAllSameGPU(c, {points_t, idxs_t, grad_zbuf_t, grad_dists_t});
425425
at::checkAllSameType(c, {points_t, grad_zbuf_t, grad_dists_t});
426-
426+
// This is nondeterministic because atomicAdd
427+
at::globalContext().alertNotDeterministic("RasterizePointsBackwardCuda");
427428
// Set the device for the kernel launch based on the device of the input
428429
at::cuda::CUDAGuard device_guard(points.device());
429430
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

0 commit comments

Comments
 (0)