Stream: git-wasmtime

Topic: wasmtime / issue #3315 Add fuel units to `consumed_fuel` ...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 12:28):

willygroup opened issue #3315:

Is there a way to add some fuel units to the consumed fuel?

I would like "to charge" the calls to my host functions.

Thanks a lot for your work!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 14:11):

willygroup edited issue #3315:

Is there a way to add some fuel units to the consumed fuel?

I would like "to charge" the calls to my host functions.

And why a function that uses an host function to store a Vec<u8> consumes about 10-20 times fuel that a function that uses another host function to load the same data

Thanks a lot for your work!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 14:19):

alexcrichton commented on issue #3315:

By units, do you mean a meaning to the number used to inject fuel? If so that doesn't really have any units per-se and the exact calculation of what fuel is is somewhat fuzzy. It somewhat corresponds to wasm instructions, but not always precisely so.

Fuel is not consumed by host functions, though, other than the call instruction used to enter host code. Different host code should always look like it consumes the same amount of fuel. Can you describe the situation in which you're seeing two host functions consume different amounts of fuel?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 14:23):

bjorn3 commented on issue #3315:

I think @willygroup wants different host functions to consume specific amounts of fuel determined by said host function.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 14:54):

alexcrichton commented on issue #3315:

Ah I think I misread. @willygroup is it accurate to say that you're basically asking for an API to manually consume fuel from the store? Something like Store::consume_fuel(&mut self, amt: u64) -> Result<u64, Trap> where the Result is an error if fuel ran out and otherwise the remaining fuel is returned? (or something like that)

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 08:15):

willygroup commented on issue #3315:

@alexcrichton yes, I was thinking just such a thing.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 08:19):

willygroup edited a comment on issue #3315:

@alexcrichton yes, I was thinking just such a thing.
Also I have a strange situation where I have a host function calling me a method of another wasm and I have to find a method to manage the total fuel consumption.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 10:49):

willygroup commented on issue #3315:

And why a function that uses an host function to store a Vec consumes about 10-20 times fuel that a function that uses another host function to load the same data

Any hints for this?
To test it, I've written a small wasm with 3 methods:

that use 2 host function:

The fuel consumed by these methods is the following:

Thanks a lot!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 10:50):

willygroup edited a comment on issue #3315:

@alexcrichton yes, I was thinking just such a thing.
Also I have a strange situation where I have a host function calling a method of another wasm (I've implemented nested calls) and I have to find a method to manage the total fuel consumption.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 15 2021 at 18:10):

alexcrichton closed issue #3315:

Is there a way to add some fuel units to the consumed fuel?

I would like "to charge" the calls to my host functions.

And why a function that uses an host function to store a Vec<u8> consumes about 10-20 times fuel that a function that uses another host function to load the same data

Thanks a lot for your work!


Last updated: Nov 22 2024 at 16:03 UTC