Is this a duplicate?
Type of Bug
Performance
Component
cuda.compute (Python)
Describe the bug
In python/cuda_cccl/cuda/compute/algorithms/_histogram.py, _make_histogram_even_impl is cached on:
- num_output_levels_val
- lower_level_val
- upper_level_val
- level_dtype
- num_samples
- uses_privatized_smem
This means calls that differ only in lower/upper scalar values compile/cache separate histogram build artifacts, even when dtype, sample/output layouts, output level regime, and offset type are unchanged.
How to Reproduce
Run the histogram benchmark with configurations that vary only runtime histogram parameters:
pip install 'cuda-bench[cu13]'
python python/cuda_cccl/benchmarks/compute/histogram/even.py
--profile
--axis 'SampleT{ct}=I32'
--axis 'Elements{io}[pow2]=16'
--axis 'Bins=[32,128,2048,2097152]'
--axis 'Entropy=[0.201,1.000]'
Then inspect/cache-instrument make_histogram_even: current main creates separate cached build objects for exact num_output_levels_val, lower_level_val, and upper_level_val, even when the generated-code regime is unchanged.
A minimal object-level repro is to call make_histogram_even twice with the same sample/output layouts, same level_dtype, and same num_bins <= 256 regime, but different lower/upper bounds. Expected: cache reuse. Actual: cache miss because exact scalar values are part of the key.
Expected behavior
We should be able to reuse the cached histogram object even when lower_level_val and upper_level_val change
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response
Is this a duplicate?
Type of Bug
Performance
Component
cuda.compute (Python)
Describe the bug
In python/cuda_cccl/cuda/compute/algorithms/_histogram.py, _make_histogram_even_impl is cached on:
This means calls that differ only in lower/upper scalar values compile/cache separate histogram build artifacts, even when dtype, sample/output layouts, output level regime, and offset type are unchanged.
How to Reproduce
Run the histogram benchmark with configurations that vary only runtime histogram parameters:
pip install 'cuda-bench[cu13]'
python python/cuda_cccl/benchmarks/compute/histogram/even.py
--profile
--axis 'SampleT{ct}=I32'
--axis 'Elements{io}[pow2]=16'
--axis 'Bins=[32,128,2048,2097152]'
--axis 'Entropy=[0.201,1.000]'
Then inspect/cache-instrument make_histogram_even: current main creates separate cached build objects for exact num_output_levels_val, lower_level_val, and upper_level_val, even when the generated-code regime is unchanged.
A minimal object-level repro is to call make_histogram_even twice with the same sample/output layouts, same level_dtype, and same num_bins <= 256 regime, but different lower/upper bounds. Expected: cache reuse. Actual: cache miss because exact scalar values are part of the key.
Expected behavior
We should be able to reuse the cached histogram object even when lower_level_val and upper_level_val change
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response