Skip to content

Fix zero-extent GPU image launches - #6505

Merged
jantonguirao merged 5 commits into
NVIDIA:mainfrom
arcusbuilds:fix/zero-extent-kernel-launches
Sep 29, 2026
Merged

jantonguirao merged 5 commits into
NVIDIA:mainfrom
arcusbuilds:fix/zero-extent-kernel-launches

Conversation

@arcusbuilds

@arcusbuilds arcusbuilds commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Category

Bug fix

Description

Return from the shared GPU Flip and color conversion launchers when a sample has zero pixels, before computing launch dimensions. This prevents host-side division by zero for zero-extent samples in a nonempty batch. Fixes #6504.

Additional information

The guards are in the launchers, so all callers use them. A mixed-batch GTest sends an empty sample and a normal RGB pixel through Flip and color conversion, then checks the BGR output. A second test checks that an unsupported conversion still fails for an empty sample.

Tests

  • New GTests: ColorSpaceConversionTest.ZeroExtentSampleGPU, ColorSpaceConversionTest.ZeroExtentUnsupportedConversionGPU
  • Run locally: no DALI build is available, and the Linux environment has no CUDA toolkit. CI results are pending.

Checklist

  • Documentation: N/A
  • DALI team requirements: N/A

REQ IDs: N/A
JIRA TASK: N/A

Skip zero-pixel samples in the shared color conversion and Flip launchers before computing launch dimensions. Add a mixed-batch regression test.

Fixes NVIDIA#6504

Signed-off-by: Srijan Keshri <212402043+arcusbuilds@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds guards against zero-extent GPU kernel launches.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR guards zero-extent GPU Flip work and skips zero-grid color-conversion launches while retaining unsupported-conversion validation.

  • Adds GPU tests for a mixed empty/nonempty batch and an unsupported conversion on an empty sample.

Reviews (5) · Last reviewed commit: "Fix cpplint line-length violation in Ker..."

Comment thread dali/kernels/imgproc/color_manipulation/color_space_conversion_kernel.cuh Outdated
Comment thread dali/operators/image/color/color_space_conversion_test.cc
@greptile-apps

This comment has been minimized.

Keep unsupported conversion pairs rejected when the pixel count is zero, and cover the case in the existing GPU operator test.

Signed-off-by: Srijan Keshri <212402043+arcusbuilds@users.noreply.github.com>
Comment thread dali/kernels/imgproc/color_manipulation/color_space_conversion_kernel.cuh Outdated
jantonguirao added a commit to jantonguirao/DALI that referenced this pull request Sep 29, 2026
RunColorSpaceConversionKernel and FlipImpl have the same class of
host-side divide-by-zero bug for zero-extent samples, but that part
is already covered by NVIDIA#6505 — drop the duplicate fix here to avoid
two PRs touching the same code for the same reason.
Make block/grid safe for npixels == 0 instead of special-casing it with
a second copy of the supported-conversion list. Unsupported conversions
now fall through to the single existing DALI_FAIL at the end of the
dispatch chain regardless of npixels, so there's one source of truth for
which conversions are supported.

Also bump copyright years on the touched files to 2026.
@jantonguirao

Copy link
Copy Markdown
Collaborator

!build

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70400057]: BUILD STARTED

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70400057]: BUILD FAILED

CUDA rejects a zero-sized grid with cudaErrorInvalidConfiguration
rather than treating it as a no-op, so the color-space-conversion
kernel launch (and its error check) must be skipped when npixels == 0
instead of launching with grid == 0. Unsupported conversions still hit
DALI_FAIL regardless of npixels.

Also fix an ambiguous TensorListShape<3> constructor call in the new
zero-extent test (single-element braced-init is ambiguous between the
copy/move ctor and the vector<TensorShape<3>> ctor), which was the
actual cause of the CI build failure.
@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70433025]: BUILD STARTED

@NVIDIA NVIDIA deleted a comment from dali-automaton Sep 29, 2026
@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70433025]: BUILD FAILED

@jantonguirao

Copy link
Copy Markdown
Collaborator

!build

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70435968]: BUILD STARTED

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [70435968]: BUILD PASSED

@jantonguirao jantonguirao self-assigned this Sep 29, 2026
@jantonguirao
jantonguirao merged commit 5fdb0b6 into NVIDIA:main Sep 29, 2026
8 of 9 checks passed
jantonguirao added a commit to jantonguirao/DALI that referenced this pull request Sep 29, 2026
…UDA affine remap

InvertTransforms/CopyTransforms and adjustMatrices compute their CUDA launch
grid by dividing by a batch-derived count. When the batch is empty, that
count is zero, causing a host-side division by zero before any kernel is
even launched. Return early from each launcher when there is no work to do.

RunColorSpaceConversionKernel and FlipImpl have the same class of bug for
zero-extent samples within an otherwise non-empty batch, but that part is
already fixed in NVIDIA#6505, so this is scoped to the two remaining call sites.

Fixes NVIDIA#6504
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.

GPU Flip and color conversion divide by zero for zero-extent samples

5 participants