Skip to content

[upstream #2795] Histc raises error with integer input when deterministic algorithm is enabled#8

Draft
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-193
Draft

[upstream #2795] Histc raises error with integer input when deterministic algorithm is enabled#8
Stonepia wants to merge 1 commit into
mainfrom
agent/issue-193

Conversation

@Stonepia

Copy link
Copy Markdown
Collaborator

[upstream pytorch#2795] Histc raises error with integer input when deterministic algorithm is enabled

Fixes https://github.com/ZhaoqiongZ/torch-xpu-ops-exp/issues/193

Root Cause: The XPU histc implementation in SummaryOps.cpp unconditionally calls globalContext().alertNotDeterministic("_histc_xpu") for all input dtypes, whereas the CUDA implementation correctly guards the alert with if (at::isFloatingType(self.scalar_type())). Integer atomicAdd is exact and order-independent, making integer histc deterministic. Additionally, torch/_meta_registrations.py has a Python-level determinism guard for CUDA+float but no equivalent guard for XPU, so even fixing C++ alone may leave a gap.


Diff stat:

torch/_meta_registrations.py | 2 ++
 1 file changed, 2 insertions(+)

[upstream pytorch#2795] Histc raises error with integer input when deterministic algorithm is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant