Repository navigation
[cuda] Fix dense histogram offset issue for global-memory - #7261
Conversation
CUDAConstructDiscretizedHistogramDenseKernel_GlobalMemory mis-based its shared_hist_packed pointer on partition_column_start (column-index space) where partition_hist_start (bin space) is required. The two coincide only when every column has exactly one bin, which never holds in real histogram-based training. The three analogous kernels in the same file (non-discretized dense at line 156, non-discretized sparse at line 215, discretized sparse at line 472) all use partition_hist_start. Affects only the dense + use_quantized_grad + USE_GLOBAL_MEM_BUFFER dispatch path (line 615). Flips the regression test added in the previous commit from FAIL to PASS. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jameslamb
left a comment
There was a problem hiding this comment.
A two-partition layout with multi-bin features exposes the bug
Is it possible to introduce a Python or C++ test that could catch this?
a bunch of testing jank
π€ Generated with Claude Code
Please, update the PR title to something that'd be appropriate to include in the project's release notes ("I removed a bunch of testing jank" is not), and write the PR description yourself.
As I said in #7256 (review), I am happy to talk to you but not to an LLM through you.
We're happy to have you contributing, but write the PR title and descriptions here yourself from this point forward. I don't trust Claude or any other LLM's auto-generated PR descriptions, and I don't want to have to ask you "did you really do this?" for the things they say.
Sorry if this sounds harsh but maintaining this library is volunteer work and it's been awful recently, I am trying to set boundaries to make it manageable enough to keep going.
Quoting from @adrinjalali 's post at https://blog.probabl.ai/maintaining-open-source-age-of-gen-ai
"Maintainers like our colleagues, who maintain core data science libraries like scikit-learn and skore, are increasingly submerged in LLM-generated comments, auto-generated issues, and many low-quality PRs that do not advance the project, such as redundant contributions to README files and ones that claim significant performance gains while failing basic linting tests."
"While the cost of writing and contributing code has shrunk thanks to AI, the cost of reviewing and maintaining code hasnβt."
shiyu1994
left a comment
There was a problem hiding this comment.
Thanks for spotting this. Yes, partition_column_start is for data, not for histogram.
jameslamb
left a comment
There was a problem hiding this comment.
Thanks for reviewing @shiyu1994 and for the fix @maxwbuckley . I'll get this merged when CI passes.
Summary
There is a one liner error fix (probably a copy paste error) in
CUDAConstructDiscretizedHistogramDenseKernel_GlobalMemorysrc/treelearner/cuda/cuda_histogram_constructor.cu.The correct version of the pattern appears in CUDAConstructDiscretizedHistogramSparseKernel_GlobalMemory (Sparse).
"blockIdx.y * num_total_bin + partition_hist_start" appears 3 times in the file and one time it appears as "blockIdx.y * num_total_bin + partition_column_start"
partition_column_startandpartition_hist_startare the same when every column has exactly one bin.The bug is dispatched only when
use_quantized_grad == true,USE_GLOBAL_MEM_BUFFER == true, i.e. when the per-partition histogram doesn't fit in shared memory).Verified locally on CUDA 13.2 / sm_120 (RTX 5090).
Added a test that fails on master and passed with the one line fix