better throughput scheduling with steady state cost model (WIP)
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "src/Accelerators/PIM/Dialect/Spatial/Passes/Transforms/MergeComputeNodes/DeferredCommunicationScheduling.hpp"
|
||||
#include "src/Accelerators/PIM/Dialect/Spatial/Passes/Transforms/MergeComputeNodes/DeferredBoundaryPlanning.hpp"
|
||||
#include "src/Accelerators/PIM/Compiler/PimScheduleDiagnostic.hpp"
|
||||
#include "src/Accelerators/PIM/Compiler/PimInstructionTiming.hpp"
|
||||
#include "src/Accelerators/PIM/Dialect/Spatial/Passes/Transforms/MergeComputeNodes/DeferredTransferPlanning.hpp"
|
||||
#include "src/Accelerators/PIM/Dialect/Spatial/Passes/Transforms/MergeComputeNodes/ScheduledComputeMaterialization.hpp"
|
||||
#include "src/Accelerators/PIM/Dialect/Spatial/Passes/Transforms/MergeComputeNodes/DeferredCommunicationRealization.hpp"
|
||||
@@ -1030,6 +1032,54 @@ static void checkPublicationMemoryTraffic(mlir::func::FuncOp function,
|
||||
assert(mlir::succeeded(communication));
|
||||
auto boundaries = buildDeferredBoundaryPlan(*shared, *communication, registers);
|
||||
assert(mlir::succeeded(boundaries));
|
||||
std::string before, after;
|
||||
llvm::raw_string_ostream beforeStream(before), afterStream(after);
|
||||
function.print(beforeStream);
|
||||
onnx_mlir::PimInstructionTiming timed;
|
||||
static_cast<SchedulingTarget &>(timed) = target;
|
||||
timed.peerPermissionThenSourceRead = true;
|
||||
timed.signalIssueNs = 1;
|
||||
timed.controlMessageBytes = 1;
|
||||
timed.sharedMemoryRequestLatencyNs.assign(4, 3);
|
||||
timed.sharedMemoryResponseLatencyNs.assign(4, 5);
|
||||
timed.interProcessorLatencyNs.assign(16, 2);
|
||||
for (size_t core = 0; core < 4; ++core)
|
||||
timed.interProcessorLatencyNs[core * 4 + core] = 0;
|
||||
auto report = getPeriodicScheduleReport(graph, *materialized, *shared, *boundaries, timed);
|
||||
assert(report.getString("status") == "estimated");
|
||||
assert(report.getBoolean("diagnostic_only") == true);
|
||||
assert(report.getInteger("boundary_write_bytes") == expected.writeBytes);
|
||||
assert(report.getInteger("boundary_read_bytes") == expected.readBytes);
|
||||
timed.sharedMemoryReadReturnsPayload = false;
|
||||
auto noResponse = getPeriodicScheduleReport(graph, *materialized, *shared, *boundaries, timed);
|
||||
assert(noResponse.getString("status") == "estimated");
|
||||
assert(*noResponse.getNumber("interval_estimate_ns") <= *report.getNumber("interval_estimate_ns"));
|
||||
bool checkedRunOwnership = false;
|
||||
for (size_t i = 0; i < shared->scheduled.size(); ++i)
|
||||
if (!materialized->materializedSchedules[i].runs.empty()) {
|
||||
auto &cores = shared->scheduled[i].cores;
|
||||
assert(cores.size() == 1);
|
||||
cores.push_back((cores.front() + 1) % target.processorCount);
|
||||
auto invalidRun = getPeriodicScheduleReport(graph, *materialized, *shared, *boundaries, timed);
|
||||
assert(invalidRun.getString("status") == "unavailable");
|
||||
assert(invalidRun.getString("reason") == "compact compute runs require one physical core");
|
||||
cores.pop_back();
|
||||
checkedRunOwnership = true;
|
||||
break;
|
||||
}
|
||||
assert(checkedRunOwnership);
|
||||
onnx_mlir::PimInstructionTiming incomplete = timed;
|
||||
incomplete.sharedMemoryRequestLatencyNs.clear();
|
||||
auto unavailable = getPeriodicScheduleReport(graph, *materialized,
|
||||
*shared, *boundaries, incomplete);
|
||||
assert(unavailable.getString("status") == "unavailable");
|
||||
incomplete = timed;
|
||||
incomplete.peerPermissionThenSourceRead = false;
|
||||
unavailable = getPeriodicScheduleReport(graph, *materialized,
|
||||
*shared, *boundaries, incomplete);
|
||||
assert(unavailable.getString("status") == "unavailable");
|
||||
function.print(afterStream);
|
||||
assert(before == after && "periodic diagnostics must not mutate scheduled IR");
|
||||
size_t stores = 0, signals = 0, readyWaits = 0, freeWaits = 0, releases = 0;
|
||||
llvm::DenseSet<int64_t> published;
|
||||
for (const auto &boundary : boundaries->boundaries)
|
||||
|
||||
Reference in New Issue
Block a user