mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-09 19:53:17 +08:00
The LLVM helper's runtime-unit now optimizes a unit itself (--opt-level), with IR instrumentation (--profile-generate) or a profile (--profile-use), through the same pipeline as program code. The Linux x64 pack's speed units are compiled to unoptimized bitcode and optimized there with packages/runtime-pack-common/profiles/linux-x64-gnu.profdata.gz, so one LLVM writes and reads every profile. Release and library flavors are unchanged. The pack manifest records how the profile matched the units. Code the runtime profile finds cold is optimized for speed, not size: a runtime function the training programs rarely call can be hot in another program. scr_message.c is optimized without the profile. scripts/refresh-runtime-profile.mjs trains the profile on the runtime benchmark workloads and, optionally, a tsc-ts checkout, and keeps only the records of functions the instrumented runtime units define (merge-profiles --keep-functions). Tests check that the profile still matches the runtime and names only runtime functions.
16 lines
591 B
C++
16 lines
591 B
C++
#pragma once
|
|
|
|
namespace scriptc {
|
|
|
|
// `merge-profiles --output <file.profdata> [--sparse] [--keep-functions
|
|
// <file>] <input>...`: merges raw (.profraw) or indexed (.profdata) IR
|
|
// profiles into one indexed profile. --sparse leaves out functions that never
|
|
// ran, and --keep-functions every function the file does not name.
|
|
int mergeProfiles(int Argc, char **Argv);
|
|
|
|
// `profile-functions --input <file.profdata>`: prints the names of the
|
|
// functions an indexed profile has records for, as {"ok":true,"functions":[]}.
|
|
int profileFunctions(int Argc, char **Argv);
|
|
|
|
} // namespace scriptc
|