Skip to content

Update wasmtime to upstream main (c5675cc5c) - #9

Closed
bacek wants to merge 1 commit into
spr/master/0d7a9272from
spr/master/7ceabee1
Closed

bacek wants to merge 1 commit into
spr/master/0d7a9272from
spr/master/7ceabee1

Conversation

@bacek

@bacek bacek commented Mar 13, 2026 •

Copy link
Copy Markdown
Owner

Fix for wasm_tagtype_t / C API panic on tag exports was merged
upstream as bytecodealliance/wasmtime#12763.

Includes all changes from wasmtime 41.0.1 → upstream main, including
wasmtime 42.0.x releases.

commit-id:7ceabee1
@bacek bacek closed this Mar 13, 2026
bacek pushed a commit that referenced this pull request May 14, 2026
`norm_distance #9` (`BFloat16 L1Distance`) regressed ~10% and `#11`
(`BFloat16 LinfDistance`) regressed ~7-12% on AMD release.

The hot loop is the auto-vectorised `states[VEC_SIZE]` accumulator in
`FunctionArrayDistance::executeWithLeftArgConst`.  At `-march=x86-64-v3`
clang collapses the 8 separate scalar accumulators into a single 256-bit
YMM register and emits `vpmovzxwd` + `vpslld 16` for the BF16->Float32
expansion (vs master's `pxor`/`punpcklwd` against XMM with two parallel
accumulators).  `perf stat` confirms the resulting code runs *fewer*
instructions (-40%) but at *much* lower IPC (3.40 -> 1.89) - the longer
per-iteration latency chain on `vaddps`/`vmaxps` is the bottleneck.

Tweaking the source - bumping `VEC_SIZE` from 8 to 16, or splitting into
two parallel `states_a`/`states_b` arrays - made things *worse* (clang
re-collapses them), so the fix is the same file-level `-march=x86-64-v2`
override already used for `arrayNorm.cpp`.

The `accumulateCombineBF16` AVX-512 specialisation for `L2Distance`/
`CosineDistance` is guarded by `__attribute__((target("...")))` and keeps
its Sapphire Rapids codegen even with the file-level flag.

Bench (Sapphire Rapids LTO, single-threaded, server-side):
  - `L1Distance(BF16)`:   master 0.239s,  PR 0.240s  (was 0.264s, +10%)
  - `LinfDistance(BF16)`: master 0.290s,  PR 0.289s  (was 0.311s, +7%)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bacek pushed a commit that referenced this pull request May 14, 2026
…tion` regressions

`generate_table_function #1` (8 integer column types, 1B rows) regresses ~18% and `#5`
(Date/DateTime, 1B rows) regresses ~16% on AMD release.

`fillColumnWithRandomData` is a big switch over `TypeIndex` that constructs a fresh
column for every block.  At `-march=x86-64-v3` the SLP vectorizer lowers the implicit
~32-byte zero-init of each newly-allocated `ColumnVector`/`ColumnString` to a
`vpxor xmm0; vmovdqu ymm0` pair (29 occurrences in PR vs 0 in master).  Each YMM
store dirties the upper YMM state, so clang inserts a `vzeroupper` (30 inserted)
before every external call from the dispatcher (`operator new`,
`PODArrayBase::reallocPowerOfTwoElements`, etc.) - the per-block dispatch ends up
bracketed by ~30 SSE/AVX transitions for no benefit (the inner PCG generation loop
is byte-equivalent to master's).

The inlined PCG inner loop is the dominant per-row cost, but at v3 the broader
function bloats from 16654 to 18241 bytes (+10%) and the cumulative `vzeroupper`
overhead in the per-block dispatch is what surfaces as the +15-18% regression.
The integer/Date paths are uniformly affected; Decimal/Float paths (#7/#8/#9)
do not regress because they go through a different per-element loop with no YMM
zero-init.

Compiling at v2 keeps the XMM-only zero-init that does not require `vzeroupper`.
The hot PCG inner loop's quality is not affected (master is already at v2 and
generates the same scalar code).

Local Sapphire Rapids LTO (max_threads=12, 10 iter):
  - `#1`:                      master 0.521s, PR 0.521s  (was 0.614s, +18%)
  - `#5`:                      master 0.177s, PR 0.178s  (was 0.208s, +16%)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bacek pushed a commit that referenced this pull request Aug 21, 2026
…nger adds

The previous commit claimed the pruning was not measurable. That was measured on the wrong shape: a
20M x 5M join where every left row matches one right row is dominated by the probe, and the columns
that go away are a small part of the work. The win scales with the number of result rows, and CI found
it on the shapes that have many - `join_nullable_keys_small_table` #5 and #9 and `join_main_loop` #8,
all of them `count()` over a join with disjuncts, went -30%, -34% and -16% on ARM.

Reproduced locally against a build of the parent commit, min of five runs, `max_threads = 8`:

  200M left rows, 1000 right, two `UInt64` keys, count only   424 -> 243 ms
  20M left rows, `String` keys                                102 ->  83 ms,  31 -> 1 MiB
  one of the two keys selected, so only the other one goes    432 -> 390 ms
  RIGHT, which also emits the non-joined right rows           134 -> 138 ms (unchanged)

The test covers those four shapes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_016QJvAjMfovbKtDsMW9mDbF
bacek pushed a commit that referenced this pull request Oct 23, 2026
…the table

Queries #5 (update_partition_key_move) and #9 (update_every_file) of
iceberg_suite_{local,s3}_rw_features are Iceberg ALTER ... UPDATEs whose
WHERE still matches after they ran: #5 re-matches the rows it moved to
partition 'X', #9 matches l_partkey % 10 = 0 forever. Iceberg UPDATE is
merge-on-read, so every execution commits another data file and
position-delete file that the next execution scans, and perf.py has no
per-run reset. Run time therefore grows monotonically within a series
(query_metric_runs_v1, master 2026-10-21: files read per run 6, 8, ..., 18
for #5 and 4, 6, ..., 16 for #9), and the comparison reported both as
unstable on 63-87% of master commits (2026-10-08..10-19, issue ClickHouse#100759).

Make the prewarm run do the one real rewrite and later runs match nothing,
as the suite already does for delete_position_deletes, modify_column and
optimize_manifests: #5 adds `AND l_returnflag != 'X'`, #9 becomes
`l_quantity + 100 ... AND l_quantity < 100` (TPC-H l_quantity is 1..50, and
the predicate stays idempotent for any non-negative value). A mutation that
matches nothing commits nothing, so the measured runs time the mutation's
planning and merge-on-read scan over a fixed table; the rewrite itself
still executes once per server.

The #9 comment no longer claims three data files: the Iceberg writer only
starts a new file at a block boundary, so the 30000-row single-block INSERT
with iceberg_insert_max_rows_in_data_file = 10000 produces one file, on CI
as well (#9 measured run0 reads 4 = 2 passes x 2 files).

Validated locally on a master build, 16 executions per variant: the old
text grows by 2 files read and 1 snapshot per execution (corr(run,
duration) 0.99 / 0.92), the new text is constant after the first measured
run (corr -0.47 / -0.45) with the expected row counts; perf.py
--print-queries shows every other query index unchanged in both suites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bacek pushed a commit that referenced this pull request Oct 23, 2026
…e-idempotent

Stop the Iceberg rw_features perf UPDATE queries #5 and #9 from growing the table on every run
bacek pushed a commit that referenced this pull request Nov 16, 2026
clang 23 vectorizes the row loop of `BinaryOperation::process` for `PlusImpl` and `MinusImpl` with a 256-bit
result on AArch64: interleaved `ld4`/`st4` of two rows and a `cmhi` per limb to recover the carry, instead of the
scalar `adds`/`adcs` chain that clang 22 emits. `wide_integer_add_sub` #9 and #11 are 1.48 and 1.24 times slower
on AArch64. Set `no_vectorize` for these two operations when the result is wider than 16 bytes. Other operations
on 256-bit integers, such as the bitwise ones, stay vectorized.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117346&sha=8f5f84ea035e5a7555cce45519db14963ea8fb59&name_0=PR
ClickHouse#117346

Co-Authored-By: Claude Fable 5.2 <[email protected]>
bacek pushed a commit that referenced this pull request Nov 16, 2026
The collation sort (#2, 5M rows) and the single-column string sort (#3,
20M rows) take 1.2-1.9 s on MasterCI on both arches. They get
disabled="1" (text and number unchanged) and are appended as #9 and #10
on a quarter of the rows with max_block_size = 16384, a quarter of the
default 65409. `numbers_mt` hands out blocks of exactly max_block_size
rows, so each copy has as many blocks as its original (77 and 306): the
same number of cursors in every per-stream merge and the same 16-stream
final merge, with a quarter of the rows per block. EXPLAIN PIPELINE of
each original and its copy is identical (16 streams).

Measured on official MasterCI release builds, two servers pinned to 24
cores of one NUMA node, perf.py, 25 runs: copy / original time 0.248
(#2) and 0.252 (#3), projected CI medians 380 / 487 ms amd, 298 / 483 ms
arm. On the builds before/after ClickHouse#115869 (sorted array of cursors) #2 is
1.161x faster and its copy 1.159x; on those before/after ClickHouse#126829
(cheaper collation) 2.179x and 2.111x; #3 and its copy show no change
on either pair (1.005 / 1.008, 1.004 / 1.001), as the heap guard should.

#0 and #1 stay as they are: on this rig the ClickHouse#115869 change did not show
on them beyond the A/A resolution, so there was no measured guarantee
that copies would keep their sensitivity.

About 32 s (amd) and 29 s (arm) of query time less per master
performance job; 9 queries stay enabled, so all of them still run.

Related: ClickHouse#129258

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant