NVIDIA / NVIDIA/cccl

[BUG]: definition of `cudax::device::attrs::memory_pool_supported_handle_types_t::fabric` is UB

Open
#2,851 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Silent Failure

### Component

libcu++

### Describe the bug

The `memory_pool_supported_handle_types_t::fabric` constant has type `cudaMemAllocationHandleType`. Before CUDA 12.4, `fabric` is initialized like this:

```c++
static constexpr type fabric = static_cast<::cudaMemAllocationHandleType>(0x8);
```

In 12.3 and earlier, `cudaMemAllocationHandleType` did not have an `cudaMemHandleTypeFabric` value, so the valid integer range of `cudaMemAllocationHandleType` is `[0,7]`. Storing `8` in a `cudaMemAllocationHandleType` object on that platform is undefined behavior.

### How to Reproduce

n/a

### Expected behavior

no undefined behavior

### Reproduction link

_No response_

### Operating System

_No response_

### nvidia-smi output

_No response_

### NVCC version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.