Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executor: Remove LegacyInstanceReuse strategy #1486

Merged
merged 19 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion polkadot/node/core/pvf/prepare-worker/src/memory_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub mod memory_tracker {
/// Module for dealing with the `ru_maxrss` (peak resident memory) stat from `getrusage`.
///
/// NOTE: `getrusage` with the `RUSAGE_THREAD` parameter is only supported on Linux. `RUSAGE_SELF`
/// works on MacOS, but we need to get the max rss only for the preparation thread. Gettng it for
/// works on MacOS, but we need to get the max rss only for the preparation thread. Getting it for
/// the current process would conflate the stats of previous jobs run by the process.
#[cfg(target_os = "linux")]
pub mod max_rss_stat {
Expand Down
8 changes: 0 additions & 8 deletions substrate/client/cli/src/arg_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ pub enum WasmtimeInstantiationStrategy {

/// Recreate the instance from scratch on every instantiation. Very slow.
RecreateInstance,

/// Legacy instance reuse mechanism. DEPRECATED. Will be removed in the future.
///
/// Should only be used in case of encountering any issues with the new default
/// instantiation strategy.
LegacyInstanceReuse,
}

/// The default [`WasmtimeInstantiationStrategy`].
Expand Down Expand Up @@ -92,8 +86,6 @@ pub fn execution_method_from_cli(
sc_service::config::WasmtimeInstantiationStrategy::Pooling,
WasmtimeInstantiationStrategy::RecreateInstance =>
sc_service::config::WasmtimeInstantiationStrategy::RecreateInstance,
WasmtimeInstantiationStrategy::LegacyInstanceReuse =>
sc_service::config::WasmtimeInstantiationStrategy::LegacyInstanceReuse,
},
}
}
Expand Down
7 changes: 0 additions & 7 deletions substrate/client/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ fn bench_call_instance(c: &mut Criterion) {
let _ = env_logger::try_init();

let strategies = [
(
"legacy_instance_reuse",
Method::Compiled {
instantiation_strategy: InstantiationStrategy::LegacyInstanceReuse,
precompile: false,
},
),
(
"recreate_instance_vanilla",
Method::Compiled {
Expand Down

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions substrate/client/executor/common/src/runtime_blob/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
//! is free of any floating point operations, which is a useful step towards making instances
//! produced from such a module deterministic.

mod data_segments_snapshot;
mod globals_snapshot;
mod runtime_blob;

pub use data_segments_snapshot::DataSegmentsSnapshot;
pub use globals_snapshot::{ExposedMutableGlobalsSet, GlobalsSnapshot, InstanceGlobals};
pub use runtime_blob::RuntimeBlob;
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::{error::WasmError, wasm_runtime::HeapAllocStrategy};
use wasm_instrument::{
export_mutable_globals,
parity_wasm::elements::{
deserialize_buffer, serialize, DataSegment, ExportEntry, External, Internal, MemorySection,
MemoryType, Module, Section,
deserialize_buffer, serialize, ExportEntry, External, Internal, MemorySection, MemoryType,
Module, Section,
},
};

Expand Down Expand Up @@ -52,11 +52,6 @@ impl RuntimeBlob {
Ok(Self { raw_module })
}

/// Extract the data segments from the given wasm code.
pub(super) fn data_segments(&self) -> Vec<DataSegment> {
self.raw_module.data_section().map(|ds| ds.entries()).unwrap_or(&[]).to_vec()
}

/// The number of globals defined in locally in this module.
pub fn declared_globals_count(&self) -> u32 {
self.raw_module
Expand Down Expand Up @@ -190,16 +185,6 @@ impl RuntimeBlob {
Ok(())
}

/// Returns an iterator of all globals which were exported by [`expose_mutable_globals`].
pub(super) fn exported_internal_global_names(&self) -> impl Iterator<Item = &str> {
let exports = self.raw_module.export_section().map(|es| es.entries()).unwrap_or(&[]);
exports.iter().filter_map(|export| match export.internal() {
Internal::Global(_) if export.field().starts_with("exported_internal_global") =>
Some(export.field()),
_ => None,
})
}

/// Scans the wasm blob for the first section with the name that matches the given. Returns the
/// contents of the custom section if found or `None` otherwise.
pub fn custom_section_contents(&self, section_name: &str) -> Option<&[u8]> {
Expand Down
10 changes: 0 additions & 10 deletions substrate/client/executor/common/src/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ pub trait WasmInstance: Send {
///
/// This method is only suitable for getting immutable globals.
fn get_global_const(&mut self, name: &str) -> Result<Option<Value>, Error>;

/// **Testing Only**. This function returns the base address of the linear memory.
///
/// This is meant to be the starting address of the memory mapped area for the linear memory.
///
/// This function is intended only for a specific test that measures physical memory
/// consumption.
fn linear_memory_base_ptr(&self) -> Option<*const u8> {
None
}
}

/// Defines the heap pages allocation strategy the wasm runtime should use.
Expand Down
84 changes: 0 additions & 84 deletions substrate/client/executor/src/integration_tests/linux.rs

This file was deleted.

Loading