Apple M1 compatibility (#16346)
Co-authored-by: Christian Drappi <christiandrappi@Christians-MacBook-Pro.local>
This commit is contained in:
@ -15,7 +15,7 @@ use solana_ledger::{
|
||||
blockstore::Blockstore, blockstore_processor::TransactionStatusSender,
|
||||
entry::hash_transactions, leader_schedule_cache::LeaderScheduleCache,
|
||||
};
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
||||
use solana_perf::{
|
||||
cuda_runtime::PinnedVec,
|
||||
@ -224,7 +224,6 @@ impl BankingStage {
|
||||
Builder::new()
|
||||
.name("solana-banking-stage-tx".to_string())
|
||||
.spawn(move || {
|
||||
thread_mem_usage::datapoint("solana-banking-stage-tx");
|
||||
Self::process_loop(
|
||||
my_pubkey,
|
||||
&verified_receiver,
|
||||
|
@ -40,7 +40,6 @@ use rayon::prelude::*;
|
||||
use rayon::{ThreadPool, ThreadPoolBuilder};
|
||||
use serde::ser::Serialize;
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_error};
|
||||
use solana_net_utils::{
|
||||
bind_common, bind_common_in_range, bind_in_range, find_available_port_in_range,
|
||||
@ -1938,7 +1937,6 @@ impl ClusterInfo {
|
||||
let mut generate_pull_requests = true;
|
||||
loop {
|
||||
let start = timestamp();
|
||||
thread_mem_usage::datapoint("solana-gossip");
|
||||
if self.contact_debug_interval != 0
|
||||
&& start - last_contact_info_trace > self.contact_debug_interval
|
||||
{
|
||||
@ -3215,7 +3213,6 @@ impl ClusterInfo {
|
||||
_ => error!("gossip run_listen failed: {}", err),
|
||||
}
|
||||
}
|
||||
thread_mem_usage::datapoint("solana-listen");
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
|
@ -3,7 +3,6 @@
|
||||
use crate::banking_stage::HOLD_TRANSACTIONS_SLOT_OFFSET;
|
||||
use crate::poh_recorder::PohRecorder;
|
||||
use crate::result::{Error, Result};
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
||||
use solana_perf::packet::PacketsRecycler;
|
||||
use solana_perf::recycler::Recycler;
|
||||
@ -140,7 +139,6 @@ impl FetchStage {
|
||||
let fwd_thread_hdl = Builder::new()
|
||||
.name("solana-fetch-stage-fwd-rcvr".to_string())
|
||||
.spawn(move || loop {
|
||||
thread_mem_usage::datapoint("solana-fetch-stage-fwd-rcvr");
|
||||
if let Err(e) =
|
||||
Self::handle_forwarded_packets(&forward_receiver, &sender, &poh_recorder)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ use solana_ledger::{
|
||||
entry::VerifyRecyclers,
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
};
|
||||
use solana_measure::{measure::Measure, thread_mem_usage};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
use solana_runtime::{
|
||||
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
|
||||
@ -319,15 +319,11 @@ impl ReplayStage {
|
||||
let mut voted_signatures = Vec::new();
|
||||
let mut has_new_vote_been_rooted = !wait_for_vote_to_start_leader;
|
||||
loop {
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
|
||||
thread_mem_usage::datapoint("solana-replay-stage");
|
||||
// Stop getting entries if we get exit signal
|
||||
if exit.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
|
||||
let start = allocated.get();
|
||||
let mut generate_new_bank_forks_time =
|
||||
Measure::start("generate_new_bank_forks_time");
|
||||
Self::generate_new_bank_forks(
|
||||
@ -338,11 +334,9 @@ impl ReplayStage {
|
||||
&mut progress,
|
||||
);
|
||||
generate_new_bank_forks_time.stop();
|
||||
Self::report_memory(&allocated, "generate_new_bank_forks", start);
|
||||
|
||||
let mut tpu_has_bank = poh_recorder.lock().unwrap().has_bank();
|
||||
|
||||
let start = allocated.get();
|
||||
let mut replay_active_banks_time = Measure::start("replay_active_banks_time");
|
||||
let ancestors = bank_forks.read().unwrap().ancestors();
|
||||
let descendants = bank_forks.read().unwrap().descendants().clone();
|
||||
@ -364,11 +358,8 @@ impl ReplayStage {
|
||||
&descendants,
|
||||
);
|
||||
replay_active_banks_time.stop();
|
||||
Self::report_memory(&allocated, "replay_active_banks", start);
|
||||
|
||||
let forks_root = bank_forks.read().unwrap().root();
|
||||
let start = allocated.get();
|
||||
|
||||
// Reset any duplicate slots that have been confirmed
|
||||
// by the network in anticipation of the confirmed version of
|
||||
// the slot
|
||||
@ -455,7 +446,6 @@ impl ReplayStage {
|
||||
.select_forks(&frozen_banks, &tower, &progress, &ancestors, &bank_forks);
|
||||
select_forks_time.stop();
|
||||
|
||||
Self::report_memory(&allocated, "select_fork", start);
|
||||
|
||||
let mut select_vote_and_reset_forks_time =
|
||||
Measure::start("select_vote_and_reset_forks");
|
||||
@ -493,8 +483,6 @@ impl ReplayStage {
|
||||
}
|
||||
heaviest_fork_failures_time.stop();
|
||||
|
||||
let start = allocated.get();
|
||||
|
||||
let mut voting_time = Measure::start("voting_time");
|
||||
// Vote on a fork
|
||||
if let Some((ref vote_bank, ref switch_fork_decision)) = vote_bank {
|
||||
@ -535,9 +523,6 @@ impl ReplayStage {
|
||||
};
|
||||
voting_time.stop();
|
||||
|
||||
Self::report_memory(&allocated, "votable_bank", start);
|
||||
let start = allocated.get();
|
||||
|
||||
let mut reset_bank_time = Measure::start("reset_bank");
|
||||
// Reset onto a fork
|
||||
if let Some(reset_bank) = reset_bank {
|
||||
@ -605,12 +590,9 @@ impl ReplayStage {
|
||||
}
|
||||
}
|
||||
}
|
||||
Self::report_memory(&allocated, "reset_bank", start);
|
||||
}
|
||||
reset_bank_time.stop();
|
||||
Self::report_memory(&allocated, "reset_bank", start);
|
||||
|
||||
let start = allocated.get();
|
||||
let mut start_leader_time = Measure::start("start_leader_time");
|
||||
if !tpu_has_bank {
|
||||
Self::maybe_start_leader(
|
||||
@ -636,7 +618,6 @@ impl ReplayStage {
|
||||
}
|
||||
}
|
||||
start_leader_time.stop();
|
||||
Self::report_memory(&allocated, "start_leader", start);
|
||||
|
||||
let mut wait_receive_time = Measure::start("wait_receive_time");
|
||||
if !did_complete_bank {
|
||||
@ -749,17 +730,6 @@ impl ReplayStage {
|
||||
(progress, heaviest_subtree_fork_choice)
|
||||
}
|
||||
|
||||
fn report_memory(
|
||||
allocated: &solana_measure::thread_mem_usage::Allocatedp,
|
||||
name: &'static str,
|
||||
start: u64,
|
||||
) {
|
||||
datapoint_debug!(
|
||||
"replay_stage-memory",
|
||||
(name, (allocated.get() - start) as i64, i64),
|
||||
);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn reset_duplicate_slots(
|
||||
duplicate_slots_reset_receiver: &DuplicateSlotsResetReceiver,
|
||||
|
@ -11,8 +11,7 @@ use bincode::serialize;
|
||||
use rand::distributions::{Distribution, WeightedIndex};
|
||||
use solana_ledger::{blockstore::Blockstore, shred::Nonce};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_measure::thread_mem_usage;
|
||||
use solana_metrics::{datapoint_debug, inc_new_counter_debug};
|
||||
use solana_metrics::inc_new_counter_debug;
|
||||
use solana_perf::packet::{limited_deserialize, Packets, PacketsRecycler};
|
||||
use solana_sdk::{
|
||||
clock::Slot,
|
||||
@ -307,7 +306,6 @@ impl ServeRepair {
|
||||
Self::report_reset_stats(&me, &mut stats);
|
||||
last_print = Instant::now();
|
||||
}
|
||||
thread_mem_usage::datapoint("solana-repair-listen");
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
@ -322,9 +320,7 @@ impl ServeRepair {
|
||||
stats: &mut ServeRepairStats,
|
||||
) {
|
||||
// iter over the packets
|
||||
let allocated = thread_mem_usage::Allocatedp::default();
|
||||
packets.packets.iter().for_each(|packet| {
|
||||
let start = allocated.get();
|
||||
let from_addr = packet.meta.addr();
|
||||
limited_deserialize(&packet.data[..packet.meta.size])
|
||||
.into_iter()
|
||||
@ -336,10 +332,6 @@ impl ServeRepair {
|
||||
let _ignore_disconnect = response_sender.send(rsp);
|
||||
}
|
||||
});
|
||||
datapoint_debug!(
|
||||
"solana-serve-repair-memory",
|
||||
("serve_repair", (allocated.get() - start) as i64, i64),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1390,20 @@ fn report_target_features() {
|
||||
}
|
||||
);
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
// We exclude Mac OS here to be compatible with computers that have Mac M1 chips.
|
||||
// For these computers, one must install rust/cargo/brew etc. using Rosetta 2,
|
||||
// which allows them to run software targeted for x86_64 on an aarch64.
|
||||
// Hence the code below will run on these machines (target_arch="x86_64")
|
||||
// if we don't exclude with target_os="macos".
|
||||
//
|
||||
// It's going to require more more work to get Solana building
|
||||
// on Mac M1's without Rosetta,
|
||||
// and when that happens we should remove this
|
||||
// (the feature flag for code targeting that is target_arch="aarch64")
|
||||
#[cfg(all(
|
||||
any(target_arch = "x86", target_arch = "x86_64"),
|
||||
not(target_os = "macos")
|
||||
))]
|
||||
{
|
||||
unsafe { check_avx() };
|
||||
}
|
||||
|
Reference in New Issue
Block a user