near / wasmtime

Standalone JIT-style runtime for WebAssembly, using Cranelift
https://wasmtime.dev/
Apache License 2.0
3 stars 4 forks source link

Move zkasm generation into zkasm_codegen.rs #216

Closed akashin closed 5 months ago

akashin commented 5 months ago

TODO: We need to find a better place for this module

MCJOHN974 commented 5 months ago

TODO: We need to find a better place for this module

Why you think so? Exploring filetests/src I seen files which do very different stuff, all in one directory. Or you want to move away this code from tests folder and put somewhere like cranelift_codegen?

akashin commented 5 months ago

TODO: We need to find a better place for this module

Why you think so? Exploring filetests/src I seen files which do very different stuff, all in one directory. Or you want to move away this code from tests folder and put somewhere like cranelift_codegen?

Mainly because this functionality is not strictly specific to tests. For example, @mooori is planning to use it in the benchmarking tools that will move outside of filetests folder. cranelift_codegen might be a reasonable place, specifically cranelift/codegen/src/isa/zkasm, but we need to understand the visibility rules there a bit better. @nagisa , where would you say is the good location for this functionality?

akashin commented 5 months ago

I'll submit it as is to unblock https://github.com/near/wasmtime/pull/211, but I'll follow up to move this code to a better location.

nagisa commented 5 months ago

@nagisa , where would you say is the good location for this functionality?

I don't have any particular suggestions off top of my head right now, but I will suggest to not overthink it now and move the shared code out into a a shared dependency when a 2nd user of this code shows up. Moving the code around in anticipation of this 2nd user may very well end up with that code having a singular user in perpetuity anyhow (if e.g. benchmarks' needs turn out to be different enough and it becomes more sensible for it to have its own copy) with all of the associated complexity.

Not to mention that it'll be much easier to pick an appropriate place for the code once the two users actually materialize.