Skip to content

Make float16/bfloat16 distinct types#5736

Open
cyyever wants to merge 4 commits into
pytorch:mainfrom
cyyever:bf16-distinct-types
Open

Make float16/bfloat16 distinct types#5736
cyyever wants to merge 4 commits into
pytorch:mainfrom
cyyever:bf16-distinct-types

Conversation

@cyyever
Copy link
Copy Markdown
Contributor

@cyyever cyyever commented May 5, 2026

This PR is the beginning of a series of works to create formal float16 and bfloat16 types, which can be used to simplify the templates by reducing the parameter number and using compile-time computing.

@meta-cla meta-cla Bot added the cla signed label May 5, 2026
@cyyever cyyever force-pushed the bf16-distinct-types branch 2 times, most recently from e706f4c to 620fb4a Compare May 5, 2026 12:39
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 5, 2026

@q10 has imported this pull request. If you are a Meta employee, you can view this in D103884301.

@q10
Copy link
Copy Markdown
Contributor

q10 commented May 5, 2026

@cyyever Looks like there are undefined symbol errors

@cyyever cyyever force-pushed the bf16-distinct-types branch from 620fb4a to 2b887bf Compare May 5, 2026 23:30
@cyyever
Copy link
Copy Markdown
Contributor Author

cyyever commented May 5, 2026

@q10 fixed

@cyyever cyyever force-pushed the bf16-distinct-types branch from 2b887bf to 5b37adc Compare May 6, 2026 03:57
@cyyever
Copy link
Copy Markdown
Contributor Author

cyyever commented May 6, 2026

@q10 fixed

@cyyever cyyever force-pushed the bf16-distinct-types branch from 5b37adc to 947754b Compare May 6, 2026 08:33
@q10
Copy link
Copy Markdown
Contributor

q10 commented May 6, 2026

@cyyever looks like there are test errors on aarch64

@cyyever
Copy link
Copy Markdown
Contributor Author

cyyever commented May 6, 2026

@q10 fixed the tests by restoring some uint16_t branches to keep this PR small, I will clean up them in later PRs

@cyyever cyyever force-pushed the bf16-distinct-types branch 2 times, most recently from 00b67be to f8664a3 Compare May 30, 2026 06:25
cyyever added 4 commits May 30, 2026 14:26
The new struct types for fbgemm::float16/bfloat16 change symbol mangling
of Float16ToFloat_avx2 etc., exposing a latent gap where the
FbgemmFloat16Convert{,Avx2,Avx512}.cc and bf16 counterparts were never
linked into fbgemm_gpu's fbgemm.so. CI now hits an undefined-symbol
error at import time. Add the missing sources to the cmake source list.
Switch from CHECK_SOURCE_RUNS to CHECK_SOURCE_COMPILES so CXX_AVX*_FOUND
reflects compiler capability rather than build-host execution capability.
Runtime dispatch (fbgemmHasAvx512Support / isZmm) already gates execution
on the target CPU, so the runs-based probe was over-strict and skipped
the AVX-512 sources on builders without AVX-512+BF16 hardware, leaving
fbgemm_gpu's fbgemm.so with an unresolved FloatToFloat16_avx512 at load
time.
@cyyever cyyever force-pushed the bf16-distinct-types branch from f8664a3 to 41a247e Compare May 30, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants