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>
73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
#ifndef PARTIAL_FOLD_POOL_HPP
|
|
#define PARTIAL_FOLD_POOL_HPP
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <deque>
|
|
#include <vector>
|
|
namespace fold {
|
|
enum Code { OK=0, RANGE=1, STATE=2, FULL=3, BUSY=4, TAIL=5, LIMIT=6, SYNTAX=7 };
|
|
struct Step {
|
|
int code=OK;
|
|
std::int64_t bytes=0;
|
|
std::int64_t records=0;
|
|
};
|
|
struct Total {
|
|
std::int64_t sum=0;
|
|
std::int64_t count=0;
|
|
std::int64_t done=0;
|
|
std::int64_t closed=0;
|
|
std::int64_t queued=0;
|
|
std::int64_t owner=-1;
|
|
};
|
|
struct WorkerView {
|
|
std::int64_t sum=0;
|
|
std::int64_t count=0;
|
|
std::int64_t done=0;
|
|
std::vector<int> carry;
|
|
};
|
|
struct Snapshot {
|
|
std::int64_t workers=0;
|
|
std::int64_t capacity=0;
|
|
std::int64_t accepted=0;
|
|
Total total;
|
|
std::vector<int> queue;
|
|
std::vector<WorkerView> local;
|
|
};
|
|
class Pool {
|
|
public:
|
|
Pool();
|
|
int configure(std::int64_t workers, std::int64_t capacity);
|
|
int write(std::int64_t value, std::int64_t count);
|
|
int byte(std::int64_t value);
|
|
Step take(std::int64_t worker, std::int64_t budget);
|
|
int close();
|
|
int finish(std::int64_t worker);
|
|
Total totals() const;
|
|
int worker(std::int64_t index, WorkerView& output) const;
|
|
Snapshot snapshot() const;
|
|
private:
|
|
struct Local {
|
|
std::int64_t sum=0;
|
|
std::int64_t count=0;
|
|
bool done=false;
|
|
std::vector<int> carry;
|
|
};
|
|
std::int64_t capacity_=256;
|
|
std::int64_t accepted_=0;
|
|
bool closed_=false;
|
|
int owner_=-1;
|
|
std::int64_t sum_=0;
|
|
std::int64_t count_=0;
|
|
std::int64_t done_=0;
|
|
std::deque<int> queue_;
|
|
std::vector<Local> workers_;
|
|
bool worker_in_range(std::int64_t index) const;
|
|
int admit(std::int64_t size) const;
|
|
static std::array<int,4> encode(std::int64_t value);
|
|
static std::int64_t decode(const std::vector<int>& value);
|
|
static WorkerView view(const Local& local);
|
|
void commit(Local& local);
|
|
};
|
|
}
|
|
#endif
|