SIGN IN SIGN UP

[ROCm] Avoid OpenMP capture of structured bindings in SparseCsrTensorMath (#194263) (#194263)

Summary:

D113684917 converted two `std::get` call sites in
`ATen/native/sparse/cuda/SparseCsrTensorMath.cu` to C++17 structured bindings.
Both `new_values` and `new_values_acc` are subsequently captured inside an
OpenMP region, and clang rejects that:

```
SparseCsrTensorMath.hip:604:29: error: capturing a structured binding is not yet
  supported in OpenMP
    new_values_acc.resize_(new_nnz);
SparseCsrTensorMath.hip:582:9: note: 'new_values' declared here
  auto [new_values, new_values_acc] =
```

The hipified `ATen/native/sparse/hip/SparseCsrTensorMath.hip` is compiled by
clang, so `fbcode//caffe2:ATen-hip` fails to build for gfx942. nvcc does not
apply this restriction, which is why the CUDA container manifests stayed green
and only the AMD ones broke.

This restores the explicit `Tensor new_values` / `Tensor new_values_acc` locals
in this one file. The other 30 files touched by D113684917 are unchanged.

Test Plan: `buck2 run fbcode//sigrid/predictor:sigrid.predictor.hip -- --build-remote`

Differential Revision: D116741221

Pull Request resolved: https://github.com/pytorch/pytorch/pull/194263
Approved by: https://github.com/yyetim, https://github.com/amjames, https://github.com/janeyx99
A
Ankur Singla committed
76765bb621acbcb2adfe6bd01856adf87aa81034
Parent: 142552d
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> on 8/24/2026, 8:04:42 PM