Skip to content

Commit

Permalink
rename parallel to block
Browse files Browse the repository at this point in the history
  • Loading branch information
gelash committed Nov 19, 2022
1 parent fee932e commit 82968ff
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/aptos-move/framework/aptos-token @areshand
/aptos-move/framework/src/natives/cryptography/ @alinush
/aptos-move/framework/src/natives/aggregator_natives/ @georgemitenkov @gelash @zekun000
/aptos-move/parallel-executor/ @gelash @zekun000
/aptos-move/block-executor/ @gelash @zekun000 @sasha8
/aptos-move/vm-genesis/ @davidiw @movekevin

# Owner for logger config
Expand Down
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"aptos-move/aptos-transactional-test-harness",
"aptos-move/aptos-validator-interface",
"aptos-move/aptos-vm",
"aptos-move/block-executor",
"aptos-move/e2e-move-tests",
"aptos-move/e2e-tests",
"aptos-move/e2e-testsuite",
Expand All @@ -26,7 +27,6 @@ members = [
"aptos-move/move-examples",
"aptos-move/mvhashmap",
"aptos-move/package-builder",
"aptos-move/parallel-executor",
"aptos-move/vm-genesis",
"aptos-move/writeset-transaction-generator",
"aptos-node",
Expand Down
8 changes: 3 additions & 5 deletions aptos-move/aptos-transaction-benchmarks/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use aptos_types::{
on_chain_config::{OnChainConfig, ValidatorSet},
transaction::Transaction,
};
use aptos_vm::{
data_cache::AsMoveResolver, parallel_executor::ParallelAptosVM, AptosVM, VMExecutor,
};
use aptos_vm::{block_executor::BlockAptosVM, data_cache::AsMoveResolver};
use criterion::{measurement::Measurement, BatchSize, Bencher};
use language_e2e_tests::{
account_universe::{log_balance_strategy, AUTransactionGen, AccountUniverseGen},
Expand Down Expand Up @@ -188,15 +186,15 @@ impl TransactionBenchState {
fn execute(self) {
// The output is ignored here since we're just testing transaction performance, not trying
// to assert correctness.
AptosVM::execute_block(self.transactions, self.executor.get_state_view())
BlockAptosVM::execute_block(self.transactions, self.executor.get_state_view(), 1)
.expect("VM should not fail to start");
}

/// Executes this state in a single block via parallel execution.
fn execute_parallel(self) {
// The output is ignored here since we're just testing transaction performance, not trying
// to assert correctness.
ParallelAptosVM::execute_block(
BlockAptosVM::execute_block(
self.transactions,
self.executor.get_state_view(),
num_cpus::get(),
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ smallvec = "1.8.0"
tracing = "0.1.34"

aptos-aggregator = { path = "../aptos-aggregator" }
aptos-block-executor = { path = "../block-executor" }
aptos-gas = { path = "../aptos-gas" }
aptos-logger = { path = "../../crates/aptos-logger" }
aptos-metrics-core = { path = "../../crates/aptos-metrics-core" }
aptos-module-verifier = { path = "../../aptos-move/aptos-module-verifier" }
aptos-parallel-executor = { path = "../parallel-executor" }
aptos-state-view = { path = "../../storage/state-view" }
aptos-types = { path = "../../types" }

Expand Down
11 changes: 9 additions & 2 deletions aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::{
validate_signed_transaction, PreprocessedTransaction, VMAdapter,
},
aptos_vm_impl::{get_transaction_output, AptosVMImpl, AptosVMInternals},
block_executor::BlockAptosVM,
counters::*,
data_cache::{AsMoveResolver, IntoMoveResolver},
delta_state_view::DeltaStateView,
errors::expect_only_successful_execution,
logging::AdapterLogSchema,
move_vm_ext::{MoveResolverExt, SessionExt, SessionId},
parallel_executor::ParallelAptosVM,
system_module_names::*,
transaction_arg_validation,
transaction_metadata::TransactionMetadata,
Expand Down Expand Up @@ -971,7 +971,14 @@ impl VMExecutor for AptosVM {
// Record the histogram count for transactions per block.
BLOCK_TRANSACTION_COUNT.observe(transactions.len() as f64);

ParallelAptosVM::execute_block(transactions, state_view, Self::get_concurrency_level())
let log_context = AdapterLogSchema::new(state_view.id(), 0);
info!(
log_context,
"Executing block, transaction count: {}",
transactions.len()
);

BlockAptosVM::execute_block(transactions, state_view, Self::get_concurrency_level())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
// SPDX-License-Identifier: Apache-2.0

mod storage_wrapper;
mod vm_wrapper;
pub(crate) mod vm_wrapper;

use crate::{
adapter_common::{preprocess_transaction, PreprocessedTransaction},
aptos_vm::AptosVM,
logging::AdapterLogSchema,
parallel_executor::vm_wrapper::AptosVMWrapper,
block_executor::vm_wrapper::AptosVMWrapper,
AptosVM,
};
use aptos_aggregator::{delta_change_set::DeltaOp, transaction::TransactionOutputExt};
use aptos_logger::{debug, info};
use aptos_parallel_executor::{
use aptos_block_executor::{
errors::Error,
executor::{ParallelTransactionExecutor, RAYON_EXEC_POOL},
executor::{BlockExecutor, RAYON_EXEC_POOL},
output_delta_resolver::{OutputDeltaResolver, ResolvedData},
task::{Transaction as PTransaction, TransactionOutput as PTransactionOutput},
task::{
Transaction as BlockExecutorTransaction,
TransactionOutput as BlockExecutorTransactionOutput,
},
};
use aptos_logger::debug;
use aptos_state_view::StateView;
use aptos_types::{
state_store::state_key::StateKey,
Expand All @@ -28,7 +30,7 @@ use move_core_types::vm_status::{StatusCode, VMStatus};
use rayon::prelude::*;
use std::collections::HashMap;

impl PTransaction for PreprocessedTransaction {
impl BlockExecutorTransaction for PreprocessedTransaction {
type Key = StateKey;
type Value = WriteOp;
}
Expand All @@ -50,7 +52,7 @@ impl AptosTransactionOutput {
}
}

impl PTransactionOutput for AptosTransactionOutput {
impl BlockExecutorTransactionOutput for AptosTransactionOutput {
type T = PreprocessedTransaction;

fn get_writes(&self) -> Vec<(StateKey, WriteOp)> {
Expand Down Expand Up @@ -81,9 +83,9 @@ impl PTransactionOutput for AptosTransactionOutput {
}
}

pub struct ParallelAptosVM();
pub struct BlockAptosVM();

impl ParallelAptosVM {
impl BlockAptosVM {
fn process_parallel_block_output<S: StateView>(
results: Vec<AptosTransactionOutput>,
delta_resolver: OutputDeltaResolver<StateKey, WriteOp>,
Expand Down Expand Up @@ -143,17 +145,8 @@ impl ParallelAptosVM {
.collect()
});

let log_context = AdapterLogSchema::new(state_view.id(), 0);
info!(
log_context,
"Executing block, transaction count: {}",
transactions.len()
);

let executor =
ParallelTransactionExecutor::<PreprocessedTransaction, AptosVMWrapper<S>>::new(
concurrency_level,
);
BlockExecutor::<PreprocessedTransaction, AptosVMWrapper<S>>::new(concurrency_level);

let mut ret = if concurrency_level > 1 {
executor
Expand All @@ -175,8 +168,11 @@ impl ParallelAptosVM {
.map(Self::process_sequential_block_output);
}

// Explicit async drop. Happens here because we can't currently move to
// BlockExecutor due to the Module publishing fallback. TODO: fix after
// module publishing fallback is removed.
RAYON_EXEC_POOL.spawn(move || {
// Explicit async drop.
// Explicit async drops.
drop(signature_verified_block);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::data_cache::{IntoMoveResolver, StorageAdapterOwned};
use aptos_aggregator::delta_change_set::{deserialize, serialize};
use aptos_parallel_executor::executor::{MVHashMapView, ReadResult};
use aptos_block_executor::executor::{MVHashMapView, ReadResult};
use aptos_state_view::{StateView, StateViewId};
use aptos_types::state_store::state_storage_usage::StateStorageUsage;
use aptos_types::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
use crate::{
adapter_common::{PreprocessedTransaction, VMAdapter},
aptos_vm::AptosVM,
block_executor::{storage_wrapper::VersionedView, AptosTransactionOutput},
data_cache::{AsMoveResolver, StateViewCache, StorageAdapter},
logging::AdapterLogSchema,
move_vm_ext::MoveResolverExt,
parallel_executor::{storage_wrapper::VersionedView, AptosTransactionOutput},
};
use aptos_aggregator::{delta_change_set::DeltaChangeSet, transaction::TransactionOutputExt};
use aptos_logger::prelude::*;
use aptos_parallel_executor::{
use aptos_block_executor::{
executor::MVHashMapView,
task::{ExecutionStatus, ExecutorTask},
};
use aptos_logger::prelude::*;
use aptos_state_view::StateView;
use aptos_types::{state_store::state_key::StateKey, write_set::WriteOp};
use move_core_types::{
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ pub mod foreign_contracts;
mod adapter_common;
pub mod aptos_vm;
mod aptos_vm_impl;
pub mod block_executor;
mod delta_state_view;
mod errors;
pub mod logging;
pub mod move_vm_ext;
pub mod natives;
pub mod parallel_executor;
pub mod read_write_set_analysis;
pub mod system_module_names;
mod transaction_arg_validation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aptos-parallel-executor"
description = "Aptos parallel transaction executor library"
name = "aptos-block-executor"
description = "Aptos block transaction executor library, parallel execution via Block-STM"
version = "0.1.0"

# Workspace inherited keys
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ impl<
}
}

pub struct ParallelTransactionExecutor<T: Transaction, E: ExecutorTask> {
pub struct BlockExecutor<T: Transaction, E: ExecutorTask> {
// number of active concurrent tasks, corresponding to the maximum number of rayon
// threads that may be concurrently participating in parallel execution.
concurrency_level: usize,
phantom: PhantomData<(T, E)>,
}

impl<T, E> ParallelTransactionExecutor<T, E>
impl<T, E> BlockExecutor<T, E>
where
T: Transaction,
E: ExecutorTask<T = T>,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{
executor::ParallelTransactionExecutor,
executor::BlockExecutor,
proptest_types::types::{
ExpectedOutput, KeyType, Task, Transaction, TransactionGen, TransactionGenParams, ValueType,
},
Expand Down Expand Up @@ -110,7 +110,7 @@ where
}

pub(crate) fn run(self) {
let output = ParallelTransactionExecutor::<
let output = BlockExecutor::<
Transaction<KeyType<K>, ValueType<V>>,
Task<KeyType<K>, ValueType<V>>,
>::new(num_cpus::get())
Expand Down
Loading

0 comments on commit 82968ff

Please sign in to comment.