PyTorch adds CUDA kernels for histogram and histogramdd
Native float32 and float64 GPU paths land for multi-dimensional binning, with shared input checks and a CPU edge-case fix.
PyTorch is adding native CUDA kernels for torch.histogram and torch.histogramdd, so float32 and float64 binning can run on NVIDIA GPUs instead of falling back to the host.
Histograms are a routine tool in data analysis and scientific workloads. Until now, callers with tensors already on the device paid a transfer and CPU cost for these reductions. The new kernels close that gap for one- and multi-dimensional cases.
The same work consolidates shared argument validation used across backends, fixes a CPU lookup bug when bin edges round to repeated values, and extends ahead-of-time inductor gating so the new device paths are wired consistently with other operators.
An automated review of the change found nothing blocking human sign-off. One remaining behavioral note: a stricter same-device check can reject some mixed CPU and MPS edge inputs that previously copied and ran on the CPU; mixed-device inputs were never a documented contract, and the weight and output checks stay in place.