Skip to content

Vectorize output store in ublkcp DeviceTransform kernel - #9481

Merged
nanan-nvidia merged 23 commits into
NVIDIA:mainfrom
nanan-nvidia:device_transform_align_16
Jul 8, 2026
Merged

nanan-nvidia merged 23 commits into
NVIDIA:mainfrom
nanan-nvidia:device_transform_align_16

Conversation

@nanan-nvidia

@nanan-nvidia nanan-nvidia commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

As per #9210, we noticed that the ublkcp kernel for DeviceTransform has unvectorized stores, leaving some performance on the table. This PR vectorizes the output store (STG.128) whenever it's safe. There is no change to existing call sites.

The store width is controlled by a tunable policy knob store_vec (output elements per store): 0 = auto (a 16-byte STG.128, the default), 1 = disable vectorization (the branch is compiled out, useful for register-heavy functors), and N = use N elements, silently capped to 16 bytes.

Fixes: #8227

Benchmarks (B200)

Ref = stock CUB, Cmp = this PR. FAST = this PR faster.
For heavy and complex_cmp, we use the opt-out path (store_vec=1), since in those cases we should disable the vectorized store. We also show the regressions at the end if vectorization is enabled for those cases.

babelstream: before vs this PR (auto)

# mul

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   I8    |      2^16      |      0.27 % |      5.93% |      0.27 % |      6.46% |   -0.00pp |  -0.42% |  🔵 SAME  |
|   I8    |      2^20      |      3.44 % |      5.82% |      3.45 % |      5.95% |   +0.01pp |  +0.18% |  🔵 SAME  |
|   I8    |      2^24      |     30.14 % |      3.07% |     35.78 % |      3.40% |   +5.64pp | +18.72% |  🟢 FAST  |
|   I8    |      2^28      |     58.85 % |      0.41% |     82.40 % |      1.11% |  +23.55pp | +40.02% |  🟢 FAST  |
|   I8    |      2^32      |     63.70 % |      0.09% |     90.75 % |      0.13% |  +27.04pp | +42.45% |  🟢 FAST  |
|   I16   |      2^16      |      0.53 % |      7.47% |      0.52 % |      8.19% |   -0.01pp |  -1.11% |  🔵 SAME  |
|   I16   |      2^20      |      6.76 % |      4.43% |      6.79 % |      4.69% |   +0.03pp |  +0.46% |  🔵 SAME  |
|   I16   |      2^24      |     47.77 % |      2.28% |     50.22 % |      5.49% |   +2.45pp |  +5.13% |  🔵 SAME  |
|   I16   |      2^28      |     85.44 % |      0.20% |     86.70 % |      0.64% |   +1.26pp |  +1.48% |  🟢 FAST  |
|   I16   |      2^32      |     89.18 % |      0.50% |     91.20 % |      0.09% |   +2.02pp |  +2.27% |  🟢 FAST  |
|   F32   |      2^16      |      1.08 % |      7.01% |      1.07 % |      8.63% |   -0.01pp |  -1.08% |  🔵 SAME  |
|   F32   |      2^20      |     13.15 % |      4.13% |     13.15 % |      4.12% |   +0.00pp |  +0.01% |  🔵 SAME  |
|   F32   |      2^24      |     65.25 % |      1.82% |     65.22 % |      1.88% |   -0.03pp |  -0.05% |  🔵 SAME  |
|   F32   |      2^28      |     89.12 % |      0.33% |     89.03 % |      0.34% |   -0.09pp |  -0.10% |  🔵 SAME  |
|   F32   |      2^32      |     91.11 % |      0.06% |     91.02 % |      0.06% |   -0.09pp |  -0.10% |  🔵 SAME  |
|   F64   |      2^16      |      2.09 % |     10.94% |      2.06 % |     12.00% |   -0.04pp |  -1.75% |  🔵 SAME  |
|   F64   |      2^20      |     21.65 % |      4.04% |     21.67 % |      4.11% |   +0.03pp |  +0.12% |  🔵 SAME  |
|   F64   |      2^24      |     75.15 % |      2.11% |     75.15 % |      2.09% |   +0.00pp |  +0.00% |  🔵 SAME  |
|   F64   |      2^28      |     90.13 % |      0.23% |     90.09 % |      0.24% |   -0.04pp |  -0.04% |  🔵 SAME  |
|   F64   |      2^32      |     91.13 % |      0.10% |     91.07 % |      0.09% |   -0.06pp |  -0.06% |  🔵 SAME  |
|  I128   |      2^16      |      3.99 % |     13.27% |      3.99 % |     13.28% |   +0.01pp |  +0.16% |  🔵 SAME  |
|  I128   |      2^20      |     35.54 % |      3.06% |     35.54 % |      3.30% |   +0.01pp |  +0.02% |  🔵 SAME  |
|  I128   |      2^24      |     82.94 % |      0.90% |     82.96 % |      0.89% |   +0.02pp |  +0.03% |  🔵 SAME  |
|  I128   |      2^28      |     90.62 % |      0.14% |     90.60 % |      0.15% |   -0.02pp |  -0.02% |  🔵 SAME  |
|  I128   |      2^32      |     91.06 % |      0.06% |     91.07 % |      0.06% |   +0.01pp |  +0.01% |  🔵 SAME  |

# add

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   I8    |      2^16      |      0.40 % |      8.08% |      0.40 % |      9.66% |   -0.01pp |  -1.59% |  🔵 SAME  |
|   I8    |      2^20      |      5.08 % |      4.39% |      5.10 % |      4.73% |   +0.02pp |  +0.42% |  🔵 SAME  |
|   I8    |      2^24      |     39.75 % |      2.26% |     43.28 % |      6.28% |   +3.54pp |  +8.90% |  🟢 FAST  |
|   I8    |      2^28      |     71.15 % |      0.28% |     85.44 % |      0.30% |  +14.29pp | +20.08% |  🟢 FAST  |
|   I8    |      2^32      |     76.14 % |      0.25% |     94.04 % |      0.02% |  +17.90pp | +23.51% |  🟢 FAST  |
|   I16   |      2^16      |      0.81 % |      6.38% |      0.79 % |      9.90% |   -0.02pp |  -2.90% |  🔵 SAME  |
|   I16   |      2^20      |      9.84 % |      4.26% |      9.86 % |      4.38% |   +0.02pp |  +0.18% |  🔵 SAME  |
|   I16   |      2^24      |     55.64 % |      3.96% |     58.05 % |      1.51% |   +2.41pp |  +4.34% |  🟢 FAST  |
|   I16   |      2^28      |     86.83 % |      0.16% |     89.20 % |      0.18% |   +2.37pp |  +2.73% |  🟢 FAST  |
|   I16   |      2^32      |     90.63 % |      0.02% |     93.43 % |      0.02% |   +2.80pp |  +3.09% |  🟢 FAST  |
|   F32   |      2^16      |      1.61 % |      7.87% |      1.60 % |      8.84% |   -0.01pp |  -0.72% |  🔵 SAME  |
|   F32   |      2^20      |     17.16 % |      9.31% |     17.40 % |      9.83% |   +0.25pp |  +1.44% |  🔵 SAME  |
|   F32   |      2^24      |     70.12 % |      2.24% |     70.67 % |      1.52% |   +0.55pp |  +0.78% |  🔵 SAME  |
|   F32   |      2^28      |     92.19 % |      0.20% |     92.29 % |      0.22% |   +0.11pp |  +0.12% |  🔵 SAME  |
|   F32   |      2^32      |     94.44 % |      0.29% |     93.31 % |      0.05% |   -1.13pp |  -1.20% |  🔴 SLOW  |
|   F64   |      2^16      |      2.94 % |     13.24% |      2.90 % |     13.27% |   -0.04pp |  -1.40% |  🔵 SAME  |
|   F64   |      2^20      |     31.18 % |      6.00% |     31.26 % |      5.80% |   +0.07pp |  +0.24% |  🔵 SAME  |
|   F64   |      2^24      |     79.94 % |      0.61% |     80.00 % |      0.59% |   +0.06pp |  +0.08% |  🔵 SAME  |
|   F64   |      2^28      |     93.00 % |      0.20% |     92.83 % |      0.18% |   -0.17pp |  -0.18% |  🔵 SAME  |
|   F64   |      2^32      |     93.38 % |      0.04% |     93.31 % |      0.03% |   -0.07pp |  -0.07% |  🔵 SAME  |
|  I128   |      2^16      |      5.10 % |      5.13% |      5.11 % |      5.34% |   +0.01pp |  +0.12% |  🔵 SAME  |
|  I128   |      2^20      |     40.30 % |      2.31% |     40.29 % |      2.18% |   -0.01pp |  -0.02% |  🔵 SAME  |
|  I128   |      2^24      |     86.10 % |      0.81% |     86.08 % |      0.80% |   -0.02pp |  -0.02% |  🔵 SAME  |
|  I128   |      2^28      |     93.08 % |      0.11% |     93.07 % |      0.11% |   -0.01pp |  -0.01% |  🔵 SAME  |

# triad

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   I8    |      2^16      |      0.41 % |      6.91% |      0.40 % |      7.91% |   -0.00pp |  -0.59% |  🔵 SAME  |
|   I8    |      2^20      |      5.07 % |      4.22% |      5.09 % |      4.32% |   +0.01pp |  +0.26% |  🔵 SAME  |
|   I8    |      2^24      |     36.06 % |      3.21% |     44.32 % |      5.50% |   +8.26pp | +22.92% |  🟢 FAST  |
|   I8    |      2^28      |     67.38 % |      0.24% |     85.48 % |      0.30% |  +18.10pp | +26.86% |  🟢 FAST  |
|   I8    |      2^32      |     71.28 % |      0.07% |     94.05 % |      0.03% |  +22.77pp | +31.94% |  🟢 FAST  |
|   I16   |      2^16      |      0.81 % |      7.93% |      0.79 % |     10.89% |   -0.02pp |  -2.77% |  🔵 SAME  |
|   I16   |      2^20      |      9.89 % |      4.10% |      9.92 % |      4.51% |   +0.04pp |  +0.39% |  🔵 SAME  |
|   I16   |      2^24      |     53.42 % |      1.32% |     56.55 % |      3.88% |   +3.13pp |  +5.86% |  🟢 FAST  |
|   I16   |      2^28      |     85.99 % |      0.31% |     88.00 % |      0.40% |   +2.01pp |  +2.34% |  🟢 FAST  |
|   I16   |      2^32      |     89.40 % |      0.02% |     91.71 % |      0.02% |   +2.31pp |  +2.59% |  🟢 FAST  |
|   F32   |      2^16      |      1.57 % |     10.98% |      1.54 % |     12.10% |   -0.03pp |  -2.20% |  🔵 SAME  |
|   F32   |      2^20      |     17.46 % |     10.21% |     17.58 % |     10.09% |   +0.12pp |  +0.67% |  🔵 SAME  |
|   F32   |      2^24      |     69.68 % |      2.49% |     70.25 % |      2.08% |   +0.57pp |  +0.81% |  🔵 SAME  |
|   F32   |      2^28      |     92.34 % |      0.09% |     92.50 % |      0.26% |   +0.17pp |  +0.18% |  🔵 SAME  |
|   F32   |      2^32      |     94.09 % |      0.49% |     93.25 % |      0.05% |   -0.84pp |  -0.89% |  🔴 SLOW  |
|   F64   |      2^16      |      3.01 % |     13.08% |      2.93 % |     13.20% |   -0.07pp |  -2.48% |  🔵 SAME  |
|   F64   |      2^20      |     28.35 % |      7.94% |     28.63 % |      8.11% |   +0.27pp |  +0.96% |  🔵 SAME  |
|   F64   |      2^24      |     77.92 % |      1.28% |     77.82 % |      1.25% |   -0.11pp |  -0.14% |  🔵 SAME  |
|   F64   |      2^28      |     93.43 % |      0.30% |     93.12 % |      0.31% |   -0.31pp |  -0.33% |  🔵 SAME  |
|   F64   |      2^32      |     93.37 % |      0.03% |     93.31 % |      0.02% |   -0.06pp |  -0.07% |  🔵 SAME  |
|  I128   |      2^16      |      5.27 % |      9.36% |      5.28 % |      9.26% |   +0.00pp |  +0.06% |  🔵 SAME  |
|  I128   |      2^20      |     41.46 % |      5.39% |     41.43 % |      5.33% |   -0.03pp |  -0.08% |  🔵 SAME  |
|  I128   |      2^24      |     86.69 % |      0.49% |     86.68 % |      0.50% |   -0.01pp |  -0.01% |  🔵 SAME  |
|  I128   |      2^28      |     93.07 % |      0.14% |     93.08 % |      0.14% |   +0.01pp |  +0.01% |  🔵 SAME  |

