Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
romnn committed Feb 7, 2024
1 parent c4cc4f0 commit ca297f8
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 332 deletions.
70 changes: 45 additions & 25 deletions playground/sys/src/ref/scheduler_unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void scheduler_unit::cycle() {
// waiting for pending register writes
bool issued_inst = false; // of these we issued one

bool should_log = logger->should_log(spdlog::level::debug);

// if (logger->should_log(spdlog::level::debug)) {
// std::vector<unsigned> tmp_warp_ids;
// std::vector<trace_shd_warp_t *>::const_iterator iter;
Expand All @@ -48,16 +50,22 @@ void scheduler_unit::cycle() {
// name(), m_id, fmt::join(tmp_warp_ids, ", "));
// }

logger->debug(
"{}[{}, core {}]: BEFORE: prioritized warp ids: [{}]", name(), m_id,
m_shader->m_sid,
fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_warp_ids, ", "));
logger->debug(
"{}[{}, core {}]: BEFORE: prioritized dynamic warp ids: [{}]", name(),
m_id, m_shader->m_sid,

fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids,
", "));
if (should_log) {
// logger->debug(
// fmt::println(
// "{}[{}, core {}]: BEFORE: prioritized warp ids: [{}]", name(), m_id,
// m_shader->m_sid,
// fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_warp_ids,
// ", "));
logger->debug(
// fmt::println(
"{}[{}, core {}]: BEFORE: prioritized dynamic warp ids: [{}]", name(),
m_id, m_shader->m_sid,

fmt::join(
m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids,
", "));
}

// TODO REMOVE
// fmt::println(
Expand All @@ -66,9 +74,12 @@ void scheduler_unit::cycle() {
// fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_warp_ids, ",
// "));

logger->debug("{}[{}, core {}]: last issued from {}", name(), m_id,
m_shader->m_sid,
(*m_last_supervised_issued)->get_dynamic_warp_id());
if (should_log) {
// fmt::println(
logger->debug("{}[{}, core {}]: last issued from {}", name(), m_id,
m_shader->m_sid,
(*m_last_supervised_issued)->get_dynamic_warp_id());
}
order_warps();

// if (logger->should_log(spdlog::level::debug)) {
Expand All @@ -81,23 +92,30 @@ void scheduler_unit::cycle() {
m_next_cycle_prioritized_warps_lockstep_compat_warp_ids.push_back(
(*iter)->get_warp_id());
}
logger->debug(
"{}[{}, core {}]: AFTER: prioritized warp ids: [{}]", name(), m_id,
m_shader->m_sid,
fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_warp_ids, ", "));
if (should_log) {
// logger->debug(
// fmt::println(
// "{}[{}, core {}]: AFTER: prioritized warp ids: [{}]", name(), m_id,
// m_shader->m_sid,
// fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_warp_ids,
// ", "));
}

m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids.clear();
for (iter = m_next_cycle_prioritized_warps.begin();
iter != m_next_cycle_prioritized_warps.end(); iter++) {
m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids.push_back(
(*iter)->get_dynamic_warp_id());
}
logger->debug(
"{}[{}, core {}]: AFTER: prioritized dynamic warp ids: [{}]", name(),
m_id, m_shader->m_sid,
fmt::join(m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids,
", "));
// }
if (should_log) {
logger->debug(
// fmt::println(
"{}[{}, core {}]: AFTER: prioritized dynamic warp ids: [{}]", name(),
m_id, m_shader->m_sid,
fmt::join(
m_next_cycle_prioritized_warps_lockstep_compat_dynamic_warp_ids,
", "));
}

// TODO REMOVE
// fmt::println(
Expand All @@ -121,7 +139,9 @@ void scheduler_unit::cycle() {
continue;
}
assert(next_warp->instruction_count() > 0);
if (!next_warp->trace_done() && next_warp->instruction_count() > 1) {

if (should_log && !next_warp->trace_done() &&
next_warp->instruction_count() > 1) {
logger->debug(
"core[{}][{}] scheduler[{}]: \n\t => testing (warp_id={}, "
"dynamic_warp_id={}, trace_pc = {}, pc={}, ibuffer=[{}, {}], {} "
Expand Down Expand Up @@ -197,7 +217,7 @@ void scheduler_unit::cycle() {
if (pI) m_shader->get_pdom_stack_top_info(warp_id, pI, &pc, &rpc);

if (pI) {
if (logger->should_log(spdlog::level::debug)) {
if (should_log) {
logger->debug(
"Warp (warp_id {}, dynamic_warp_id {}) instruction buffer[{}] "
"has "
Expand Down
1 change: 1 addition & 0 deletions playground/sys/src/ref/scheduler_unit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class scheduler_unit {
T greedy_value = *last_issued_from_input;
result_list.push_back(greedy_value);

// fmt::println("added greedy warp: {}",
logger->debug("added greedy warp: {}",
greedy_value->get_dynamic_warp_id());

Expand Down
25 changes: 13 additions & 12 deletions playground/sys/src/ref/trace_shader_core_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ void trace_shader_core_ctx::fetch() {
break;
}
}
logger->trace("fetch: num checked={}", num_checked);
// fmt::println("play fetch: num checked={}", num_checked);
}
}
Expand Down Expand Up @@ -1791,18 +1792,18 @@ bool trace_shader_core_ctx::warp_waiting_at_mem_barrier(unsigned warp_id) {
if (!m_warp[warp_id]->get_membar()) return false;
if (!m_scoreboard->has_pending_writes(warp_id)) {
m_warp[warp_id]->clear_membar();
// ROMAN: remove this for now as this is very out of place
// if (m_gpu->get_config().flush_l1()) {
// // Mahmoud fixed this on Nov 2019
// // Invalidate L1 cache
// // Based on Nvidia Doc, at MEM barrier, we have to
// //(1) wait for all pending writes till they are acked
// //(2) invalidate L1 cache to ensure coherence and avoid reading
// // stall
// // data
// cache_invalidate();
// // TO DO: you need to stall the SM for 5k cycles.
// }
if (m_gpu->gpgpu_ctx->accelsim_compat_mode &&
m_gpu->get_config().flush_l1()) {
// Mahmoud fixed this on Nov 2019
// Invalidate L1 cache
// Based on Nvidia Doc, at MEM barrier, we have to
//(1) wait for all pending writes till they are acked
//(2) invalidate L1 cache to ensure coherence and avoid reading
// stall
// data
cache_invalidate();
// TO DO: you need to stall the SM for 5k cycles.
}
return false;
}
return true;
Expand Down
Loading

0 comments on commit ca297f8

Please sign in to comment.