binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Allow --keepfuncs and --splitfuncs to be use alongside a profile data

Open Mintyboi opened this issue 1 year ago • 8 comments

There are times after collecting a profile, we wish to manually include specific functions into the primary module. It could be due to non-deterministic profiling or functions for error scenarios (e.g. _trap).

This PR helps to unlock this workflow by honoring both the --keep-funcs flag as well as the --profile flag

Mintyboi avatar Feb 20 '24 15:02 Mintyboi

@tlively Can you see if this is a suitable improvement that we can include for wasm-split? If so, do we wish to expand it to the --split-funcs flag as well?

Mintyboi avatar Feb 20 '24 15:02 Mintyboi

This makes sense to me! I think we do want to extend it to the --split-funcs flag as well. That way the user can explicitly keep some functions, explicitly split some functions, and depend on the profile to decide what to do for the rest. It would also be good to report a warning if the profile contradicts --split-funcs.

tlively avatar Feb 21 '24 00:02 tlively

Thanks! I've expanded this usage to the --split-funcs flag as well. The functions in --split-funcs will supersede the other split options and show a warning if it contradicts with the profile data or the keep-funcs

Mintyboi avatar Feb 21 '24 05:02 Mintyboi

@tlively Thanks for your review and the comments! Could you help me see if there's anything else I should add in this PR?

Mintyboi avatar Feb 28 '24 03:02 Mintyboi

@tlively Fixed comment and the newline at the eof.

Mintyboi avatar Mar 12 '24 09:03 Mintyboi

Looks like there are some formatting issues to fix. You can ignore the failing Emscripten tests, though.

tlively avatar Mar 12 '24 17:03 tlively

@tlively sorry for the delayed response. I'm still interested to get this in if possible. I'll need some help to trigger the CI so that I can look at the errors

Mintyboi avatar Jun 20 '24 01:06 Mintyboi

I restarted the tests now.

kripken avatar Jun 20 '24 15:06 kripken

I've attempted to fix the linting and the test failures. Please help to trigger the CI again 🙏

Mintyboi avatar Jul 08 '24 15:07 Mintyboi

@tlively @kripken 1 last trigger I hope, before we can land this PR

Mintyboi avatar Jul 10 '24 05:07 Mintyboi

(tests restarted)

kripken avatar Jul 10 '24 15:07 kripken