Skip to content

Fix integer overflow in at::divup - #195035

Closed
malfet wants to merge 1 commit into
mainfrom
malfet/divup-safe-numerics
Closed

malfet wants to merge 1 commit into
mainfrom
malfet/divup-safe-numerics

Conversation

@malfet

@malfet malfet commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

at::divup(x, y) computes (x + y - 1) / y. The addition overflows for large x or y, and the result then silently rounds down instead of up — divup(2, INT64_MAX) returns 0, not 1. Guarded with c10::add_overflows, falling back to a form that cannot overflow.

Every caller today passes loop extents and chunk counts, so for most of them this is latent. One caller does reach it: PoolingParams1D::valid_output_end bounds the max_pool1d output range with divup, and a large stride there yields a window starting past the end of the input — a segfault. That is the stacked PR on top of this one; splitting it out because divup is used well beyond pooling (softmax, moments, the parallel-loop chunking itself) and deserves its own CI signal.

Performance

Free on the happy path. Measured on an M-series arm64 laptop, -O3. Both variants live in one binary and are raced round-robin within each trial, so thermal drift and frequency changes hit them equally — A/B-ing two libtorch builds measures code layout instead of the change, and gave me a spurious ~9% swing that reproduces as same-build drift. Cycles are from a calibrated dependent-add chain (~4.4 GHz). Numbers below reproduce to three decimals across runs; discard the first run of any such benchmark, it is thermal warm-up.

old (x+y-1)/y guarded delta
y runtime (holds an sdiv), throughput 0.448 ns 0.449 ns +0.2%
y runtime, latency 2.629 ns 2.407 ns −8.4%
y compile-time constant (=16), throughput 0.171 ns 0.209 ns +22.2%
y compile-time constant (=16), latency 1.330 ns 1.334 ns +0.3%

Runtime divisor — free, and the loop is divider-bound, not issue-bound. A bare sdiv with nothing else in the loop measures 0.449 ns / ~1.9 cyc, which is exactly what both variants cost, so the guard's extra instructions are absorbed entirely by the divider's throughput. Latency actually improves: the guard's adds replaces the old add/sub pair ahead of the divide.

old                      guarded
  add  x8, x0, x1          sub  x8, x1, #1
  sub  x8, x8, #1          adds x8, x0, x8
  sdiv x0, x8, x1          b.vs  <fallback>     ; predicted not-taken
                           sdiv x0, x8, x1

Constant divisor — where the cost is. With y a compile-time constant there is no division at all; it folds to a shift, leaving 5 cheap ALU ops, and the guard's 2 extra instructions are a real +22% — of +0.038 ns/call. Only moments_utils.h (kChunkSize = 16) has such a constant among the callers; SoftMaxKernel.cpp's CHUNK_SIZE is a runtime std::min(...) and takes the free path above. In moments_utils.h, divup runs once per row of a reduction, ahead of that row's entire Welford loop — in a replica of that shape the difference does not clear the noise floor at any row size.

I also tried x / y + (x % y > 0), which needs no guard at all. It is equivalent on throughput but ~34% worse on runtime-divisor latency, because it puts msub/cmp/cinc after the divide instead of ahead of it. Happy to switch if the extra header include is a concern.

🤖 Generated with Claude Code

`divup(x, y)` computes `(x + y - 1) / y`. The addition overflows for
large x or y, and the result silently rounds *down* instead of up --
e.g. `divup(2, INT64_MAX)` returns 0 rather than 1.

Guard it with `c10::add_overflows` and fall back to a form that cannot
overflow. Callers all pass loop extents and chunk counts today, so this
is latent rather than a live bug for most of them, but one caller does
hit it: `PoolingParams1D::valid_output_end` bounds the max_pool1d output
range with `divup`, and a large stride there yields a window starting
past the end of the input (see the stacked PR).

Free on the happy path where nothing overflows. Measured on an M-series
arm64 laptop, variants raced round-robin within each trial, cycles from
a calibrated dependent-add chain, reproducible across runs:

  y runtime (holds an sdiv)      old       guarded
    throughput               0.448 ns    0.449 ns   +0.2%
    latency                  2.629 ns    2.407 ns   -8.4%

  y compile-time constant (=16)
    throughput               0.171 ns    0.209 ns  +22.2%
    latency                  1.330 ns    1.334 ns   +0.3%

For a runtime divisor the loop is bound by the divider, not by issue
width: a bare `sdiv` alone measures 0.449 ns, exactly what both variants
cost, so the extra instructions are absorbed. Latency improves because
the guard's `adds` replaces the old `add`/`sub` pair ahead of the divide.

With a compile-time-constant divisor there is no division at all -- it
folds to a shift -- so the sequence is 5 cheap ALU ops and the guard's
2 extra instructions show up as +0.038 ns/call. Only `moments_utils.h`
(`kChunkSize = 16`) has such a constant, where `divup` runs once per row
of a reduction, ahead of the row's whole Welford loop.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EFzKNdrvb8pUYeCUSxhtEA
@pytorch-bot

pytorch-bot Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195035

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 8120b2b with merge base 8f988c9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@malfet malfet added the topic: not user facing topic category label Aug 28, 2026
@malfet

malfet commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 28, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Aug 31, 2026
`torch.max_pool1d` segfaults for several out-of-domain integer arguments.
There are three separate silent integer overflows in the shape math, and all three have to go for the op to be safe — fixing (1) alone makes (3) newly reachable.

### 1. `div_rtn()` floor-divides in `int`

```c++
 template <typename T>
 static inline T div_rtn(T x, T y) {
-  int q = x / y;
-  int r = x % y;
+  T q = x / y;
+  T r = x % y;
```

Every call site passes `div_rtn<int64_t>`, so the truncated remainder gets the wrong sign, the floor correction is skipped, and the quotient wraps. For #73190 (`kernel_size = stride = dilation = 2147483697`) the true output size `-2147483694` becomes `+2147483602` and sails past `TORCH_CHECK(OW > 0)`; for #136719 (`kernel_size = stride = INT64_MAX`) a true `0` becomes `1`. In both cases the kernel then indexes out of bounds.

The helper is shared, so this also affects the shape checks in `im2col_shape_check.h`, `ConvolutionMM2d/3d.cpp`, `DilatedConvolutionUtils.h`, the CUDA `Im2Col`/`Col2Im`/`ConvolutionMM2d` kernels and MPS `Pooling.mm`. Two side effects, both improvements: `slow_conv_dilated2d` with `dilation = 2147483697` used to silently return a `[1, 1, 0, 0]` tensor and now raises `calculated output size -1 -1 is too small`, and `F.unfold` with an INT32-boundary stride now fails in the `im2col` shape check instead of downstream in `numel`.

Checked the two bodies against an `__int128` floor-division reference: identical on all 1,000,100 realistic in-range cases (`|x| <= 5000`, `|y| <= 50`); over 3,000,000 random `int64` pairs the old one is wrong 1,499,994 times and the new one 0.

### 2. `dilation * (kernel_size - 1) + 1` overflows in `pooling_output_shape()`

This is #142454, a different root — `div_rtn` is doing exact arithmetic on already-garbage input. With `kernel_size = 8608480567731124087` and `dilation = 1250999896764`, the effective kernel size wraps to `+3689346979942061737`, so the pad check passes; the numerator wraps to `+4919136089788855880`, so `OW` comes out `1`. Computed with `c10::mul_overflows`/`add_overflows` and rejected instead.

This is also where the nonsensical `pad should be at most half of effective kernel size, but got pad=0` messages came from: the wrapped bound went negative, so `pad = 0` failed a check about padding for reasons that had nothing to do with padding. Those inputs now report the actual problem.

### 3. `at::divup()` overflows — handled in #195035