# nstream

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   I8    |      2^16      |      0.53 % |      8.99% |      0.52 % |     11.30% |   -0.01pp |  -2.41% |  🔵 SAME  |
|   I8    |      2^20      |      6.69 % |      4.78% |      6.73 % |      4.69% |   +0.04pp |  +0.60% |  🔵 SAME  |
|   I8    |      2^24      |     42.37 % |      1.84% |     47.12 % |      1.93% |   +4.75pp | +11.20% |  🟢 FAST  |
|   I8    |      2^28      |     65.73 % |      0.21% |     84.47 % |      0.32% |  +18.74pp | +28.52% |  🟢 FAST  |
|   I8    |      2^32      |     68.55 % |      0.03% |     90.77 % |      0.03% |  +22.21pp | +32.40% |  🟢 FAST  |
|   I16   |      2^16      |      1.07 % |      8.68% |      1.01 % |     12.83% |   -0.06pp |  -5.30% |  🔵 SAME  |
|   I16   |      2^20      |     13.09 % |      4.70% |     13.10 % |      4.52% |   +0.02pp |  +0.13% |  🔵 SAME  |
|   I16   |      2^24      |     60.67 % |      1.41% |     60.79 % |      1.12% |   +0.11pp |  +0.18% |  🔵 SAME  |
|   I16   |      2^28      |     86.56 % |      0.24% |     89.32 % |      0.13% |   +2.76pp |  +3.19% |  🟢 FAST  |
|   I16   |      2^32      |     88.90 % |      0.04% |     92.69 % |      0.01% |   +3.79pp |  +4.26% |  🟢 FAST  |
|   F32   |      2^16      |      1.99 % |     13.17% |      1.95 % |     13.36% |   -0.04pp |  -1.90% |  🔵 SAME  |
|   F32   |      2^20      |     21.39 % |      3.77% |     21.42 % |      3.85% |   +0.03pp |  +0.15% |  🔵 SAME  |
|   F32   |      2^24      |     72.59 % |      2.01% |     73.41 % |      1.75% |   +0.82pp |  +1.13% |  🔵 SAME  |
|   F32   |      2^28      |     92.91 % |      0.12% |     93.22 % |      0.13% |   +0.32pp |  +0.34% |  🔵 SAME  |
|   F32   |      2^32      |     94.57 % |      0.01% |     94.97 % |      0.01% |   +0.39pp |  +0.41% |  🔵 SAME  |
|   F64   |      2^16      |      3.55 % |     10.18% |      3.53 % |      9.91% |   -0.01pp |  -0.40% |  🔵 SAME  |
|   F64   |      2^20      |     35.22 % |      2.85% |     35.20 % |      2.87% |   -0.02pp |  -0.06% |  🔵 SAME  |
|   F64   |      2^24      |     83.30 % |      0.44% |     83.31 % |      0.45% |   +0.01pp |  +0.02% |  🔵 SAME  |
|   F64   |      2^28      |     94.52 % |      0.08% |     94.51 % |      0.08% |   -0.01pp |  -0.01% |  🔵 SAME  |
|   F64   |      2^32      |     95.48 % |      0.01% |     95.46 % |      0.01% |   -0.01pp |  -0.01% |  🔵 SAME  |
|  I128   |      2^16      |      6.81 % |      4.83% |      6.80 % |      4.71% |   -0.01pp |  -0.11% |  🔵 SAME  |
|  I128   |      2^20      |     47.78 % |      2.37% |     47.72 % |      2.19% |   -0.06pp |  -0.13% |  🔵 SAME  |
|  I128   |      2^24      |     88.54 % |      0.49% |     88.53 % |      0.49% |   -0.00pp |  -0.00% |  🔵 SAME  |
|  I128   |      2^28      |     95.03 % |      0.05% |     95.01 % |      0.05% |   -0.02pp |  -0.02% |  🔵 SAME  |

# relu

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      6.12% |      0.54 % |      6.62% |   -0.00pp |  -0.20% |  🔵 SAME  |
|   F16   |      2^20      |      6.86 % |      5.95% |      6.88 % |      5.90% |   +0.02pp |  +0.32% |  🔵 SAME  |
|   F16   |      2^24      |     47.34 % |      2.08% |     52.98 % |      2.32% |   +5.64pp | +11.92% |  🟢 FAST  |
|   F16   |      2^28      |     82.14 % |      1.09% |     86.54 % |      0.57% |   +4.40pp |  +5.35% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      7.33% |      0.54 % |      8.54% |   -0.00pp |  -0.76% |  🔵 SAME  |
|  BF16   |      2^20      |      6.96 % |      7.23% |      7.01 % |      7.11% |   +0.05pp |  +0.69% |  🔵 SAME  |
|  BF16   |      2^24      |     47.32 % |      2.20% |     51.40 % |      5.20% |   +4.08pp |  +8.61% |  🟢 FAST  |
|  BF16   |      2^28      |     82.46 % |      0.68% |     86.53 % |      0.53% |   +4.07pp |  +4.94% |  🟢 FAST  |
|   F32   |      2^16      |      1.08 % |      7.42% |      1.07 % |      8.78% |   -0.01pp |  -0.94% |  🔵 SAME  |
|   F32   |      2^20      |     13.17 % |      4.07% |     13.18 % |      4.06% |   +0.00pp |  +0.03% |  🔵 SAME  |
|   F32   |      2^24      |     65.11 % |      2.17% |     65.06 % |      2.26% |   -0.06pp |  -0.09% |  🔵 SAME  |
|   F32   |      2^28      |     88.60 % |      0.37% |     88.91 % |      0.39% |   +0.31pp |  +0.35% |  🔵 SAME  |

# sigmoid

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      7.75% |      0.44 % |      9.38% |   -0.10pp | -18.59% |  🔴 SLOW  |
|   F16   |      2^20      |      6.63 % |      4.26% |      6.58 % |      3.95% |   -0.05pp |  -0.70% |  🔵 SAME  |
|   F16   |      2^24      |     31.87 % |      3.43% |     37.17 % |      4.07% |   +5.31pp | +16.65% |  🟢 FAST  |
|   F16   |      2^28      |     45.28 % |      0.21% |     55.96 % |      0.25% |  +10.68pp | +23.58% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      7.01% |      0.44 % |      9.23% |   -0.10pp | -19.11% |  🔴 SLOW  |
|  BF16   |      2^20      |      6.62 % |      4.23% |      6.59 % |      3.91% |   -0.03pp |  -0.51% |  🔵 SAME  |
|  BF16   |      2^24      |     31.80 % |     47.17% |     37.51 % |      4.02% |   +5.72pp | +17.97% |  🔵 SAME  |
|  BF16   |      2^28      |     45.31 % |      0.27% |     55.98 % |      0.21% |  +10.67pp | +23.56% |  🟢 FAST  |
|   F32   |      2^16      |      1.07 % |      8.69% |      0.97 % |     13.49% |   -0.10pp |  -9.17% |  🔵 SAME  |
|   F32   |      2^20      |     13.17 % |      4.11% |     13.19 % |      4.09% |   +0.01pp |  +0.08% |  🔵 SAME  |
|   F32   |      2^24      |     56.75 % |      1.06% |     64.16 % |     43.34% |   +7.42pp | +13.07% |  🔵 SAME  |
|   F32   |      2^28      |     74.00 % |      1.91% |     85.55 % |      2.53% |  +11.55pp | +15.61% |  🟢 FAST  |

