amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth
range given to batch 22), each with at least one independent
contract-edge defect and plain public docs. Claude reviewed 100/100
USABLE against current digests; no ID or source overlap with main or
batch 22. Difficulty is unmeasured.

progress.md records the wrap-up: all Codex sessions and Qwen schedulers
stopped for the user's rollout, Qwen results so far (57 HARD of 373),
and what is left on each batch branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:52:13 +08:00

103 lines
4.3 KiB
C++

#include "resource_map.hpp"
#include <iostream>
#include <string>
using namespace resource_map;
namespace {
void mapping_fields(const MappingInfo& m)
{
std::cout << m.token << ' ' << m.owner << ' ' << m.resource_index
<< ' ' << m.start << ' ' << m.size << ' ' << m.reads
<< ' ' << m.writes << ' ' << m.fills;
}
}
int main()
{
Manager manager;
std::string command;
while (std::cin >> command) {
if (command == "Z") {
manager.reset();
std::cout << "Z\n";
} else if (command == "C") {
int id, count;
std::cin >> id >> count;
std::vector<Resource> resources;
for (int index = 0; index < count; ++index) {
Resource resource;
std::cin >> resource.kind >> resource.start >> resource.size;
resources.push_back(resource);
}
std::cout << "C " << static_cast<int>(manager.configure(id, resources)) << '\n';
} else if (command == "P") {
int id, ordinal, fault;
std::cin >> id >> ordinal >> fault;
const auto result = manager.probe(id, ordinal, fault);
std::cout << "P " << static_cast<int>(result.code) << ' ' << result.token << '\n';
} else if (command == "X") {
int id;
std::cin >> id;
std::cout << "X " << static_cast<int>(manager.remove(id)) << '\n';
} else if (command == "R") {
std::uint64_t token, offset;
int width;
std::cin >> token >> offset >> width;
const auto result = manager.read(token, offset, width);
std::cout << "R " << static_cast<int>(result.code) << ' ' << result.value << '\n';
} else if (command == "W") {
std::uint64_t token, offset, value;
int width;
std::cin >> token >> offset >> width >> value;
std::cout << "W " << static_cast<int>(manager.write(token, offset, width, value)) << '\n';
} else if (command == "F") {
std::uint64_t token, offset;
int count, value;
std::cin >> token >> offset >> count >> value;
std::cout << "F " << static_cast<int>(manager.fill(token, offset, count, value)) << '\n';
} else if (command == "B") {
std::uint64_t token, offset;
int count;
std::cin >> token >> offset >> count;
const auto result = manager.dump(token, offset, count);
std::cout << "B " << static_cast<int>(result.code) << ' ' << result.bytes.size();
for (auto byte : result.bytes) {
std::cout << ' ' << byte;
}
std::cout << '\n';
} else if (command == "D") {
int id;
std::cin >> id;
const auto result = manager.device(id);
std::cout << "D " << static_cast<int>(result.code) << ' ' << result.configured
<< ' ' << result.active << ' ' << result.resource_count
<< ' ' << result.token << ' ' << result.mem_ordinal << '\n';
} else if (command == "E") {
int id, index;
std::cin >> id >> index;
const auto result = manager.resource(id, index);
std::cout << "E " << static_cast<int>(result.code) << ' ' << result.kind
<< ' ' << result.start << ' ' << result.size << '\n';
} else if (command == "M") {
std::uint64_t token;
std::cin >> token;
const auto result = manager.mapping(token);
std::cout << "M " << static_cast<int>(result.code) << ' ';
mapping_fields(result);
std::cout << '\n';
} else if (command == "L") {
const auto result = manager.snapshot();
std::cout << "L " << result.size();
for (const auto& mapping : result) {
std::cout << ' ';
mapping_fields(mapping);
}
std::cout << '\n';
} else if (command == "S") {
const auto s = manager.statistics();
std::cout << "S " << s.created << ' ' << s.released << ' ' << s.probe_success
<< ' ' << s.probe_faults << ' ' << s.read_ops << ' ' << s.write_ops
<< ' ' << s.fill_ops << ' ' << s.live << ' ' << s.live_bytes << '\n';
}
}
return 0;
}