Stream: git-wasmtime

Topic: wasmtime / PR #10484 Allow setting pooling allocation in ...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 16:47):

fridaymore opened PR #10484 from fridaymore:main to bytecodealliance:main:

We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.

Note, the memory-protection-keys feature is not enabled for the C API, so that block is always ignored.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 16:47):

fridaymore requested dicej for a review on PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 16:47):

fridaymore requested wasmtime-core-reviewers for a review on PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 16:55):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 17:17):

alexcrichton submitted PR review:

Thanks! Would you be up for refactoring this to use an object-style API along the lines of wasm_config_t where a new wasmtime_pooling_config_t object was added and the properties here are functions to configure each field? That way it's possible to configure just a single option while leaving all the others at their defaults, while currently it would require configuring all options at the same time.

Additionally as a minor thing, mind putting #ifdef guards around these definitions for the pooling allocator cfg being turned on?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 21:11):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 21:18):

fridaymore commented on PR #10484:

Thanks! Would you be up for refactoring this to use an object-style API along the lines of wasm_config_t where a new wasmtime_pooling_config_t object was added and the properties here are functions to configure each field? That way it's possible to configure just a single option while leaving all the others at their defaults, while currently it would require configuring all options at the same time.

Additionally as a minor thing, mind putting #ifdef guards around these definitions for the pooling allocator cfg being turned on?

Thanks - I switched to an object-style API and added the #ifdef guards for feature gating. Can you opine on memory management for wasmtime_pooling_config_t? I am assuming I need to provide a way to free the memory that was allocated on the heap?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 21:19):

fridaymore edited PR #10484:

We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2025 at 23:14):

alexcrichton commented on PR #10484:

Yeah adding a free method for it I think is the way to go. Otherwise "cloning out" the configuration makes sense to me as well.

Mind also adding wasmtime_* prefixes to the methods/types here too?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2025 at 05:55):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2025 at 06:06):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2025 at 06:07):

fridaymore edited PR #10484:

We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.

Note: mpk options are not exposed.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2025 at 06:09):

fridaymore commented on PR #10484:

Pushed some changes, please take another look.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 14:38):

alexcrichton submitted PR review:

Thanks! Just some minor things here and there, but otherwise looks good

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 14:38):

alexcrichton created PR review comment:

Mind adding a // WASMTIME_FEATURE_POOLING_ALLOCATOR here to indicate which #ifdef it's closing?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 14:38):

alexcrichton created PR review comment:

For this I think the second argument can be const wasmtime_pooling_allocation_config_t* to reflect how it doesn't mutate it.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 14:38):

alexcrichton created PR review comment:

Can you add some documentation to these functions/types? Just some basic docs is fine, but for example indicating that *_new() must be deallocated with *_delete() and perhaps linking to the Rust documentation for wasmtime_pooling_allocation_config_t.

Also for wasmtime_pooling_allocation_strategy_set down below can you document that it doesn't take ownership of the pooling config and the pooling config still needs to be manually deleted?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:26):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore created PR review comment:

Done

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore created PR review comment:

Done

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore created PR review comment:

Done

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:30):

fridaymore requested alexcrichton for a review on PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 16:49):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 17:59):

fridaymore updated PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 18:01):

alexcrichton has enabled auto merge for PR #10484.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2025 at 18:38):

alexcrichton merged PR #10484.


Last updated: Apr 17 2025 at 17:03 UTC