Skip to content

cpu/gen - use hash of preprocessed source for JiT cache lookup - #2058

Open
zatkins-dev wants to merge 10 commits into
mainfrom
zach/jit-cache
Open

zatkins-dev wants to merge 10 commits into
mainfrom
zach/jit-cache

Conversation

@zatkins-dev

@zatkins-dev zatkins-dev commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose:

First attempt at actually using the cache. In my testing, the cost of preprocessing is < 10% of the compilation cost, making the preprocessed source a perfect target for hashing.

Remaining goals:

  • Avoid writing .cpp to disk, instead pipe directly from memory (write to disk in debug mode?)
  • Probably need to encode the compile options into the preprocessed source, maybe as a static string in the source?
  • Add lock files or something for the .so files so that the first process can write and the others can wait.

Closes: #2038

LLM/GenAI Disclosure:

None

@zatkins-dev zatkins-dev self-assigned this Sep 28, 2026
@zatkins-dev
zatkins-dev marked this pull request as draft September 28, 2026 23:11
@zatkins-dev

Copy link
Copy Markdown
Collaborator Author

I feared weird compilers would have issues; ugh.

@jeremylt

Copy link
Copy Markdown
Member

I like being able to just open the cpp for debugability so it should remain an optional feature if removed by default

@zatkins-dev
zatkins-dev force-pushed the zach/jit-cache branch 7 times, most recently from 70922f8 to 806975b Compare September 30, 2026 00:10
@zatkins-dev
zatkins-dev marked this pull request as ready for review September 30, 2026 13:02
@zatkins-dev

Copy link
Copy Markdown
Collaborator Author

I like being able to just open the cpp for debugability so it should remain an optional feature if removed by default

it's now only written in debug mode

@zatkins-dev
zatkins-dev removed the request for review from jeremylt September 30, 2026 13:13
@zatkins-dev

Copy link
Copy Markdown
Collaborator Author

jk there's a problem

@jeremylt

Copy link
Copy Markdown
Member

I like being able to just open the cpp for debugability so it should remain an optional feature if removed by default

it's now only written in debug mode

Can you make CUDA and HIP mirror this behavior?

@zatkins-dev

Copy link
Copy Markdown
Collaborator Author

Can you make CUDA and HIP mirror this behavior?

I kinda blacked out for a bit and now the CUDA Clang JiT is cached and reused in the same way as the CPU. The impact is wayyyy more dramatic, since compiling for device is super slow.

@zatkins-dev

Copy link
Copy Markdown
Collaborator Author

Okay I think this is good to review, I'm happy with the current state.

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.

/cpu/self/gen: Check JiT cache

2 participants