Skip to content

[conv] Fix degenerate spatial extent calculation, grouped channel sizing, and add device wrapper validation tests - #3559

Open
Sadik00789 wants to merge 1 commit into
NVIDIA:mainfrom
Sadik00789:fix-conv-device-wrappers
Open

[conv] Fix degenerate spatial extent calculation, grouped channel sizing, and add device wrapper validation tests#3559
Sadik00789 wants to merge 1 commit into
NVIDIA:mainfrom
Sadik00789:fix-conv-device-wrappers

Conversation

@Sadik00789

@Sadik00789Sadik00789 commented Aug 27, 2026

Copy link
Copy Markdown

Summary

This PR resolves stale geometry/pointer state across convolution device wrappers, adds missing 2 GiB overflow gates, clamps degenerate spatial extents, fixes 3D grouped convolution channel sizing, and adds unit test coverage:

  1. Device Wrapper State & Geometry Refresh: Fixed update() in convolution device wrappers (direct_convolution.h, implicit_gemm_convolution.h, implicit_gemm_convolution_fusion.h) to properly refresh internal tensor geometry and fused-output pointers rather than retaining stale parameters.
  2. Degenerate Spatial Extents & Gating:
    • Clamped output spatial dimensions (P, Q, Z) to 0 in conv2d_problem_size.h and conv3d_problem_size.h when (Dim + pads - filter_span) < 0.
    • Added strictly positive spatial extent validation in can_implement() across SM90/SM100 collective and kernel layers.
  3. 2 GiB Tensor Offset Overflow Gating: Enforced 2 GiB overflow validation across wrappers missing tensor offset bounds checks.
  4. 3D Grouped Convolution Sizing: Updated filter_c() and filter_size() in conv3d_problem_size.h to divide channels by groups (C / groups).
  5. CuTe Header Dependencies: Included <cute/tensor.hpp> in convnd_problem_shape.hpp so CuTe utilities (take, reverse, insert, for_each, make_seq) resolve across standalone translation units.
  6. Validation Test Coverage: Added test/unit/conv/device/conv_validation_and_update.cu to verify degenerate spatial extent clamping, 2 GiB gating, and runtime pointer/geometry updates.

Files Changed

  • include/cutlass/conv/conv2d_problem_size.h: Clamped P and Q spatial extents to 0 against negative numerators.
  • include/cutlass/conv/conv3d_problem_size.h: Clamped Z, P, Q spatial extents and fixed filter_c() / filter_size() channel sizing for grouped convolutions.
  • include/cutlass/conv/convnd_problem_shape.hpp: Added #include "cute/tensor.hpp" for CuTe tuple algorithm definitions.
  • include/cutlass/conv/device/direct_convolution.h: Updated update() geometry refreshes and runtime parameter validation.
  • include/cutlass/conv/device/implicit_gemm_convolution.h: Added 2 GiB overflow checks and fixed stale pointer caching on update().
  • include/cutlass/conv/device/implicit_gemm_convolution_fusion.h: Fixed stale fused-output pointer updates and refreshed geometry state.
  • include/cutlass/conv/collective/sm90_implicit_gemm_gmma_ss_warpspecialized.hpp: Added spatial extent validity checks in can_implement().
  • include/cutlass/conv/kernel/sm100_implicit_gemm_tma_warpspecialized.hpp: Added problem shape validation in kernel execution entry points.
  • test/unit/conv/device/CMakeLists.txt: Registered cutlass_test_unit_conv_device_validation test target.
  • test/unit/conv/device/conv_validation_and_update.cu: Added test suite for degenerate extents, 2 GiB offset gating, and wrapper update() refreshes.

Testing

Built and verified passing with GCC 13 and CUDA 12.6 targeting SM86:

ninja cutlass_test_unit_conv_device_validation
./build/test/unit/conv/device/cutlass_test_unit_conv_device_validation
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from ConvDeviceValidation
[ RUN ] ConvDeviceValidation.DegenerateSpatialExtentsNotNegative
[ OK ] ConvDeviceValidation.DegenerateSpatialExtentsNotNegative (0 ms)
[ RUN ] ConvDeviceValidation.TwoGiBOverflowGate
[ OK ] ConvDeviceValidation.TwoGiBOverflowGate (0 ms)
[ RUN ] ConvDeviceValidation.UpdateGeometryAndPointerRefresh
[ OK ] ConvDeviceValidation.UpdateGeometryAndPointerRefresh (0 ms)
[----------] 3 tests from ConvDeviceValidation (0 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test suite ran. (0 ms total)
[ PASSED ] 3 tests.

@Sadik00789
Sadik00789force-pushed the fix-conv-device-wrappers branch from 1070903 to da9fd9fCompareAugust 27, 2026 11:49
Sign up for freeto 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.

Conv device wrappers: update() leaves stale geometry and fused-output pointers, two wrappers miss the 2 GiB gate, negative output extents not rejected

1 participant

@Sadik00789