`PoolingParams1D::valid_output_end` bounds the output range with `divup`, so with a large stride the CPU kernel got a range whose window starts past the end of the input:

```python
torch.max_pool1d(torch.full((2, 10, 4), 0.5, dtype=torch.float64),
                 [2], [2**63 - 1], [0], [2147483647], True)   # SIGSEGV with only (1) applied
```

Reachable only once (1) is fixed, and only on the non-autograd CPU path — `max_pool1d_with_indices` rejects such strides in `safe_downcast<int>`, which is why it stayed hidden. `OW = 1` is correct here; the fixed result matches what `max_pool1d_with_indices` computes for the same arguments.

### Testing

Error cases added to the `nn.functional.max_pool1d` OpInfo (the INT32-boundary kernels, the `INT64_MAX` kernel, and the effective-kernel-size overflow). (3) produces a *correct* result rather than an error, so it goes in the existing `test_max_pool1d_corner_cases` as one more `check(...)` — adding it as an OpInfo *sample* input instead fails 10 generic tests, since the `with_indices` variant legitimately rejects INT64_MAX strides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: #194112
Approved by: https://github.com/drisspg, https://github.com/Skylion007

Co-authored-by: Claude Opus 5 <[email protected]>
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
`at::divup(x, y)` computes `(x + y - 1) / y`. The addition overflows for large `x` or `y`, and the result then silently rounds **down** instead of up — `divup(2, INT64_MAX)` returns `0`, not `1`. Guarded with `c10::add_overflows`, falling back to a form that cannot overflow.

Every caller today passes loop extents and chunk counts, so for most of them this is latent. One caller does reach it: `PoolingParams1D::valid_output_end` bounds the `max_pool1d` output range with `divup`, and a large stride there yields a window starting past the end of the input — a segfault. That is the stacked PR on top of this one; splitting it out because `divup` is used well beyond pooling (softmax, moments, the parallel-loop chunking itself) and deserves its own CI signal.

## Performance

Free on the happy path. Measured on an M-series arm64 laptop, `-O3`. Both variants live in **one binary** and are **raced round-robin within each trial**, so thermal drift and frequency changes hit them equally — A/B-ing two libtorch builds measures code layout instead of the change, and gave me a spurious ~9% swing that reproduces as same-build drift. Cycles are from a calibrated dependent-add chain (~4.4 GHz). Numbers below reproduce to three decimals across runs; discard the first run of any such benchmark, it is thermal warm-up.

| | old `(x+y-1)/y` | guarded | delta |
|---|---|---|---|
| **y runtime** (holds an `sdiv`), throughput | 0.448 ns | 0.449 ns | +0.2% |
| **y runtime**, latency | 2.629 ns | 2.407 ns | **−8.4%** |
| **y compile-time constant** (=16), throughput | 0.171 ns | 0.209 ns | +22.2% |
| **y compile-time constant** (=16), latency | 1.330 ns | 1.334 ns | +0.3% |

**Runtime divisor — free, and the loop is divider-bound, not issue-bound.** A bare `sdiv` with nothing else in the loop measures **0.449 ns / ~1.9 cyc**, which is exactly what both variants cost, so the guard's extra instructions are absorbed entirely by the divider's throughput. Latency actually *improves*: the guard's `adds` replaces the old `add`/`sub` pair ahead of the divide.

```asm
old                      guarded
  add  x8, x0, x1          sub  x8, x1, pytorch#1
  sub  x8, x8, pytorch#1          adds x8, x0, x8
  sdiv x0, x8, x1          b.vs  <fallback>     ; predicted not-taken
                           sdiv x0, x8, x1
```

**Constant divisor — where the cost is.** With `y` a compile-time constant there is no division at all; it folds to a shift, leaving 5 cheap ALU ops, and the guard's 2 extra instructions are a real +22% — of **+0.038 ns/call**. Only `moments_utils.h` (`kChunkSize = 16`) has such a constant among the callers; `SoftMaxKernel.cpp`'s `CHUNK_SIZE` is a runtime `std::min(...)` and takes the free path above. In `moments_utils.h`, `divup` runs once per row of a reduction, ahead of that row's entire Welford loop — in a replica of that shape the difference does not clear the noise floor at any row size.

I also tried `x / y + (x % y > 0)`, which needs no guard at all. It is equivalent on throughput but ~34% worse on runtime-divisor latency, because it puts `msub`/`cmp`/`cinc` *after* the divide instead of ahead of it. Happy to switch if the extra header include is a concern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#195035
Approved by: https://github.com/Skylion007

Co-authored-by: Claude Opus 5 <[email protected]>
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
`torch.max_pool1d` segfaults for several out-of-domain integer arguments.
There are three separate silent integer overflows in the shape math, and all three have to go for the op to be safe — fixing (1) alone makes (3) newly reachable.

### 1. `div_rtn()` floor-divides in `int`

```c++
 template <typename T>
 static inline T div_rtn(T x, T y) {
-  int q = x / y;
-  int r = x % y;
+  T q = x / y;
+  T r = x % y;
```

Every call site passes `div_rtn<int64_t>`, so the truncated remainder gets the wrong sign, the floor correction is skipped, and the quotient wraps. For pytorch#73190 (`kernel_size = stride = dilation = 2147483697`) the true output size `-2147483694` becomes `+2147483602` and sails past `TORCH_CHECK(OW > 0)`; for pytorch#136719 (`kernel_size = stride = INT64_MAX`) a true `0` becomes `1`. In both cases the kernel then indexes out of bounds.

The helper is shared, so this also affects the shape checks in `im2col_shape_check.h`, `ConvolutionMM2d/3d.cpp`, `DilatedConvolutionUtils.h`, the CUDA `Im2Col`/`Col2Im`/`ConvolutionMM2d` kernels and MPS `Pooling.mm`. Two side effects, both improvements: `slow_conv_dilated2d` with `dilation = 2147483697` used to silently return a `[1, 1, 0, 0]` tensor and now raises `calculated output size -1 -1 is too small`, and `F.unfold` with an INT32-boundary stride now fails in the `im2col` shape check instead of downstream in `numel`.

Checked the two bodies against an `__int128` floor-division reference: identical on all 1,000,100 realistic in-range cases (`|x| <= 5000`, `|y| <= 50`); over 3,000,000 random `int64` pairs the old one is wrong 1,499,994 times and the new one 0.

### 2. `dilation * (kernel_size - 1) + 1` overflows in `pooling_output_shape()`

This is pytorch#142454, a different root — `div_rtn` is doing exact arithmetic on already-garbage input. With `kernel_size = 8608480567731124087` and `dilation = 1250999896764`, the effective kernel size wraps to `+3689346979942061737`, so the pad check passes; the numerator wraps to `+4919136089788855880`, so `OW` comes out `1`. Computed with `c10::mul_overflows`/`add_overflows` and rejected instead.

This is also where the nonsensical `pad should be at most half of effective kernel size, but got pad=0` messages came from: the wrapped bound went negative, so `pad = 0` failed a check about padding for reasons that had nothing to do with padding. Those inputs now report the actual problem.

### 3. `at::divup()` overflows — handled in pytorch#195035

`PoolingParams1D::valid_output_end` bounds the output range with `divup`, so with a large stride the CPU kernel got a range whose window starts past the end of the input:

```python
torch.max_pool1d(torch.full((2, 10, 4), 0.5, dtype=torch.float64),
                 [2], [2**63 - 1], [0], [2147483647], True)   # SIGSEGV with only (1) applied
```

Reachable only once (1) is fixed, and only on the non-autograd CPU path — `max_pool1d_with_indices` rejects such strides in `safe_downcast<int>`, which is why it stayed hidden. `OW = 1` is correct here; the fixed result matches what `max_pool1d_with_indices` computes for the same arguments.

### Testing

