[REFACTOR][RUNTIME] Phase out include/tvm/runtime/builtin_fp16.h#19472
Merged
Conversation
The public header existed only to declare fp16 ABI symbols for compiler-side callers. support/scalars.cc was already phased out upstream; this commit migrates the lone remaining caller (cublas codegen) to the 3rdparty inline header (3rdparty/compiler-rt/builtin_fp16.h, already on the SYSTEM include path), then deletes the public header outright. The call site is updated to use the __extendXfYf2__ template directly (the 3rdparty header provides the template but not the __gnu_h2f_ieee wrapper by name). The TVM_RUNTIME_DLL symbols in src/runtime/builtin_fp16.cc are kept -- they are the JIT-fallback symbols loaded at runtime when libgcc/compiler-rt fp16 builtins are not linked in the host process. That purpose is now documented in a top-of-file comment. Also fixes a broken relative path in src/runtime/contrib/random/mt_random_engine.cc (was '../3rdparty/...' which resolves to a non-existent path; it compiled only because the SYSTEM include path covered it). Same pattern as the runtime/threading_backend.h phase-out (apache#19469).
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the public header include/tvm/runtime/builtin_fp16.h and updates internal components to use the compiler-rt version of builtin_fp16.h. It also adds documentation explaining the JIT-fallback rationale for fp16 symbols. Feedback indicates that the JIT-fallback implementation in src/runtime/builtin_fp16.cc may be incomplete, as it lacks exports for standard symbols like __truncsfhf2 and __extendhfsf2 which were previously available in the public header.
spectrometerHBH
approved these changes
Apr 29, 2026
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.
Summary
include/tvm/runtime/builtin_fp16.hhas been in the public include tree without serving a public-API purpose. The header declared fp16 ABI symbols (__gnu_f2h_ieee,__gnu_h2f_ieee, etc.) for compiler-side callers;support/scalars.ccwas already phased out upstream, and this PR migrates the lone remaining caller (src/relax/backend/contrib/cublas/codegen.cc) to the 3rdparty inline header (3rdparty/compiler-rt/builtin_fp16.h, already on the CMake SYSTEM include path), then deletes the public header outright.