# tanh

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      6.22% |      0.52 % |     10.97% |   -0.02pp |  -3.95% |  🔵 SAME  |
|   F16   |      2^20      |      6.71 % |     81.07% |      6.77 % |      4.49% |   +0.06pp |  +0.96% |  🔵 SAME  |
|   F16   |      2^24      |     35.45 % |      1.25% |     42.32 % |      2.13% |   +6.87pp | +19.37% |  🟢 FAST  |
|   F16   |      2^28      |     51.38 % |      0.20% |     64.95 % |      0.93% |  +13.57pp | +26.41% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      8.46% |      0.52 % |     11.64% |   -0.02pp |  -3.52% |  🔵 SAME  |
|  BF16   |      2^20      |      6.73 % |      4.59% |      6.77 % |      4.53% |   +0.04pp |  +0.64% |  🔵 SAME  |
|  BF16   |      2^24      |     35.45 % |      1.24% |     42.03 % |      3.00% |   +6.58pp | +18.55% |  🟢 FAST  |
|  BF16   |      2^28      |     51.34 % |      0.22% |     64.44 % |      0.26% |  +13.10pp | +25.52% |  🟢 FAST  |
|   F32   |      2^16      |      1.07 % |      7.98% |      1.06 % |      9.21% |   -0.01pp |  -1.03% |  🔵 SAME  |
|   F32   |      2^20      |     13.15 % |      4.24% |     13.10 % |      4.61% |   -0.05pp |  -0.36% |  🔵 SAME  |
|   F32   |      2^24      |     58.57 % |      3.19% |     65.38 % |      1.68% |   +6.81pp | +11.63% |  🟢 FAST  |
|   F32   |      2^28      |     76.01 % |      1.97% |     89.46 % |      0.51% |  +13.45pp | +17.69% |  🟢 FAST  |

# gelu

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      7.55% |      0.46 % |     12.07% |   -0.08pp | -14.85% |  🔴 SLOW  |
|   F16   |      2^20      |      6.57 % |      4.19% |      6.57 % |      4.18% |   -0.00pp |  -0.02% |  🔵 SAME  |
|   F16   |      2^24      |     27.14 % |      2.54% |     32.70 % |      1.29% |   +5.57pp | +20.51% |  🟢 FAST  |
|   F16   |      2^28      |     36.72 % |      0.19% |     45.87 % |      0.21% |   +9.15pp | +24.93% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      7.20% |      0.47 % |     13.18% |   -0.07pp | -12.10% |  🔵 SAME  |
|  BF16   |      2^20      |      6.58 % |      3.96% |      6.57 % |      4.10% |   -0.01pp |  -0.16% |  🔵 SAME  |
|  BF16   |      2^24      |     27.42 % |      2.95% |     32.71 % |      1.33% |   +5.28pp | +19.25% |  🟢 FAST  |
|  BF16   |      2^28      |     36.73 % |      0.19% |     45.54 % |      0.22% |   +8.81pp | +23.99% |  🟢 FAST  |
|   F32   |      2^16      |      1.08 % |      7.31% |      1.06 % |      9.49% |   -0.02pp |  -1.54% |  🔵 SAME  |
|   F32   |      2^20      |     13.16 % |      4.24% |     13.17 % |      4.14% |   +0.01pp |  +0.06% |  🔵 SAME  |
|   F32   |      2^24      |     50.10 % |      1.03% |     60.96 % |      1.27% |  +10.86pp | +21.68% |  🟢 FAST  |
|   F32   |      2^28      |     65.05 % |      2.14% |     79.15 % |      2.35% |  +14.10pp | +21.68% |  🟢 FAST  |

# sin

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      6.48% |      0.51 % |     12.82% |   -0.04pp |  -6.81% |  🔵 SAME  |
|   F16   |      2^20      |      6.58 % |      4.03% |      6.58 % |      3.92% |   -0.00pp |  -0.02% |  🔵 SAME  |
|   F16   |      2^24      |     28.72 % |      1.96% |     32.21 % |      3.08% |   +3.49pp | +12.14% |  🟢 FAST  |
|   F16   |      2^28      |     39.36 % |      0.29% |     44.07 % |      0.18% |   +4.71pp | +11.96% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      7.38% |      0.45 % |     10.66% |   -0.10pp | -17.64% |  🔴 SLOW  |
|  BF16   |      2^20      |      6.57 % |      4.27% |      6.58 % |      3.98% |   +0.01pp |  +0.17% |  🔵 SAME  |
|  BF16   |      2^24      |     30.35 % |      1.26% |     35.55 % |      1.53% |   +5.20pp | +17.12% |  🟢 FAST  |
|  BF16   |      2^28      |     41.39 % |      0.17% |     52.26 % |      0.37% |  +10.87pp | +26.26% |  🟢 FAST  |
|   F32   |      2^16      |      1.07 % |      8.51% |      1.00 % |     13.07% |   -0.07pp |  -6.43% |  🔵 SAME  |
|   F32   |      2^20      |     13.17 % |      4.16% |     13.20 % |      3.97% |   +0.02pp |  +0.18% |  🔵 SAME  |
|   F32   |      2^24      |     53.34 % |      1.18% |     60.84 % |      1.12% |   +7.50pp | +14.05% |  🟢 FAST  |
|   F32   |      2^28      |     70.42 % |      1.79% |     79.71 % |      1.93% |   +9.30pp | +13.20% |  🟢 FAST  |

# exp

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.54 % |      6.38% |      0.51 % |     12.33% |   -0.03pp |  -5.66% |  🔵 SAME  |
|   F16   |      2^20      |      6.75 % |      4.46% |      6.70 % |      4.18% |   -0.05pp |  -0.75% |  🔵 SAME  |
|   F16   |      2^24      |     38.86 % |      1.63% |     38.96 % |      1.49% |   +0.10pp |  +0.25% |  🔵 SAME  |
|   F16   |      2^28      |     59.41 % |      0.22% |     60.44 % |      0.23% |   +1.03pp |  +1.74% |  🟢 FAST  |
|  BF16   |      2^16      |      0.54 % |      6.81% |      0.52 % |     10.62% |   -0.02pp |  -3.20% |  🔵 SAME  |
|  BF16   |      2^20      |      6.74 % |      4.42% |      6.76 % |      4.29% |   +0.02pp |  +0.27% |  🔵 SAME  |
|  BF16   |      2^24      |     42.58 % |      1.69% |     52.53 % |      3.91% |   +9.95pp | +23.35% |  🟢 FAST  |
|  BF16   |      2^28      |     70.49 % |      0.21% |     87.79 % |      0.71% |  +17.30pp | +24.55% |  🟢 FAST  |
|   F32   |      2^16      |      1.08 % |      6.70% |      1.08 % |      7.81% |   -0.01pp |  -0.67% |  🔵 SAME  |
|   F32   |      2^20      |     13.19 % |      4.04% |     13.19 % |      4.04% |   +0.00pp |  +0.02% |  🔵 SAME  |
|   F32   |      2^24      |     65.34 % |      1.64% |     65.02 % |      2.30% |   -0.32pp |  -0.49% |  🔵 SAME  |
|   F32   |      2^28      |     83.44 % |      3.18% |     89.00 % |      0.38% |   +5.57pp |  +6.67% |  🟢 FAST  |

# add

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.80 % |      8.93% |      0.78 % |     11.05% |   -0.02pp |  -2.40% |  🔵 SAME  |
|   F16   |      2^20      |      9.88 % |      4.02% |     10.00 % |      4.35% |   +0.12pp |  +1.25% |  🔵 SAME  |
|   F16   |      2^24      |     54.08 % |      2.72% |     57.24 % |      2.45% |   +3.16pp |  +5.84% |  🟢 FAST  |
|   F16   |      2^28      |     84.68 % |      1.40% |     88.58 % |      0.67% |   +3.90pp |  +4.60% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      6.98% |      0.78 % |     11.55% |   -0.03pp |  -4.27% |  🔵 SAME  |
|  BF16   |      2^20      |      9.88 % |      4.04% |     10.00 % |      4.84% |   +0.13pp |  +1.28% |  🔵 SAME  |
|  BF16   |      2^24      |     53.93 % |      2.25% |     57.46 % |      2.82% |   +3.53pp |  +6.55% |  🟢 FAST  |
|  BF16   |      2^28      |     85.20 % |      1.35% |     88.75 % |      0.51% |   +3.55pp |  +4.17% |  🟢 FAST  |
|   F32   |      2^16      |      1.55 % |     11.88% |      1.58 % |     10.38% |   +0.03pp |  +2.17% |  🔵 SAME  |
|   F32   |      2^20      |     17.14 % |      9.38% |     17.58 % |     10.19% |   +0.43pp |  +2.53% |  🔵 SAME  |
|   F32   |      2^24      |     70.74 % |      1.49% |     70.94 % |      1.14% |   +0.20pp |  +0.28% |  🔵 SAME  |
|   F32   |      2^28      |     91.28 % |      0.56% |     92.16 % |      0.19% |   +0.89pp |  +0.97% |  🟢 FAST  |

# sub

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.80 % |      8.60% |      0.78 % |     11.28% |   -0.02pp |  -2.75% |  🔵 SAME  |
|   F16   |      2^20      |      9.88 % |      4.12% |      9.86 % |      4.51% |   -0.02pp |  -0.18% |  🔵 SAME  |
|   F16   |      2^24      |     54.30 % |      3.05% |     57.68 % |      2.36% |   +3.39pp |  +6.24% |  🟢 FAST  |
|   F16   |      2^28      |     84.88 % |      1.42% |     88.66 % |      0.61% |   +3.77pp |  +4.44% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      7.55% |      0.79 % |     10.63% |   -0.02pp |  -2.55% |  🔵 SAME  |
|  BF16   |      2^20      |      9.86 % |      4.17% |      9.88 % |      4.12% |   +0.02pp |  +0.24% |  🔵 SAME  |
|  BF16   |      2^24      |     54.10 % |      2.56% |     57.68 % |      2.42% |   +3.58pp |  +6.62% |  🟢 FAST  |
|  BF16   |      2^28      |     85.21 % |      1.37% |     88.70 % |      0.57% |   +3.50pp |  +4.10% |  🟢 FAST  |
|   F32   |      2^16      |      1.57 % |     87.48% |      1.57 % |     11.06% |   -0.00pp |  -0.20% |  🔵 SAME  |
|   F32   |      2^20      |     17.37 % |      9.94% |     17.32 % |      9.75% |   -0.05pp |  -0.29% |  🔵 SAME  |
|   F32   |      2^24      |     70.82 % |      1.35% |     68.24 % |      2.04% |   -2.58pp |  -3.65% |  🔴 SLOW  |
|   F32   |      2^28      |     91.31 % |      0.57% |     92.17 % |      0.20% |   +0.86pp |  +0.94% |  🟢 FAST  |

# mul

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.81 % |      7.78% |      0.80 % |      9.58% |   -0.01pp |  -1.23% |  🔵 SAME  |
|   F16   |      2^20      |      9.86 % |      4.17% |      9.93 % |      4.44% |   +0.07pp |  +0.75% |  🔵 SAME  |
|   F16   |      2^24      |     53.64 % |      1.52% |     57.69 % |      2.30% |   +4.05pp |  +7.55% |  🟢 FAST  |
|   F16   |      2^28      |     84.63 % |      1.46% |     88.49 % |      0.77% |   +3.87pp |  +4.57% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |     92.10% |      0.79 % |     10.78% |   -0.02pp |  -2.67% |  🔵 SAME  |
|  BF16   |      2^20      |      9.86 % |      4.14% |      9.92 % |      4.45% |   +0.06pp |  +0.59% |  🔵 SAME  |
|  BF16   |      2^24      |     53.97 % |      2.50% |     57.77 % |      2.16% |   +3.80pp |  +7.04% |  🟢 FAST  |
|  BF16   |      2^28      |     85.53 % |      1.20% |     88.72 % |      0.53% |   +3.19pp |  +3.73% |  🟢 FAST  |
|   F32   |      2^16      |      1.57 % |     10.98% |      1.57 % |     11.00% |   -0.00pp |  -0.13% |  🔵 SAME  |
|   F32   |      2^20      |     17.64 % |     10.45% |     16.66 % |      7.08% |   -0.98pp |  -5.53% |  🔵 SAME  |
|   F32   |      2^24      |     70.64 % |      1.72% |     70.77 % |      1.37% |   +0.13pp |  +0.19% |  🔵 SAME  |
|   F32   |      2^28      |     91.20 % |      0.56% |     92.16 % |      0.20% |   +0.96pp |  +1.05% |  🟢 FAST  |

# div

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.80 % |      8.33% |      0.77 % |     11.73% |   -0.03pp |  -3.92% |  🔵 SAME  |
|   F16   |      2^20      |      9.89 % |      3.94% |      9.84 % |      4.40% |   -0.05pp |  -0.51% |  🔵 SAME  |
|   F16   |      2^24      |     49.35 % |      1.38% |     53.09 % |      1.49% |   +3.74pp |  +7.57% |  🟢 FAST  |
|   F16   |      2^28      |     71.52 % |      1.79% |     76.97 % |      1.98% |   +5.44pp |  +7.61% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      6.48% |      0.75 % |     12.94% |   -0.07pp |  -8.41% |  🔵 SAME  |
|  BF16   |      2^20      |      9.89 % |      4.03% |      9.86 % |      4.15% |   -0.03pp |  -0.30% |  🔵 SAME  |
|  BF16   |      2^24      |     49.13 % |      1.26% |     53.72 % |      1.77% |   +4.59pp |  +9.35% |  🟢 FAST  |
|  BF16   |      2^28      |     68.78 % |      0.14% |     82.20 % |      1.74% |  +13.42pp | +19.51% |  🟢 FAST  |
|   F32   |      2^16      |      1.57 % |     11.00% |      1.46 % |     13.39% |   -0.10pp |  -6.64% |  🔵 SAME  |
|   F32   |      2^20      |     16.53 % |      6.78% |     16.25 % |      3.81% |   -0.28pp |  -1.69% |  🔵 SAME  |
|   F32   |      2^24      |     67.33 % |      0.89% |     69.28 % |      2.55% |   +1.95pp |  +2.89% |  🟢 FAST  |
|   F32   |      2^28      |     83.34 % |      2.31% |     90.04 % |      1.33% |   +6.70pp |  +8.04% |  🟢 FAST  |

# le

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.81 % |      7.68% |      0.77 % |     12.09% |   -0.04pp |  -5.15% |  🔵 SAME  |
|   F16   |      2^20      |      9.89 % |      4.05% |      9.87 % |      4.17% |   -0.02pp |  -0.18% |  🔵 SAME  |
|   F16   |      2^24      |     53.65 % |      1.63% |     57.10 % |      3.40% |   +3.45pp |  +6.43% |  🟢 FAST  |
|   F16   |      2^28      |     83.91 % |      0.69% |     88.39 % |      0.17% |   +4.49pp |  +5.35% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      8.30% |      0.79 % |      9.83% |   -0.01pp |  -1.29% |  🔵 SAME  |
|  BF16   |      2^20      |      9.89 % |      4.05% |      9.88 % |      4.20% |   -0.01pp |  -0.11% |  🔵 SAME  |
|  BF16   |      2^24      |     53.61 % |      1.59% |     57.40 % |      2.96% |   +3.79pp |  +7.07% |  🟢 FAST  |
|  BF16   |      2^28      |     84.05 % |      0.61% |     88.41 % |      0.17% |   +4.36pp |  +5.19% |  🟢 FAST  |
|   F32   |      2^16      |      1.56 % |     11.37% |      1.59 % |      9.97% |   +0.02pp |  +1.59% |  🔵 SAME  |
|   F32   |      2^20      |     17.46 % |     10.27% |     16.95 % |      8.71% |   -0.52pp |  -2.95% |  🔵 SAME  |
|   F32   |      2^24      |     70.49 % |      1.92% |     70.91 % |      1.15% |   +0.42pp |  +0.60% |  🔵 SAME  |
|   F32   |      2^28      |     92.03 % |      0.34% |     92.11 % |      0.26% |   +0.09pp |  +0.09% |  🔵 SAME  |

# ge

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.81 % |      8.17% |      0.77 % |     11.91% |   -0.03pp |  -3.91% |  🔵 SAME  |
|   F16   |      2^20      |      9.86 % |     78.66% |      9.83 % |     86.22% |   -0.03pp |  -0.31% |  🔵 SAME  |
|   F16   |      2^24      |     53.68 % |      1.68% |     56.79 % |      3.68% |   +3.11pp |  +5.80% |  🟢 FAST  |
|   F16   |      2^28      |     84.44 % |      0.50% |     88.41 % |      0.18% |   +3.97pp |  +4.71% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      6.94% |      0.79 % |     10.34% |   -0.02pp |  -2.47% |  🔵 SAME  |
|  BF16   |      2^20      |      9.84 % |      4.43% |      9.87 % |      4.32% |   +0.02pp |  +0.25% |  🔵 SAME  |
|  BF16   |      2^24      |     53.62 % |      1.78% |     56.36 % |      3.91% |   +2.74pp |  +5.11% |  🟢 FAST  |
|  BF16   |      2^28      |     85.38 % |      0.20% |     88.42 % |      0.17% |   +3.04pp |  +3.56% |  🟢 FAST  |
|   F32   |      2^16      |      1.56 % |     11.43% |      1.60 % |      8.69% |   +0.04pp |  +2.88% |  🔵 SAME  |
|   F32   |      2^20      |     17.01 % |      8.91% |     16.95 % |      8.63% |   -0.06pp |  -0.37% |  🔵 SAME  |
|   F32   |      2^24      |     70.22 % |      2.15% |     70.87 % |      1.20% |   +0.64pp |  +0.91% |  🔵 SAME  |
|   F32   |      2^28      |     92.16 % |      0.26% |     92.22 % |      0.27% |   +0.06pp |  +0.07% |  🔵 SAME  |

# fmin

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.81 % |      7.19% |      0.78 % |     11.18% |   -0.03pp |  -3.66% |  🔵 SAME  |
|   F16   |      2^20      |      9.85 % |      4.27% |      9.93 % |      4.70% |   +0.08pp |  +0.81% |  🔵 SAME  |
|   F16   |      2^24      |     53.60 % |      1.73% |     56.75 % |      3.75% |   +3.14pp |  +5.86% |  🟢 FAST  |
|   F16   |      2^28      |     82.02 % |      2.05% |     88.65 % |      0.62% |   +6.63pp |  +8.08% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      7.13% |      0.78 % |     11.26% |   -0.03pp |  -4.00% |  🔵 SAME  |
|  BF16   |      2^20      |      9.85 % |      4.33% |      9.87 % |      4.32% |   +0.02pp |  +0.18% |  🔵 SAME  |
|  BF16   |      2^24      |     53.63 % |      1.61% |     56.71 % |      3.74% |   +3.08pp |  +5.74% |  🟢 FAST  |
|  BF16   |      2^28      |     81.82 % |      1.94% |     88.69 % |      0.59% |   +6.87pp |  +8.40% |  🟢 FAST  |
|   F32   |      2^16      |      1.61 % |      8.65% |      1.58 % |     10.34% |   -0.03pp |  -1.67% |  🔵 SAME  |
|   F32   |      2^20      |     17.42 % |     10.17% |     17.54 % |     10.30% |   +0.12pp |  +0.68% |  🔵 SAME  |
|   F32   |      2^24      |     70.11 % |      2.32% |     70.81 % |      1.42% |   +0.70pp |  +1.00% |  🔵 SAME  |
|   F32   |      2^28      |     91.27 % |      0.54% |     92.18 % |      0.19% |   +0.91pp |  +0.99% |  🟢 FAST  |

# fmax

## [0] NVIDIA B200

|  T{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|   F16   |      2^16      |      0.81 % |      6.74% |      0.77 % |     86.24% |   -0.05pp |  -5.64% |  🔵 SAME  |
|   F16   |      2^20      |      9.89 % |      3.94% |      9.92 % |      4.41% |   +0.02pp |  +0.24% |  🔵 SAME  |
|   F16   |      2^24      |     53.68 % |      1.73% |     57.21 % |      3.33% |   +3.53pp |  +6.57% |  🟢 FAST  |
|   F16   |      2^28      |     80.74 % |      1.69% |     88.45 % |      0.79% |   +7.71pp |  +9.55% |  🟢 FAST  |
|  BF16   |      2^16      |      0.81 % |      7.30% |      0.78 % |     11.55% |   -0.03pp |  -4.26% |  🔵 SAME  |
|  BF16   |      2^20      |      9.92 % |      4.13% |      9.90 % |      4.23% |   -0.02pp |  -0.21% |  🔵 SAME  |
|  BF16   |      2^24      |     53.61 % |      1.58% |     56.92 % |      2.93% |   +3.31pp |  +6.18% |  🟢 FAST  |
|  BF16   |      2^28      |     81.36 % |      1.59% |     88.73 % |      0.55% |   +7.37pp |  +9.06% |  🟢 FAST  |
|   F32   |      2^16      |      1.57 % |     10.80% |      1.55 % |     11.98% |   -0.03pp |  -1.78% |  🔵 SAME  |
|   F32   |      2^20      |     17.44 % |     10.20% |     17.57 % |     10.31% |   +0.12pp |  +0.71% |  🔵 SAME  |
|   F32   |      2^24      |     70.33 % |      2.12% |     71.04 % |      1.06% |   +0.71pp |  +1.01% |  🔵 SAME  |
|   F32   |      2^28      |     91.55 % |      0.46% |     92.18 % |      0.18% |   +0.62pp |  +0.68% |  🟢 FAST  |

On heavy, complex, fibnacci, there are no impact from this pr since they disable vectorization (i.e. store_vec_width=1)

For example:

# heavy

## [0] NVIDIA B200

|  Heaviness{ct}  |  Elements{io}  |  Ref BWUtil |   Ref Noise |  Cmp BWUtil |   Cmp Noise |      Diff |   %Diff |  Status  |
|-----------------|----------------|-------------|-------------|-------------|-------------|-----------|---------|----------|
|       32        |      2^16      |      0.84 % |      4.59% |      0.84 % |      4.30% |   -0.00pp |  -0.21% |  🔵 SAME  |
|       32        |      2^20      |      4.44 % |      1.73% |      4.44 % |      1.85% |   +0.00pp |  +0.00% |  🔵 SAME  |
|       32        |      2^24      |      6.89 % |      0.23% |      6.89 % |      0.21% |   -0.00pp |  -0.03% |  🔵 SAME  |
|       32        |      2^28      |      7.22 % |      0.03% |      7.22 % |      0.04% |   -0.00pp |  -0.00% |  🔵 SAME  |
|       32        |      2^32      |      7.25 % |      0.01% |      7.25 % |      0.00% |   -0.00pp |  -0.00% |  🔵 SAME  |
|       64        |      2^16      |      0.74 % |      9.21% |      0.74 % |      9.10% |   -0.00pp |  -0.11% |  🔵 SAME  |
|       64        |      2^20      |      2.53 % |      0.92% |      2.54 % |      0.74% |   +0.01pp |  +0.22% |  🔵 SAME  |
|       64        |      2^24      |      3.40 % |      0.20% |      3.40 % |      0.20% |   +0.00pp |  +0.02% |  🔵 SAME  |
|       64        |      2^28      |      3.54 % |      0.02% |      3.54 % |      0.02% |   +0.00pp |  +0.01% |  🔵 SAME  |
|       64        |      2^32      |      3.55 % |      0.00% |      3.55 % |      0.00% |   +0.00pp |  +0.01% |  🔵 SAME  |
|       128       |      2^16      |      0.56 % |      3.01% |      0.56 % |      3.07% |   +0.00pp |  +0.07% |  🔵 SAME  |
|       128       |      2^20      |      1.37 % |      0.46% |      1.37 % |      0.48% |   -0.00pp |  -0.01% |  🔵 SAME  |
|       128       |      2^24      |      1.67 % |      0.12% |      1.67 % |      0.12% |   +0.00pp |  +0.01% |  🔵 SAME  |
|       128       |      2^28      |      1.72 % |      0.01% |      1.72 % |      0.01% |   -0.00pp |  -0.00% |  🔵 SAME  |
|       128       |      2^32      |      1.72 % |      0.18% |      1.72 % |      0.19% |   +0.00pp |  +0.02% |  🔵 SAME  |
|       256       |      2^16      |      0.37 % |      2.14% |      0.37 % |      2.16% |   -0.00pp |  -0.02% |  🔵 SAME  |
|       256       |      2^20      |      0.52 % |      5.27% |      0.52 % |      5.09% |   -0.00pp |  -0.08% |  🔵 SAME  |
|       256       |      2^24      |      0.63 % |      1.39% |      0.63 % |      1.40% |   -0.00pp |  -0.06% |  🔵 SAME  |
|       256       |      2^28      |      0.66 % |      0.70% |      0.66 % |      0.74% |   -0.00pp |  -0.04% |  🔵 SAME  |
|       256       |      2^32      |      0.63 % |      0.88% |      0.64 % |      0.81% |   +0.00pp |  +0.70% |  🔵 SAME  |

@copy-pr-bot

copy-pr-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Jun 16, 2026
@nanan-nvidia
nanan-nvidia force-pushed the device_transform_align_16 branch from 12991ad to c6559fb Compare June 16, 2026 05:44
@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test c6559fb

@nanan-nvidia nanan-nvidia self-assigned this Jun 16, 2026
@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 365bf3a

@nanan-nvidia
nanan-nvidia force-pushed the device_transform_align_16 branch from 365bf3a to c2a253d Compare June 16, 2026 06:45
@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test c2a253d

@bernhardmgruber

Copy link
Copy Markdown
Contributor

@nanan-nvidia can you please post the output of nvbench_compare.py --no-color as well? I think they are easier to read.

@nanan-nvidia

This comment was marked as outdated.

Comment thread cub/cub/device/device_transform.cuh Resolved
Comment on lines +902 to +903
// When the caller guarantees aligned_size_t<N> num_items, i.e. the output pointer is N-byte aligned and the element
// count is a multiple of N, if 1. there are no predicates, 2. memory layout is contiguous, 3. semantically we can

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical:

the element count is a multiple of N

This is only true for elements with power of two size. Think of aligned_size_t<16>{n} and int3*, which is valid for every n that is a multiple of 4.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In vectorize_store we require both input element size and output element size to be pow2, so this should not be a bug.

From the definition,

explicit constexpr aligned_size_t(size_t __s) : value(__s) {
  _CCCL_ASSERT(value % align == 0,
               "aligned_size_t must be constructed with a size that is a multiple of the alignment");
}

It seems aligned_size_t<16>(n) just mean n % 16 == 0? Does it actually mean (sizeof(T) * n) % 16 == 0 semantically?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aligned_size_t refers to a size in bytes, not in elements, at least according to what we currently document.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

@nanan-nvidia the results look promising. I think the implementation needs a bit more work though. Please check out the notes I have from a discussion with DevTech working on PyTorch: https://github.com/NVIDIA-dev/cccl_private/issues/598.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 6b64983

@nanan-nvidia nanan-nvidia changed the title Vectorize store in ublkcp kernel for deviceTransform when user promises cuda::aligned_size_t<16> Vectorize output store in ublkcp DeviceTransform kernel Jun 23, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@bernhardmgruber bernhardmgruber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking quite good already. Here is some more feedback. I will try to have a more detailed look when I am back next week, because I need an IDE for that.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

The benchmarks look pretty good in general. Some are showing strong regressions tough for small problem sizes, like sigmoid. Do we understand where this comes from?

@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

The benchmarks look pretty good in general. Some are showing strong regressions tough for small problem sizes, like sigmoid. Do we understand where this comes from?

I think this is the classical trade off: since we use a bit more registers when we vectorize, we have a bit worse occupancy, and the problem size is too small for vectorization to show its benefits.

A quick run from my local RTX6000 card shows:

regs achieved occ duration
store_vec_size=8 25 16.8% 3.33 us
store_vec_size =1 16 22.4% 2.91 us

also when problem size is small, the noise tends to be a lot more pronounced too.

@bernhardmgruber

Copy link
Copy Markdown
Contributor

since we use a bit more registers when we vectorize, we have a bit worse occupancy, and the problem size is too small for vectorization to show its benefits.

That makes sense and your quick introspection seems to confirm that. I am fine with accepting the regressions for the otherwise massive benefit.

@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 813550f

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@bernhardmgruber bernhardmgruber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the logic is fine. I'd like to give it another view next week, but the PR otherwise LGTM.

Can you please apply the few suggestions below. I think the overlapping of the can_vectorize with the bulk copy can save a few cycles. Please update one or two benchmarks again, so we have the latest perf.

Really great work!

@bernhardmgruber bernhardmgruber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the vectorized store logic and I think it LGTM. Here are some renaming suggestions that would improve readability IMO:

@bernhardmgruber

Copy link
Copy Markdown
Contributor

@nanan-nvidia I added a bunch of commits with small fixes. The last commit overlaps the can_vectorize and moving of iterators out += offset; with the bulk copy. I believe it should improve performance. Please confirm with a benchmark.

@bernhardmgruber bernhardmgruber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanan-nvidia please consider the above naming suggestions to use in_vec instead of chunk and update the benchmarks. If perf looks good, we can merge.

@nanan-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 0172a01

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 3h 32m: Pass: 100%/287 | Total: 12d 13h | Max: 3h 31m | Hits: 9%/1671302

See results here.

@nanan-nvidia
nanan-nvidia merged commit fb3c945 into NVIDIA:main Jul 8, 2026
305 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Jul 8, 2026
davebayer pushed a commit to davebayer/cccl that referenced this pull request Jul 13, 2026
* cub: vectorize ublkcp output stores for aligned_size_t transforms

* cub: test DeviceTransform aligned_size_t vectorized store (same-width/narrowing/widening)

* c/parallel: thread OutputAlign through transform_kernel name

* cub: runtime-dispatch ublkcp vectorized output store via can_vectorize

* cub: add tunable store_vec to ublkcp vectorized transform store

* cub: test ublkcp vectorized transform store on generic counts (narrowing/widening)

* cub: store_vec=1 disables ublkcp vectorized store; cap to 16B

* cub: guard host vectorize check on contiguous output (fix c.parallel type-erased iterator)

* cub: avoid default-constructing the ublkcp store buffer (support non-default-constructible outputs)

* cub: gate host vectorize check on power-of-two element sizes (fix uchar3 is_aligned assert)

* cub: update copyright year on vectorized transform test

* cub: gate ublkcp store_vec on power-of-two width; add non-pow2 store_vec regression test

* cub: clang-format vectorized transform store changes

* cub: rename store_vec to store_vec_size; static_assert power-of-two store width

* cub: address ublkcp vectorized store review (renames, head_padding assert, docs)

* cub: resolve ublkcp store width in the policy selector and compute can_vectorize in-kernel

* cub: treat store_vec_size 0 as auto in the ublkcp kernel (custom selectors need not set it)

* Apply suggestions from code review

Co-authored-by: Bernhard Manfred Gruber <[email protected]>

* Guard test not using launch wrappers

* Comment

* Extend docs for unroll_factor

* Overlap store vector check with bulk copy

* cub: rename ublkcp gather locals to in_vec per review

---------

Co-authored-by: Bernhard Manfred Gruber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Use vectorized loads from SMEM in bulk copy DeviceTransform kernel

3 participants