Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jit package fetching #19632

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

jit package fetching #19632

wants to merge 1 commit into from

Conversation

paperdave
Copy link

see #19063. this makes zig fetch compile and execute lib/compiler/fetch.zig

the following refactors were made:

  • src.introspect.isUpDir is now std.fs.path.isUpDir.
  • src.introspect is now std.zig.introspect
  • src.main's findTemplates, Templates, findBuildRoot, BuildRoot, and FindBuildRootOptions are all moved into std.zig.introspect
  • src.Package's Fetch, Manifest and build_zig_basename are moved into std.zig.package. this container name is lowercase as it has no fields.

src.Package still exists. i found moving Module nontrivial as it depends on Compilation.Config (which depends on build_options) and Zcu.File. the compromise is an ?*anyopaque on Fetch's .module field. it seems only two pointer casts are needed to make this compile.

@andrewrk
Copy link
Member

I played with this locally but it didn't actually save any time building the compiler because the main fetching code, which is n cmdBuild, is still present:

Benchmark 1 (4 runs): before/zig build-exe -fno-llvm -fno-lld ...
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          12.8s  ± 61.5ms    12.7s  … 12.8s           0 ( 0%)        0%
  peak_rss            346MB ±  459KB     345MB …  346MB          0 ( 0%)        0%
  cpu_cycles         64.1G  ±  148M     63.9G  … 64.2G           0 ( 0%)        0%
  instructions        129G  ±  350K      129G  …  129G           0 ( 0%)        0%
  cache_references   4.07G  ± 14.7M     4.06G  … 4.09G           0 ( 0%)        0%
  cache_misses        484M  ± 2.92M      482M  …  488M           0 ( 0%)        0%
  branch_misses       446M  ± 1.90M      444M  …  448M           0 ( 0%)        0%
Benchmark 2 (4 runs): after/zig build-exe -fno-llvm -fno-lld ...
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          12.7s  ±  111ms    12.7s  … 12.9s           0 ( 0%)          -  0.4% ±  1.2%
  peak_rss            346MB ±  141KB     345MB …  346MB          0 ( 0%)          +  0.0% ±  0.2%
  cpu_cycles         63.8G  ± 85.2M     63.7G  … 63.9G           0 ( 0%)          -  0.4% ±  0.3%
  instructions        129G  ±  691K      129G  …  129G           0 ( 0%)          -  0.3% ±  0.0%
  cache_references   4.04G  ± 12.6M     4.02G  … 4.05G           0 ( 0%)          -  0.8% ±  0.6%
  cache_misses        488M  ± 1.38M      487M  …  490M           0 ( 0%)          +  0.9% ±  0.8%
  branch_misses       444M  ±  962K      443M  …  445M           0 ( 0%)          -  0.4% ±  0.6%

I don't think it makes sense to extract only zig fetch to be built externally when the main fetching logic is still bundled into the compiler. It should be both, or neither.

@paperdave paperdave marked this pull request as draft April 13, 2024 05:58
@paperdave paperdave changed the title jit zig fetch jit package fetching Apr 13, 2024
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.

None yet

2 participants