fix(metal-test): rename test-local fp8_nblk, which quant.h now also declares - #845
Merged
Conversation
…eclares
`make metal-test` has not compiled on macOS since quant.h gained
static inline int64_t fp8_nblk(int n)
because tests/test_backend_metal.mm defines its own `static int fp8_nblk`
and includes quant.h further down the same translation unit:
error: functions that differ only in their return type cannot be overloaded
Matching the return type alone does not help — it becomes an inline vs
non-inline redefinition instead. The file keeps independent reference
implementations on purpose (its own comment: "NOT quant.h's E4M3_LUT"), so
the local helper takes the ref_ prefix the other independent helpers here
already use, rather than deferring to quant.h and losing the independence
the test exists for.
Diagnosed, fixed and verified by @J-Oe-2 on an M5 Max (macOS 26.5.1,
Homebrew libomp, command-line tools only): metal-test builds and every case
passes, including GEMM, fused attention with grouped-qa, and top-8 select
with E != 256.
Also checked that no other symbol is defined in both files.
Closes #838
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make metal-testhas not compiled on macOS sincequant.hgainedstatic inline int64_t fp8_nblk, becausetests/test_backend_metal.mmdefines its ownstatic int fp8_nblkand includesquant.hfurther down the same translation unit.Matching the return type alone does not help — it becomes an inline-vs-non-inline redefinition instead.
This file keeps independent reference implementations on purpose (its own comment: "NOT quant.h's E4M3_LUT"), so the local helper takes the
ref_prefix the other independent helpers here already use, rather than deferring toquant.hand losing the independence the test exists for.Diagnosed, fixed and verified by @J-Oe-2 on an M5 Max — macOS 26.5.1, Homebrew libomp, command-line tools only:
metal-testbuilds and every case passes, including GEMM, fused attention with grouped-qa, and top-8 select with E ≠ 256. This PR is his patch.I also checked that no other symbol is defined in both files — this was the only collision.
Timing note: @RDouglasSharp is rebasing #587 tomorrow morning and would have walked straight into this.
Closes #838