Skip to content
Merged
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
31 changes: 3 additions & 28 deletions backends/arm/runtime/EthosUBackend_LinuxDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ constexpr int64_t kDefaultEthosUTimeoutNs = 60000000000LL;
struct LinuxDriverOptions {
std::string device_path = "/dev/ethosu0";
int64_t timeout_ns = kDefaultEthosUTimeoutNs;
bool enable_cycle_counter = true;
std::array<uint32_t, ETHOSU_PMU_EVENT_MAX> pmu_events{};
};

struct PlatformState {
Expand Down Expand Up @@ -87,8 +85,6 @@ LinuxDriverOptions parse_linux_options(ArrayRef<CompileSpec> specs) {
LinuxDriverOptions options;
constexpr char kDeviceKey[] = "ethosu.device";
constexpr char kTimeoutKey[] = "ethosu.timeout_ns";
constexpr char kCycleCounterKey[] = "ethosu.enable_cycle_counter";
constexpr char kPmuPrefix[] = "ethosu.pmu_event";

for (const CompileSpec& spec : specs) {
if (spec.key == nullptr) {
Expand All @@ -110,27 +106,6 @@ LinuxDriverOptions parse_linux_options(ArrayRef<CompileSpec> specs) {
}
continue;
}

if (strcmp(spec.key, kCycleCounterKey) == 0) {
uint8_t enabled = 0;
if (read_scalar_value(spec, &enabled)) {
options.enable_cycle_counter = enabled != 0;
}
continue;
}

if (strncmp(spec.key, kPmuPrefix, strlen(kPmuPrefix)) == 0) {
const char* index_str = spec.key + strlen(kPmuPrefix);
char* endptr = nullptr;
long idx = std::strtol(index_str, &endptr, 10);
if (endptr != index_str && idx >= 0 &&
idx < static_cast<long>(ETHOSU_PMU_EVENT_MAX)) {
uint32_t event = 0;
if (read_scalar_value(spec, &event)) {
options.pmu_events[static_cast<size_t>(idx)] = event;
}
}
}
}

return options;
Expand Down Expand Up @@ -259,8 +234,8 @@ Error invoke_linux_driver(
state.ofm_buffers.end(),
state.intermediate_buffer,
state.constant_buffer,
options.pmu_events,
options.enable_cycle_counter);
std::array<uint32_t, ETHOSU_PMU_EVENT_MAX>{},
true);

if (inference->wait(options.timeout_ns)) {
ET_LOG(
Expand All @@ -279,7 +254,7 @@ Error invoke_linux_driver(
return Error::InvalidState;
}

if (options.enable_cycle_counter) {
{
try {
ET_LOG(
Info,
Expand Down
Loading