PoC feature: drop functions from the runtime by mcourteaux · Pull Request #8653 · halide/Halide · GitHub
Skip to content

PoC feature: drop functions from the runtime#8653

Merged
abadams merged 2 commits into
halide:mainfrom
mcourteaux:feat-llvm-runtime-linker-drop-funcs
Jul 25, 2025
Merged

PoC feature: drop functions from the runtime#8653
abadams merged 2 commits into
halide:mainfrom
mcourteaux:feat-llvm-runtime-linker-drop-funcs

Conversation

@mcourteaux

Copy link
Copy Markdown
Contributor

Proof of Concept: I know that the long-term solution is more elaborate (i.e. runtime function renaming), but this 50 cent hack does the trick for me without any manual steps in my build process.

The HL_RUNTIME_DROP_FUNCS environment variable is checked for a comma-separated list of function names to remove from the runtime. Instead of actually deleting them, their body is removed, and their linkage is changed to extern.

@zvookin @abadams Do we want this feature? If so, do we need any changes?

This fixed my issue against which I was battling for 2 days with the Windows linker. Tested this on both Linux and Windows with success.

Comment thread src/LLVM_Runtime_Linker.cpp
@abadams

abadams commented Jul 4, 2025

Copy link
Copy Markdown
Member

…P_FUNCS environment variable, specifying a comma-separated list.
@mcourteaux mcourteaux force-pushed the feat-llvm-runtime-linker-drop-funcs branch from b63f7df to cf0d1da Compare July 22, 2025 15:13
@mcourteaux mcourteaux requested a review from abadams July 22, 2025 15:15
@mcourteaux

Copy link
Copy Markdown
Contributor Author

I'm again maintaining too many branches of my own that I depend on. Can we land this? I implemented your feedback. I didn't start the buildbots, as nothing in the entire build uses this environment flag (and LLVM is badly broken again either way). Running the build bots is useless on this PR I think. I'd argue to just inspect the code. It works for me: I delete halide_device_malloc and halide_device_free successfully.

@abadams abadams requested a review from halidebuildbots July 22, 2025 18:17
@abadams

abadams commented Jul 22, 2025

Copy link
Copy Markdown
Member

I've started the bots, just to check it compiles everywhere, even if it's not run.

It's also sometimes useful to have a PR where you know all the failures are unrelated to the PR.

@mcourteaux

Copy link
Copy Markdown
Contributor Author

It's also sometimes useful to have a PR where you know all the failures are unrelated to the PR.

True, although we already have #8691 for that 😋, but fair, it's been a few days since it ran.

@mcourteaux

Copy link
Copy Markdown
Contributor Author

@abadams abadams merged commit d1c7b61 into halide:main Jul 25, 2025
16 of 19 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.

3 participants