Skip to content

Merge the three qbit_l2_distance_*_memory performance tests into one file - #129364

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:merge-qbit-l2-distance-memory-perf-tests
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:merge-qbit-l2-distance-memory-perf-tests

Conversation

@groeneai

@groeneai groeneai commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #129258

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Item 2 of #129258: qbit_l2_distance_bfloat16_memory, qbit_l2_distance_float32_memory and qbit_l2_distance_float64_memory differed only in the element type and its full precision. They are now one file, qbit_l2_distance_memory, with the same six queries on the same tables and data.

The full precision of each type is its bit width, so one substitution bits (16, 32, 64) names the table and is the full precision. Substitutions are a cross product and L2DistanceTransposed rejects a precision above the element width, so there are two query templates: precision {bits} (#0-#2) and precision 8 (#3-#5). The tables are renamed from tab_<Type> to tab_<bits>.

iceberg_skip_list.txt now lists the new file instead of the three old ones (Iceberg cannot store a QBit column). Changing that file makes this PR run the Iceberg performance configuration, which is not a required check.

Validation: perf.py --print-queries on the old and new files gives six expanded queries that are byte-identical after the table rename. A local perf.py run of all four files against the master CI binary executes the same nine setup and three drop statements, and gives the same result digest for all six queries.

The saving is small, about 1 s per arch per master commit (the per-test overhead; the three fills stay). The perf history is keyed by test name, so the merged test starts without learned thresholds and is judged at the default floors (0.15 / 0.25) until it has history. Only the two Float64 queries had learned thresholds above those floors.


Workflow [PR]
Sync PR [sync-upstream/pr/129364]

…file

The bfloat16, float32 and float64 variants differed only in the element type
and the full precision. They are now one test, `qbit_l2_distance_memory`,
that measures the same six queries on the same tables and data.

The full precision of each type is its bit width, so one substitution `bits`
(16, 32, 64) names the table and is the full precision. Perf substitutions are
a cross product, and a precision above the element width is rejected by
`L2DistanceTransposed`, so the queries are two templates: one at precision
`{bits}` and one at precision 8. The tables are renamed `tab_<Type>` ->
`tab_<bits>` and created by three explicit statements, since there is no
placeholder that maps the width back to the type.

The Iceberg skip list now names the new file instead of the three old ones,
and the comment in `qbit_distance_transposed_micro.xml` refers to it.

Related: ClickHouse#129258

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (0 blockers, 0 majors).

# Sev Finding Verdict Evidence / action
1 💡 Editing iceberg_skip_list.txt makes this PR run the non-gating Iceberg performance jobs AGREE, no change Required: without the line the new Memory test is selected by the Iceberg configuration and fails on the QBit column. Stated in the description.

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20261104-191300

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? N/A (test-file merge, no failure). Deterministic check: perf.py --print-queries census of old vs new files, and a local perf.py run of all four files on the master CI binary; both comparators redden on corrupted inputs.
b Root cause explained? Three files only because perf substitutions are a cross product and the six (type, precision) pairs are not a product set; L2DistanceTransposed rejects a precision above the element width.
c Fix matches root cause? One substitution bits is both the table suffix and the full precision; precision 8 is a second template. No pair added or dropped.
d Test intent preserved / new tests added? Same six queries, byte-identical after the tab_<Type> to tab_<bits> rename, on the same tables and data. No test of the test infrastructure.
e Both directions demonstrated? Comparators pass on the real files (6/6 queries, 9 setup + 3 drop statements, 6/6 result digests) and fail on a corrupted precision, swapped queries, a missing INSERT and a replaced digest.
f Fix is general across code paths? Every reference to the old names is updated (Iceberg skip list, comment in qbit_distance_transposed_micro.xml); git grep finds none left.
g Fix generalizes across inputs (params/datatypes/wrappers)? All three element types at full precision and at precision 8, as before.
h Backward compatible? (maintainer-approved exception only) No setting or format change. The perf history restarts under the new test name.
i Invariants and contracts preserved? Same measured query set and setup; 6 queries < --max-queries 10, so all run on every master commit; each table stays below 1 GB.

Session id: cron:clickhouse-impl-slot-5:20261104-190200

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

cc @egor-click, could you review this and add the can be tested label so CI runs? It merges qbit_l2_distance_{bfloat16,float32,float64}_memory into one qbit_l2_distance_memory file (item 2 of #129258): one substitution bits names the table and is the full precision, a second template keeps precision 8, and the six expanded queries are byte-identical to the old ones after the table rename.

@clickhouse-gh

clickhouse-gh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c1098f9]

Summary: ✅


AI Review

Summary

PR #129364 consolidates three QBit distance performance tests into qbit_l2_distance_memory.xml. No actionable findings at c1098f96026c1b9f0d1b18e635ff094602a45c28. Independent validation using substitute_parameters confirmed that all six measured queries, nine setup statements, and three cleanup statements are byte-identical after table renaming; discovery and Iceberg exclusion also pass. The new test name intentionally starts a fresh performance-history series, as acknowledged in the discussion.

Missing context / blind spots
  • ⚠️ Performance CI has no completed benchmark results at review time: amd jobs are skipped and arm jobs are pending. Local validation checked expansion and discovery without executing ClickHouse; the author reports a successful execution and matching result digests for all six queries.
Final Verdict

Status: ✅ Approve. No required changes.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 4, 2026
@egor-click

Copy link
Copy Markdown
Contributor

is it just to save 1s per arch?

i don't think it is worth it to be honest, i am working on coverage based runs experiment, and i would suggest to wait until it is finished to look for time savings in perf comparison framework until i have results

this pr if i understand correctly does not change much

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Yes, about 1 s per arch per master commit: each type keeps its own table and fill, so only the per-test overhead goes. It is mainly the file merge from #129258 (three near-identical files become one), not a time saving.

Agreed, I will stop the series until your coverage experiment has results. I will leave this PR open in case the merge is still wanted as a cleanup; feel free to close it otherwise.

@clickhouse-gh clickhouse-gh Bot added can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 4, 2026
@fm4v fm4v closed this Nov 4, 2026
@Algunenano Algunenano reopened this Nov 5, 2026
@Algunenano

Copy link
Copy Markdown
Member

@groeneai Please keep going. Even if it's saving just 1 second, unifying tests and removing duplicates is useful

@egor-click

Copy link
Copy Markdown
Contributor

we have only test and query number for historical results, if we start deleting tests, all query numbers will change and all history we have will be thrown into trash

i don’t like that, @groeneai , this is a solution made in a hurry that will break more than it will improve

i think that we need a way to mark queries disabled,stale so they don't run and only append new queries or create new tests and never change or delete

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Understood. This PR renumbers no query in a surviving test: its 6 queries move to the new test name qbit_l2_distance_memory, so their history starts a new series and the three old ones stop (only the two Float64 queries had learned thresholds above the floor). I won't push to this PR (or open more in the series) until you and @ Algunenano agree on the approach. A disabled marker looks small in perf.py: the query number is the position in the expanded query list, so a disabled <query> that keeps its slot but is not run leaves every other number unchanged. I can send it as a separate PR if you want it.

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@egor-click With the disabled approach this merge no longer saves anything, so I'd close it. Each of the three tests fills its own table (one per QBit element type), so the merged file runs the same three fills and six queries. If the three old files stay with their queries disabled, each still runs as its own perf.py process (connect, settings, SYSTEM STOP MERGES and the wait, sync), so the merged file would only add a fourth process and restart the history of its six queries. Close it, or do you want it in that form anyway?

@egor-click

Copy link
Copy Markdown
Contributor

ill close it for now, skip is the better approach atm, we can revisit when i can build better unique identifiers

@egor-click egor-click closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants