nondeterminism warnings

Summary: do like xformers.

Reviewed By: shapovalov

Differential Revision: D44541873

fbshipit-source-id: 2c23160591cd9026fcd4972998d1bc90adba1356
This commit is contained in:
Jeremy Reizenstein 2023-05-04 12:50:41 -07:00 committed by Facebook GitHub Bot
parent 3e3644e534
commit ef5f620263
7 changed files with 24 additions and 1 deletions

View File

@ -266,6 +266,8 @@ at::Tensor FaceAreasNormalsBackwardCuda(
grad_normals_t{grad_normals, "grad_normals", 4}; grad_normals_t{grad_normals, "grad_normals", 4};
at::CheckedFrom c = "FaceAreasNormalsBackwardCuda"; at::CheckedFrom c = "FaceAreasNormalsBackwardCuda";
at::checkAllSameGPU(c, {verts_t, faces_t, grad_areas_t, grad_normals_t}); at::checkAllSameGPU(c, {verts_t, faces_t, grad_areas_t, grad_normals_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("FaceAreasNormalsBackwardCuda");
// Set the device for the kernel launch based on the device of verts // Set the device for the kernel launch based on the device of verts
at::cuda::CUDAGuard device_guard(verts.device()); at::cuda::CUDAGuard device_guard(verts.device());

View File

@ -130,6 +130,9 @@ std::tuple<at::Tensor, at::Tensor> InterpFaceAttrsBackwardCuda(
at::checkAllSameType( at::checkAllSameType(
c, {barycentric_coords_t, face_attrs_t, grad_pix_attrs_t}); c, {barycentric_coords_t, face_attrs_t, grad_pix_attrs_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("InterpFaceAttrsBackwardCuda");
// Set the device for the kernel launch based on the input // Set the device for the kernel launch based on the input
at::cuda::CUDAGuard device_guard(pix_to_face.device()); at::cuda::CUDAGuard device_guard(pix_to_face.device());
cudaStream_t stream = at::cuda::getCurrentCUDAStream(); cudaStream_t stream = at::cuda::getCurrentCUDAStream();

View File

@ -534,6 +534,9 @@ std::tuple<at::Tensor, at::Tensor> KNearestNeighborBackwardCuda(
c, {p1_t, p2_t, lengths1_t, lengths2_t, idxs_t, grad_dists_t}); c, {p1_t, p2_t, lengths1_t, lengths2_t, idxs_t, grad_dists_t});
at::checkAllSameType(c, {p1_t, p2_t, grad_dists_t}); at::checkAllSameType(c, {p1_t, p2_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("KNearestNeighborBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(p1.device()); at::cuda::CUDAGuard device_guard(p1.device());
cudaStream_t stream = at::cuda::getCurrentCUDAStream(); cudaStream_t stream = at::cuda::getCurrentCUDAStream();

View File

@ -305,6 +305,8 @@ std::tuple<at::Tensor, at::Tensor> DistanceBackwardCuda(
at::CheckedFrom c = "DistanceBackwardCuda"; at::CheckedFrom c = "DistanceBackwardCuda";
at::checkAllSameGPU(c, {objects_t, targets_t, idx_objects_t, grad_dists_t}); at::checkAllSameGPU(c, {objects_t, targets_t, idx_objects_t, grad_dists_t});
at::checkAllSameType(c, {objects_t, targets_t, grad_dists_t}); at::checkAllSameType(c, {objects_t, targets_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("DistanceBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(objects.device()); at::cuda::CUDAGuard device_guard(objects.device());
@ -624,6 +626,9 @@ std::tuple<at::Tensor, at::Tensor> PointFaceArrayDistanceBackwardCuda(
at::CheckedFrom c = "PointFaceArrayDistanceBackwardCuda"; at::CheckedFrom c = "PointFaceArrayDistanceBackwardCuda";
at::checkAllSameGPU(c, {points_t, tris_t, grad_dists_t}); at::checkAllSameGPU(c, {points_t, tris_t, grad_dists_t});
at::checkAllSameType(c, {points_t, tris_t, grad_dists_t}); at::checkAllSameType(c, {points_t, tris_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic(
"PointFaceArrayDistanceBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(points.device()); at::cuda::CUDAGuard device_guard(points.device());
@ -787,6 +792,9 @@ std::tuple<at::Tensor, at::Tensor> PointEdgeArrayDistanceBackwardCuda(
at::CheckedFrom c = "PointEdgeArrayDistanceBackwardCuda"; at::CheckedFrom c = "PointEdgeArrayDistanceBackwardCuda";
at::checkAllSameGPU(c, {points_t, segms_t, grad_dists_t}); at::checkAllSameGPU(c, {points_t, segms_t, grad_dists_t});
at::checkAllSameType(c, {points_t, segms_t, grad_dists_t}); at::checkAllSameType(c, {points_t, segms_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic(
"PointEdgeArrayDistanceBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(points.device()); at::cuda::CUDAGuard device_guard(points.device());

View File

@ -141,6 +141,9 @@ void PointsToVolumesForwardCuda(
grid_sizes_t, grid_sizes_t,
mask_t}); mask_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("PointsToVolumesForwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(points_3d.device()); at::cuda::CUDAGuard device_guard(points_3d.device());
cudaStream_t stream = at::cuda::getCurrentCUDAStream(); cudaStream_t stream = at::cuda::getCurrentCUDAStream();

View File

@ -583,6 +583,9 @@ at::Tensor RasterizeMeshesBackwardCuda(
at::checkAllSameType( at::checkAllSameType(
c, {face_verts_t, grad_zbuf_t, grad_bary_t, grad_dists_t}); c, {face_verts_t, grad_zbuf_t, grad_bary_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("RasterizeMeshesBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(face_verts.device()); at::cuda::CUDAGuard device_guard(face_verts.device());
cudaStream_t stream = at::cuda::getCurrentCUDAStream(); cudaStream_t stream = at::cuda::getCurrentCUDAStream();

View File

@ -423,7 +423,8 @@ at::Tensor RasterizePointsBackwardCuda(
at::CheckedFrom c = "RasterizePointsBackwardCuda"; at::CheckedFrom c = "RasterizePointsBackwardCuda";
at::checkAllSameGPU(c, {points_t, idxs_t, grad_zbuf_t, grad_dists_t}); at::checkAllSameGPU(c, {points_t, idxs_t, grad_zbuf_t, grad_dists_t});
at::checkAllSameType(c, {points_t, grad_zbuf_t, grad_dists_t}); at::checkAllSameType(c, {points_t, grad_zbuf_t, grad_dists_t});
// This is nondeterministic because atomicAdd
at::globalContext().alertNotDeterministic("RasterizePointsBackwardCuda");
// Set the device for the kernel launch based on the device of the input // Set the device for the kernel launch based on the device of the input
at::cuda::CUDAGuard device_guard(points.device()); at::cuda::CUDAGuard device_guard(points.device());
cudaStream_t stream = at::cuda::getCurrentCUDAStream(); cudaStream_t stream = at::cuda::getCurrentCUDAStream();