mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-10-19 15:22:49 +08:00
e80614fc2d
* feat(sft): support distributed activation reuse policies * feat(sft): add frozen-base INT8 LoRA training * fix(sft): make INT8 expert LoRA rank-zero authoritative * fix(sft): preserve DeepSeek router LoRA routing * feat(sft): enable persistent INT8 LoRA training * perf(sft): accelerate INT8 VNNI with oneDNN BRGEMM * perf(int8): fuse oneDNN compensation into backward repack * [feat]: support BF16 expert LoRA training * [fix]: honor forwarded activation policy in SFT workers * feat(sft): add native block-FP8 routed expert LoRA * feat(sft): expose explicit expert placeholder ownership * fix(sft): publish fused adapter artifacts atomically * feat(sft): own artifact and adapter lifecycle contracts * fix(sft): harden artifact and rank-local contracts * fix(sft): auto-adapt owner before adapter restore * style(sft): keep lifecycle comments concise * fix(sft): require fused adapter manifests * test(sft): use spawn for distributed workers * fix(sft): preserve runtime checkpoint metadata * fix(sft): validate wrapped runtime configuration * fix(sft): preserve expert format provenance * fix(sft): own routed experts during device dispatch * test(sft): lock explicit quantization conflict * fix(cpu): make shared memory buffers lifetime-safe * release: prepare v0.7.0
41 lines
961 B
C++
41 lines
961 B
C++
#include "../task_queue.h"
|
|
|
|
#include <atomic>
|
|
#include <cassert>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
int main() {
|
|
TaskQueue queue;
|
|
std::atomic<int> completed{0};
|
|
|
|
queue.enqueue([&] { completed.fetch_add(1); });
|
|
queue.enqueue([] { throw std::runtime_error("first task failure"); });
|
|
queue.enqueue([&] { completed.fetch_add(1); });
|
|
|
|
bool caught = false;
|
|
try {
|
|
queue.sync(0);
|
|
} catch (const std::runtime_error& error) {
|
|
caught = std::string(error.what()) == "first task failure";
|
|
}
|
|
assert(caught);
|
|
assert(completed.load() == 2);
|
|
|
|
queue.sync(0);
|
|
queue.enqueue([&] { completed.fetch_add(1); });
|
|
queue.sync(0);
|
|
assert(completed.load() == 3);
|
|
|
|
queue.enqueue([] { throw std::runtime_error("first"); });
|
|
queue.enqueue([] { throw std::runtime_error("second"); });
|
|
try {
|
|
queue.sync(0);
|
|
assert(false);
|
|
} catch (const std::runtime_error& error) {
|
|
assert(std::string(error.what()) == "first");
|
|
}
|
|
|
|
return 0;
|
|
}
|