Skip to content

Add const pointer overloads of unwrap_it for half-precision FP types - #12586

Merged
bernhardmgruber merged 2 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:const-pointer-overloads-in-unwrap_it-for-half-and-bfloat16-pointers
Nov 11, 2026
Merged

bernhardmgruber merged 2 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:const-pointer-overloads-in-unwrap_it-for-half-and-bfloat16-pointers

Conversation

@oleksandr-pavlyk

Copy link
Copy Markdown
Contributor

Description

Add overloads to catch2_test_numeric_helpers.cuh and add tests in a new catch2_test_numeric_helpers.cu test file.

closes #12585

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@oleksandr-pavlyk
oleksandr-pavlyk requested a review from a team as a code owner November 10, 2026 21:05
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 10, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Nov 10, 2026
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded numeric iterator coverage for standard integers and supported half-precision types.
    • Added checks that pointer unwrapping preserves pointer type, address, constness, and null values.
    • Added checks that constant-iterator unwrapping preserves values and offset types.

The change adds const-pointer unwrap_it overloads for half and bfloat16 wrappers. Tests check pointer conversions, null pointers, and constant-iterator values and offset types.

Changes: unwrap_it const-pointer support

Layer / File(s) Summary
Half and bfloat16 const-pointer overloads
cub/test/catch2_test_numeric_helpers.cuh
Added overloads that convert const half_t* to const __half* and const bfloat16_t* to const __nv_bfloat16*. The constant-iterator overloads now bind the wrapped and converted values as const.
Pointer and constant-iterator tests
cub/test/catch2_test_numeric_helpers.cu
Added tests for pointer type, address, constness, and null preservation. Constant-iterator tests check unwrapped values and offset types across configured types.

Assessment against linked issues

Objective Addressed Explanation
Add unwrap_it const-pointer overloads for half-precision wrapper types [#12585] ✅

Possibly related PRs

  • NVIDIA/cccl#11374: Adds the original unwrap_it conversions for half and bfloat16 pointers and constant iterators.
  • NVIDIA/cccl#12260: Extracts the numeric helper header that contains the unwrap_it overloads.

Change: Feature · Severity of issue fixed: Medium

Merge Risk: Minimal · up to ddeeb

The pointer conversions and their tests have no identified merge-blocking issue.

Architecture risk: Low · up to ddeeb

The change affects 1 system.

Changed systems: cub

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — cub (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in cub/test/catch2_test_numeric_helpers.cu: Adds wrapped/unwrapped type pairs for int32_t and, when enabled by the test macros, half and bfloat16 types.
  • observed — Modified behavior in cub/test/catch2_test_numeric_helpers.cu: Adds pointer tests asserting that unwrap_it returns the corresponding unwrapped pointer type, preserves addresses and constness, and returns null for null pointers.
  • observed — Modified behavior in cub/test/catch2_test_numeric_helpers.cu: Adds constant-iterator tests across the configured wrapped types and int32_t/int64_t offsets, asserting the unwrapped iterator type retains its offset type and yields the original value at its base and offset positions.
  • observed — Modified behavior in cub/test/catch2_test_numeric_helpers.cuh: Added const-pointer unwrap_it overloads for half_t and bfloat16_t, returning pointers to the corresponding const CUDA types.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 878f124
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 97fbf363-2aa0-4c35-9ffa-98dc57705fb7
Commits

Reviewing files that changed from the base of the PR and between 93ab9ca and ddeeb0c.

Files selected for processing: 1

  • cub/test/catch2_test_numeric_helpers.cuh

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 52m: Pass: 100%/141 | Total: 1d 21h | Max: 1h 24m | Hits: 65%/194196

See results here.

@bernhardmgruber
bernhardmgruber merged commit aba3ce8 into NVIDIA:main Nov 11, 2026
163 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 11, 2026
@oleksandr-pavlyk
oleksandr-pavlyk deleted the const-pointer-overloads-in-unwrap_it-for-half-and-bfloat16-pointers branch November 11, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Task] Provide unwrap_it const pointer overloads for half-precision floating point types

3 participants