Repository navigation
[Refactor] sampling: Build watermark rows per step - #52158
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
/rerun-test test_watermark.py test_synthid_watermark.py test_watermark_selector.py test_watermark_state.py registered/kernels/ops/sampling/test_synthid.py test_synthid_adapter.py test_sampling_batch_info.py test_eagle_post_verify_graphs.py test_overlap_uocr_decode.py |
|
🚀 🚀 🚀 |
|
/run-cpu-ci |
|
🚀 Running |
Motivation
Watermark rows (
SynthIDRows,GumbelRows) were built once perSamplingBatchInfoand then carried through everyfilter_batchandmerge_batch. Each row is a pure function of its request's sampling params, so the scheduler was maintaining per-batch state that it could rebuild from the step's requests. #52035 did the same for penalties: the scheduler builds each step's penalty state at launch, and nothing is filtered or merged.Modifications
Scheduler.run_batchbuilds the step's watermark rows frombatch.reqswithbuild_watermark_rows, next toStepPenalties.build, and sets them onbatch.sampling_info.watermark. Every reader (seed_payloadinForwardBatch.init_new,bind_sample,bind_verify, the logits processor, and the spec verify paths) runs inside the forward thatrun_batchlaunches.SamplingBatchInfo.from_schedule_batch;filter_batch/merge_batch;merge_watermark_rows;filter/concat/prepend_offfrom theWatermarkRowsprotocol and fromSynthIDRows/GumbelRows;_off_rows.async_h2d, so the per-step build does not block on the copy.Behavior changes
enabled, as a batch that was never merged already did. Every kernel and torch path gates onenabledandtop_k > 1together, so no output changes.Accuracy Tests
test_watermark.py,test_synthid_watermark.py) already exercise them.Checklist
CI States
Latest PR Test (Base): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (Extra): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (AMD ROCm 10): ⊘ Skipped -- add the
run-cilabel to run CI tests.Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: