Skip to content

[REFACTOR][RUNTIME] Phase out include/tvm/runtime/builtin_fp16.h#19472

Merged
tqchen merged 1 commit into
apache:mainfrom
tqchen:tvm-phase-out-builtin-fp16-h
Apr 29, 2026
Merged

[REFACTOR][RUNTIME] Phase out include/tvm/runtime/builtin_fp16.h#19472
tqchen merged 1 commit into
apache:mainfrom
tqchen:tvm-phase-out-builtin-fp16-h

Conversation

@tqchen

@tqchen tqchen commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

include/tvm/runtime/builtin_fp16.h has 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.cc was 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.

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).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/runtime/builtin_fp16.cc
@tqchen tqchen merged commit 84fbd77 into apache:main Apr 29, 2026
11 checks passed
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.

2 participants