Error cases added to the `nn.functional.max_pool1d` OpInfo (the INT32-boundary kernels, the `INT64_MAX` kernel, and the effective-kernel-size overflow). (3) produces a *correct* result rather than an error, so it goes in the existing `test_max_pool1d_corner_cases` as one more `check(...)` — adding it as an OpInfo *sample* input instead fails 10 generic tests, since the `with_indices` variant legitimately rejects INT64_MAX strides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#194112
Approved by: https://github.com/drisspg, https://github.com/Skylion007

Co-authored-by: Claude Opus 5 <[email protected]>
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
`at::divup(x, y)` computes `(x + y - 1) / y`. The addition overflows for large `x` or `y`, and the result then silently rounds **down** instead of up — `divup(2, INT64_MAX)` returns `0`, not `1`. Guarded with `c10::add_overflows`, falling back to a form that cannot overflow.

Every caller today passes loop extents and chunk counts, so for most of them this is latent. One caller does reach it: `PoolingParams1D::valid_output_end` bounds the `max_pool1d` output range with `divup`, and a large stride there yields a window starting past the end of the input — a segfault. That is the stacked PR on top of this one; splitting it out because `divup` is used well beyond pooling (softmax, moments, the parallel-loop chunking itself) and deserves its own CI signal.

## Performance

Free on the happy path. Measured on an M-series arm64 laptop, `-O3`. Both variants live in **one binary** and are **raced round-robin within each trial**, so thermal drift and frequency changes hit them equally — A/B-ing two libtorch builds measures code layout instead of the change, and gave me a spurious ~9% swing that reproduces as same-build drift. Cycles are from a calibrated dependent-add chain (~4.4 GHz). Numbers below reproduce to three decimals across runs; discard the first run of any such benchmark, it is thermal warm-up.

| | old `(x+y-1)/y` | guarded | delta |
|---|---|---|---|
| **y runtime** (holds an `sdiv`), throughput | 0.448 ns | 0.449 ns | +0.2% |
| **y runtime**, latency | 2.629 ns | 2.407 ns | **−8.4%** |
| **y compile-time constant** (=16), throughput | 0.171 ns | 0.209 ns | +22.2% |
| **y compile-time constant** (=16), latency | 1.330 ns | 1.334 ns | +0.3% |

**Runtime divisor — free, and the loop is divider-bound, not issue-bound.** A bare `sdiv` with nothing else in the loop measures **0.449 ns / ~1.9 cyc**, which is exactly what both variants cost, so the guard's extra instructions are absorbed entirely by the divider's throughput. Latency actually *improves*: the guard's `adds` replaces the old `add`/`sub` pair ahead of the divide.

```asm
old                      guarded
  add  x8, x0, x1          sub  x8, x1, #1
  sub  x8, x8, #1          adds x8, x0, x8
  sdiv x0, x8, x1          b.vs  <fallback>     ; predicted not-taken
                           sdiv x0, x8, x1
```

**Constant divisor — where the cost is.** With `y` a compile-time constant there is no division at all; it folds to a shift, leaving 5 cheap ALU ops, and the guard's 2 extra instructions are a real +22% — of **+0.038 ns/call**. Only `moments_utils.h` (`kChunkSize = 16`) has such a constant among the callers; `SoftMaxKernel.cpp`'s `CHUNK_SIZE` is a runtime `std::min(...)` and takes the free path above. In `moments_utils.h`, `divup` runs once per row of a reduction, ahead of that row's entire Welford loop — in a replica of that shape the difference does not clear the noise floor at any row size.

I also tried `x / y + (x % y > 0)`, which needs no guard at all. It is equivalent on throughput but ~34% worse on runtime-divisor latency, because it puts `msub`/`cmp`/`cinc` *after* the divide instead of ahead of it. Happy to switch if the extra header include is a concern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#195035
Approved by: https://github.com/Skylion007

Co-authored-by: Claude Opus 5 <[email protected]>
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
`torch.max_pool1d` segfaults for several out-of-domain integer arguments.
There are three separate silent integer overflows in the shape math, and all three have to go for the op to be safe — fixing (1) alone makes (3) newly reachable.

### 1. `div_rtn()` floor-divides in `int`

```c++
 template <typename T>
 static inline T div_rtn(T x, T y) {
-  int q = x / y;
-  int r = x % y;
+  T q = x / y;
+  T r = x % y;
```

Every call site passes `div_rtn<int64_t>`, so the truncated remainder gets the wrong sign, the floor correction is skipped, and the quotient wraps. For pytorch#73190 (`kernel_size = stride = dilation = 2147483697`) the true output size `-2147483694` becomes `+2147483602` and sails past `TORCH_CHECK(OW > 0)`; for pytorch#136719 (`kernel_size = stride = INT64_MAX`) a true `0` becomes `1`. In both cases the kernel then indexes out of bounds.

The helper is shared, so this also affects the shape checks in `im2col_shape_check.h`, `ConvolutionMM2d/3d.cpp`, `DilatedConvolutionUtils.h`, the CUDA `Im2Col`/`Col2Im`/`ConvolutionMM2d` kernels and MPS `Pooling.mm`. Two side effects, both improvements: `slow_conv_dilated2d` with `dilation = 2147483697` used to silently return a `[1, 1, 0, 0]` tensor and now raises `calculated output size -1 -1 is too small`, and `F.unfold` with an INT32-boundary stride now fails in the `im2col` shape check instead of downstream in `numel`.

Checked the two bodies against an `__int128` floor-division reference: identical on all 1,000,100 realistic in-range cases (`|x| <= 5000`, `|y| <= 50`); over 3,000,000 random `int64` pairs the old one is wrong 1,499,994 times and the new one 0.

### 2. `dilation * (kernel_size - 1) + 1` overflows in `pooling_output_shape()`

This is pytorch#142454, a different root — `div_rtn` is doing exact arithmetic on already-garbage input. With `kernel_size = 8608480567731124087` and `dilation = 1250999896764`, the effective kernel size wraps to `+3689346979942061737`, so the pad check passes; the numerator wraps to `+4919136089788855880`, so `OW` comes out `1`. Computed with `c10::mul_overflows`/`add_overflows` and rejected instead.

This is also where the nonsensical `pad should be at most half of effective kernel size, but got pad=0` messages came from: the wrapped bound went negative, so `pad = 0` failed a check about padding for reasons that had nothing to do with padding. Those inputs now report the actual problem.

### 3. `at::divup()` overflows — handled in pytorch#195035

`PoolingParams1D::valid_output_end` bounds the output range with `divup`, so with a large stride the CPU kernel got a range whose window starts past the end of the input:

```python
torch.max_pool1d(torch.full((2, 10, 4), 0.5, dtype=torch.float64),
                 [2], [2**63 - 1], [0], [2147483647], True)   # SIGSEGV with only (1) applied
```

Reachable only once (1) is fixed, and only on the non-autograd CPU path — `max_pool1d_with_indices` rejects such strides in `safe_downcast<int>`, which is why it stayed hidden. `OW = 1` is correct here; the fixed result matches what `max_pool1d_with_indices` computes for the same arguments.

### Testing

Error cases added to the `nn.functional.max_pool1d` OpInfo (the INT32-boundary kernels, the `INT64_MAX` kernel, and the effective-kernel-size overflow). (3) produces a *correct* result rather than an error, so it goes in the existing `test_max_pool1d_corner_cases` as one more `check(...)` — adding it as an OpInfo *sample* input instead fails 10 generic tests, since the `with_indices` variant legitimately rejects INT64_MAX strides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#194112
Approved by: https://github.com/drisspg, https://github.com/Skylion007

Co-authored-by: Claude Opus 5 <[email protected]>
@github-actions
github-actions Bot deleted the malfet/divup-safe-numerics branch November 10, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants