You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: bf16 and its vector friends #20567
Is there an existing issue for the same feature request?
I have checked the existing issues.
Is your feature request related to a problem?
Implement bf16 and its corresponding vector, sparse vector etc types.
https://en.wikipedia.org/wiki/Bfloat16_floating-point_format
Note that bf16 is NOT the same as IEEE half precision format. bf16 is a simple shortening of float32. It is much more widely used in AI world than half precision.
Describe the feature you'd like
New data type.
Describe implementation you've considered
No response
Documentation, Adoption, Use Case, Migration Strategy
Feature verification for #20567 (bf16 and low-precision vector types) (2026-11-11)
Test environment
Implementations: PR #25095 introduced narrow vectors/index quantization; PR #29554, merge 815a6ab038c4a285cdca8169d518f9bb04cdb906, added scalar bf16/float16/float8/float4, vecf8/vecf4 and VECTOR_MATMUL. Its accepted scalar design explicitly defers sparse vectors to separate work.
Tested source and binary: 553e16f52b02d59e9ecc5e3c8862f2603e661f48, fix(parser): support quoted wildcards in DESCRIBE shortcuts (#32339). Binary -version reports 553e16f52b, Go 1.27.1, Darwin/arm64; SHA256 33c50723cc82728d59a58d03ba7e879850db0493584d168eab998d79cfb887bc.
git fetch origin succeeded. Latest fetched main and independent GitHub API lookup both returned d9190ff6d01d15d60acdfcdc9acd96f807a7ab6a. Git ancestry confirms the feature merge is contained in both tested HEAD and main. Tested HEAD is three commits behind main; those three commits were not tested.
Fresh isolated local deployment: 2 CN / 1 TN / 1 LogService + Proxy, shared local DISK-V2 storage, copied binary/native libraries/configuration, macOS 26.6 arm64. MySQL TCP: Proxy 127.0.0.1:6001, CNs 127.0.0.1:16001 and 127.0.0.1:16002. All three returned git_version() = 553e16f52b and actually executed the independent protocol/state checks. SQL file replay used CN1.
Clients: PyMySQL 1.2.4; MySQL Connector/Python 26.10.0 with binary prepared cursors. The service source was not modified; pre-existing untracked .moi-30149/ remained unchanged in Git status.
Test results
Scalar types: DDL/DML, defaults, casts, finite ranges, exact rounding boundaries, comparisons, aggregation, grouping, windows, joins, user variables, SQL preparation and unsupported keys matched existing expectations. Populated-table COPY ALTER ... ADD COLUMN ... NOT NULL without a default succeeded with zero backfill for all four scalar types; the October review finding is covered by the merged regression and passed this run.
Block-scaled vectors: dimensions, odd padding/block boundaries, exact cell/text/binary conversions, invalid input, comparisons, DML and CSV/JSONL/Parquet export/load round trips matched expectations. These checks include decoded values and exact binary equality where the existing SQL asserts it.
CPU VECTOR_MATMUL: filtering, grouping, ties, empty/NULL input, parameters, invalid configuration, all three metrics and the existing 400000-row result comparisons matched expectations. Separately calculated distances and hit ordering from decoded stored vectors matched both vecf8 and vecf4 for two queries under inner_product, l2sq and cosine (12 independent comparisons).
Independent rounding: 10 BF16/IEEE-half boundary cases matched exact-rational BF16 nearest-even selection and Python IEEE-half conversion, comparing float32 bits after canonicalizing zero. No float32 intermediate was used in the final BF16 oracle.
Narrow vectors and IVFFLAT: reused vector conversions/reductions, generic operations, quantization/index queries and synchronous insert/update/delete regressions all matched expected outcomes.
Protocol/state: on all three routes, text results, binary-prepared scalar results and parameterized scalar/vector inserts passed. A rolled-back update preserved the complete original row when read from the other CN. A committed update was flushed; after graceful process restart, complete scalar/vector rows and a persisted view matched saved pre-restart results through all three routes. This is restart durability evidence, not crash recovery or HA certification.
Bugs
No reproducible product bug was found.
Initial mismatches were test-adapter/oracle defects: JDBC error prefixes, FOUND_ROWS, resource substitution, legacy golden formatting, trailing newlines, ignored flush payloads, and an oracle that retained negative zero and rounded wider BF16 input through float32. First-run evidence was retained; corrections and reruns are recorded separately.
Regression coverage
Existing checked-in SQL and golden files were reused:
Execution used python work/replay.py <case paths from the table, without .sql>, python work/probe.py prepare, a graceful service restart with the same isolated data directory, then python work/probe.py verify.
These were sequential custom-adapter replays, not a full mo-tester/MOTR run. The adapter compared row values and expected error messages, retained native error codes, normalized numeric/text formatting, and required OK for operational flushes. JDBC metadata descriptors were not compared. No MOTR commit, PR or new Nightly run was created: the deterministic CPU regressions already exist. The existing 400000-row case was executed; no additional large-data suite was needed for the validated CPU semantics. Worker/batch/block/spill execution was not instrumented, and no engine-parallelism claim is made.
Evidence and not covered
Local deliverables contain raw SQL inputs, golden snapshots, actual results/errors, independent oracle outputs, source/binary/native-library fingerprints, configurations, first-run failures, corrected reruns and service/restart logs, with a SHA256 manifest. Local files are not publicly accessible evidence; this comment reports reproducible commands and counts without presenting local paths as public links. Runtime data remains available locally for review; test databases were dropped by the SQL files/probe, and the isolated service was stopped.
Required remaining acceptance work: GPU VECTOR_MATMUL and GPU distance semantics on a supported CUDA build/device (compute capability >= 10.0), including GPU numerical/admission boundaries. The local Darwin/arm64 build has no CUDA device. The requester also confirmed on 2026-11-11 that no GPU environment is currently available. The existing MO GPU Vector Test workflow was inspected; its current jobs focus on IVFPQ/benchmarks and do not directly execute the new matmul GPU regression. It was not dispatched. A suitable target and execution of gpu_cases/vector/vector_matmul_gpu.sql and related semantics coverage are still needed.
Not executed: current main's three newer commits, Python matrixone.vecblock follow-up APIs from PR #32166, full-cluster upgrade, crash/failover, GPU performance/scale and cross-CN distributed worker instrumentation. Python SDK follow-up and operational extensions are separate from this CPU SQL verification.
Blocked for complete feature acceptance pending supported GPU execution. The implemented CPU SQL, protocol and graceful-restart scope above passed on 553e16f52b; this does not claim GPU verification or verification of the latest main tip. The feature is merged. Keep #20567 open pending the remaining acceptance work.
Activity
148 remaining items
fix(matrixorigin#20567): full-PR review fixes after merging main
docs(matrixorigin#20567): subvector contract on vecf8/vecf4
fix(matrixorigin#20567): DECIMAL UNSIGNED admission of bf16/float16/f…
fix(matrixorigin#20567): GPU-tagged static analysis of the cuBLASLt b…
test(matrixorigin#20567): vecf16/vecbf16 overflow is an out-of-range …
docs(matrixorigin#20567): vecf8/vecf4 in the vector function and dist…
feat: low-precision float types bf16/float16/float8/float4 and vecf8/…
feat(python): matrixone.vecblock and PyTorch examples for vecf8/vecf4 (…
slyunnn commentedon Nov 11, 2026
Feature verification for #20567 (bf16 and low-precision vector types) (2026-11-11)
Test environment
815a6ab038c4a285cdca8169d518f9bb04cdb906, added scalarbf16/float16/float8/float4,vecf8/vecf4andVECTOR_MATMUL. Its accepted scalar design explicitly defers sparse vectors to separate work.553e16f52b02d59e9ecc5e3c8862f2603e661f48,fix(parser): support quoted wildcards in DESCRIBE shortcuts (#32339). Binary-versionreports553e16f52b, Go1.27.1, Darwin/arm64; SHA25633c50723cc82728d59a58d03ba7e879850db0493584d168eab998d79cfb887bc.git fetch originsucceeded. Latest fetched main and independent GitHub API lookup both returnedd9190ff6d01d15d60acdfcdc9acd96f807a7ab6a. Git ancestry confirms the feature merge is contained in both tested HEAD and main. Tested HEAD is three commits behind main; those three commits were not tested.2 CN / 1 TN / 1 LogService + Proxy, shared localDISK-V2storage, copied binary/native libraries/configuration, macOS26.6arm64. MySQL TCP: Proxy127.0.0.1:6001, CNs127.0.0.1:16001and127.0.0.1:16002. All three returnedgit_version() = 553e16f52band actually executed the independent protocol/state checks. SQL file replay used CN1.1.2.4; MySQL Connector/Python26.10.0with binary prepared cursors. The service source was not modified; pre-existing untracked.moi-30149/remained unchanged in Git status.Test results
COPY ALTER ... ADD COLUMN ... NOT NULLwithout a default succeeded with zero backfill for all four scalar types; the October review finding is covered by the merged regression and passed this run.VECTOR_MATMUL: filtering, grouping, ties, empty/NULL input, parameters, invalid configuration, all three metrics and the existing400000-row result comparisons matched expectations. Separately calculated distances and hit ordering from decoded stored vectors matched bothvecf8andvecf4for two queries underinner_product,l2sqandcosine(12independent comparisons).10BF16/IEEE-half boundary cases matched exact-rational BF16 nearest-even selection and Python IEEE-half conversion, comparing float32 bits after canonicalizing zero. No float32 intermediate was used in the final BF16 oracle.Bugs
No reproducible product bug was found.
Initial mismatches were test-adapter/oracle defects: JDBC error prefixes,
FOUND_ROWS, resource substitution, legacy golden formatting, trailing newlines, ignored flush payloads, and an oracle that retained negative zero and rounded wider BF16 input through float32. First-run evidence was retained; corrections and reruns are recorded separately.Regression coverage
Existing checked-in SQL and golden files were reused:
dtype/lowprec_float.sql447/447dtype/lowprec_ddl_dml.sql75/75dtype/vecblock.sql265/265vector/vector_matmul.sql119/119array/array_vecnarrow.sql73/73vector/vector_narrow_types_generic.sql40/40vector/vector_ivf_quantization.sql95/95vector/vector_ivf_quant_dml_sync.sql117/117Total:
1231/1231statements matched expectations, including149expected errors; independently executed checks:43/43.Execution used
python work/replay.py <case paths from the table, without .sql>,python work/probe.py prepare, a graceful service restart with the same isolated data directory, thenpython work/probe.py verify.These were sequential custom-adapter replays, not a full mo-tester/MOTR run. The adapter compared row values and expected error messages, retained native error codes, normalized numeric/text formatting, and required
OKfor operational flushes. JDBC metadata descriptors were not compared. No MOTR commit, PR or new Nightly run was created: the deterministic CPU regressions already exist. The existing400000-row case was executed; no additional large-data suite was needed for the validated CPU semantics. Worker/batch/block/spill execution was not instrumented, and no engine-parallelism claim is made.Evidence and not covered
Local deliverables contain raw SQL inputs, golden snapshots, actual results/errors, independent oracle outputs, source/binary/native-library fingerprints, configurations, first-run failures, corrected reruns and service/restart logs, with a SHA256 manifest. Local files are not publicly accessible evidence; this comment reports reproducible commands and counts without presenting local paths as public links. Runtime data remains available locally for review; test databases were dropped by the SQL files/probe, and the isolated service was stopped.
VECTOR_MATMULand GPU distance semantics on a supported CUDA build/device (compute capability>= 10.0), including GPU numerical/admission boundaries. The local Darwin/arm64 build has no CUDA device. The requester also confirmed on 2026-11-11 that no GPU environment is currently available. The existing MO GPU Vector Test workflow was inspected; its current jobs focus on IVFPQ/benchmarks and do not directly execute the new matmul GPU regression. It was not dispatched. A suitable target and execution ofgpu_cases/vector/vector_matmul_gpu.sqland related semantics coverage are still needed.matrixone.vecblockfollow-up APIs from PR #32166, full-cluster upgrade, crash/failover, GPU performance/scale and cross-CN distributed worker instrumentation. Python SDK follow-up and operational extensions are separate from this CPU SQL verification.Conclusion
Blocked for complete feature acceptance pending supported GPU execution. The implemented CPU SQL, protocol and graceful-restart scope above passed on
553e16f52b; this does not claim GPU verification or verification of the latest main tip. The feature is merged. Keep #20567 open pending the remaining acceptance work.