Skip to content

Reject zero divisors in CUDA Mod kernels - #32546

Draft
Tianlei Wu (tianleiwu) with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-cuda-mod-kernel-zero-divisor-check
Draft

Tianlei Wu (tianleiwu) with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-cuda-mod-kernel-zero-divisor-check

Conversation

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

  • Add CUDA-side zero-divisor validation for integer Mod and Fmod.
  • Return "Integer modulo by zero" consistently with the CPU provider.
  • Guard device modulo helpers against % 0.
  • Add CUDA regression coverage for an int64 divisor containing zero.

Motivation and Context

CUDA integer Mod previously evaluated % without validating the divisor, causing undefined behavior when it contained zero. CPU already rejects the same input cleanly; this change aligns CUDA behavior.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI and others added 4 commits September 10, 2026 15:55
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CUDA Mod kernel to include zero divisor check Reject zero divisors in CUDA Mod kernels Sep 10, 2026
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.

CUDA Mod kernel has no zero divisor check, unlike CPU after #27833

2 participants