Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ members = [
]

[workspace.package]
version = "0.2.63"
version = "0.2.64"
edition = "2024"
license = "MIT"
repository = "https://github.com/profullstack/c0mpute"
Expand Down
2 changes: 1 addition & 1 deletion apps/tui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/tui",
"version": "0.2.63",
"version": "0.2.64",
"private": true,
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute",
"version": "0.2.63",
"version": "0.2.64",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/releases/latest.json/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const dynamic = "force-dynamic";
* this in sync with the workspace version in `Cargo.toml` on each release so a
* freshly built CLI reports "already latest" rather than a phantom upgrade.
*/
const FALLBACK_VERSION = "0.2.63";
const FALLBACK_VERSION = "0.2.64";
const FALLBACK_MIN_REQUIRED = "0.0.1";

type Channel = "stable" | "beta" | "nightly";
Expand Down
12 changes: 11 additions & 1 deletion node/crates/c0mpute-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ pub struct DiffusionConfig {
pub min_free_ram_gb: u64,
#[serde(default = "default_diffusion_min_free_disk_gb")]
pub min_free_disk_gb: u64,
/// Smallest per-job CPU thread budget (`resources::cpu_threads_per_job`,
/// half the box by default) worth serving images with. At 8 threads a
/// 768x512 image takes ~2-4 min; at 3 it passes the 15-minute job limit.
#[serde(default = "default_diffusion_min_cpu_threads")]
pub min_cpu_threads: usize,
}

impl Default for DiffusionConfig {
Expand All @@ -70,6 +75,7 @@ impl Default for DiffusionConfig {
min_ram_gb: default_diffusion_min_ram_gb(),
min_free_ram_gb: default_diffusion_min_free_ram_gb(),
min_free_disk_gb: default_diffusion_min_free_disk_gb(),
min_cpu_threads: default_diffusion_min_cpu_threads(),
}
}
}
Expand All @@ -81,11 +87,15 @@ fn default_diffusion_min_ram_gb() -> u64 {
16
}
fn default_diffusion_min_free_ram_gb() -> u64 {
10
// A job holds ~9 GB; keep ~3 GB for whatever else the box runs.
12
}
fn default_diffusion_min_free_disk_gb() -> u64 {
25
}
fn default_diffusion_min_cpu_threads() -> usize {
8
}

impl DiffusionConfig {
pub fn auto_install_enabled(&self) -> bool {
Expand Down
34 changes: 33 additions & 1 deletion node/crates/c0mpute-core/src/diffusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! - Linux x86_64 only (the only CPU build of the pinned release we run; it is
//! built on Ubuntu 26.04 and needs glibc 2.43, which the self-test checks);
//! - at least `min_ram_gb` total RAM and `min_free_ram_gb` available right now;
//! - a per-job CPU budget of at least `min_cpu_threads` (a 16-thread box);
//! - at least `min_free_disk_gb` free before installing;
//! - opt-out: `C0MPUTE_DIFFUSION_AUTO=0` or `[diffusion] auto_install = false`.

Expand Down Expand Up @@ -139,10 +140,22 @@ pub fn has_headroom_with(config: &crate::config::DiffusionConfig, mem: MemorySna
&& mem.available >= config.min_free_ram_gb.saturating_mul(GIB)
}

/// Pure decision: is this per-job thread budget fast enough to serve images?
pub fn fast_enough_with(config: &crate::config::DiffusionConfig, job_threads: usize) -> bool {
job_threads >= config.min_cpu_threads
}

fn fast_enough(config: &crate::config::DiffusionConfig) -> bool {
fast_enough_with(config, crate::resources::cpu_threads_per_job())
}

/// Installed, enabled, and enough free memory to run a job without swapping.
/// Called on every advertise tick, so a busy node stops bidding within a minute.
pub fn can_serve(config: &crate::config::DiffusionConfig) -> bool {
config.auto_install_enabled() && installed() && has_headroom_with(config, memory())
config.auto_install_enabled()
&& installed()
&& fast_enough(config)
&& has_headroom_with(config, memory())
}

fn now_secs() -> u64 {
Expand Down Expand Up @@ -187,6 +200,14 @@ pub async fn ensure(config: &crate::config::DiffusionConfig) -> bool {
tracing::debug!("diffusion auto-provisioning is off; not installing");
return false;
}
if !fast_enough(config) {
info!(
job_threads = crate::resources::cpu_threads_per_job(),
required = config.min_cpu_threads,
"skipping diffusion: CPU budget too small for images in reasonable time"
);
return false;
}
if installed() {
return true;
}
Expand Down Expand Up @@ -612,6 +633,17 @@ mod tests {
assert!(!has_headroom_with(&config, small));
}

#[test]
fn a_small_cpu_budget_does_not_serve_images() {
let config = DiffusionConfig::default();
assert!(fast_enough_with(&config, 8));
assert!(fast_enough_with(&config, 16));
assert!(
!fast_enough_with(&config, 3),
"a 6-core box at the 50% share is too slow"
);
}

#[test]
fn png_magic_is_checked() {
assert!(is_png(b"\x89PNG\r\n\x1a\n0000"));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute-monorepo",
"version": "0.2.63",
"version": "0.2.64",
"private": true,
"workspaces": [
"apps/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/shared",
"version": "0.2.63",
"version": "0.2.64",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion plugins/ad-generator-agent/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[module]
id = "ad-generator-agent"
name = "Ad Generator Agent — every ad type from one URL"
version = "0.2.63"
version = "0.2.64"
kind = "service"
category = "applications"
description = "Turns a landing-page URL into a complete ad set (display banners, text link, terminal, feed item, image, GIF, 5-second video pre-roll and audio) by buying c0mpute work: copy from Infernet inference, voiceover from CPU text-to-speech, artwork from diffusion when workers offer it. No paid AI API by default."
Expand Down
2 changes: 1 addition & 1 deletion plugins/ads-manager/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[module]
id = "ads-manager"
name = "Ads Manager — shared ad operations layer"
version = "0.2.63"
version = "0.2.64"
kind = "service"
category = "applications"
description = "Unified ad operations for the c0mpute network: campaign management, creative registry, publisher inventory, OpenRTB auction primitives, CoinPay escrow, and reporting. Required dependency for ctv-ads and all future ad format plugins."
Expand Down
2 changes: 1 addition & 1 deletion plugins/coinpay/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[module]
id = "coinpay"
name = "CoinPay — DID, payments, escrow, reputation"
version = "0.2.63"
version = "0.2.64"
kind = "service"
category = "applications"
description = "Decentralized identifiers, wallet linking, escrow, signed receipts, and worker reputation. The trust spine of the c0mpute network."
Expand Down
2 changes: 1 addition & 1 deletion plugins/crawl/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[module]
id = "crawl"
name = "Crawl — distributed web fetching"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "data"
description = "Decentralized web crawling and page-rendering pool. Static fetches and JS-rendered pages, robots-aware, WARC-capable."
Expand Down
2 changes: 1 addition & 1 deletion plugins/ctv-ads/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[module]
id = "ctv-ads"
name = "CTV Ads — Connected TV ad marketplace"
version = "0.2.63"
version = "0.2.64"
kind = "service"
category = "applications"
description = "Decentralised Connected TV advertising on the c0mpute network. VAST 4.x endpoint, OpenRTB real-time auction, cryptographically verified impressions, CoinPay settlement. Supports Roku, Fire TV, Apple TV, Smart TVs, and FAST channels. Live-stream integration for ad-monetised broadcasts."
Expand Down
5 changes: 3 additions & 2 deletions plugins/diffusion/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# CPU image generation. Every node with >=16 GiB RAM and >=25 GB free disk
# provisions it itself (node/crates/c0mpute-core/src/diffusion.rs): a pinned
# stable-diffusion.cpp release (MIT) plus Apache-2.0 weights from Hugging
# Face, all SHA-256 checked. A node bids only while >=10 GiB RAM is free.
# Face, all SHA-256 checked. Needs a per-job CPU budget of >=8 threads
# (a 16-thread box); bids only while >=12 GiB RAM is free.
# ~90-120 s per 768x512 image on a 16-core CPU. Buyers call the speech
# gateway's POST /v1/images. Opt out: C0MPUTE_DIFFUSION_AUTO=0.

[module]
id = "diffusion"
name = "Diffusion — image generation"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "ai"
description = "Decentralized text-to-image on plain CPUs: Z-Image-Turbo through stable-diffusion.cpp, provisioned by every node with the RAM for it."
Expand Down
2 changes: 1 addition & 1 deletion plugins/embed/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[module]
id = "embed"
name = "Embeddings — vector generation"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "ai"
description = "Bulk text-embedding generation (sentence-transformers, BGE, Nomic) with CPU fallback and optional GPU acceleration."
Expand Down
2 changes: 1 addition & 1 deletion plugins/gameserver/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[module]
id = "gameserver"
name = "Game server — Minecraft / Factorio / Valheim"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "infrastructure"
description = "Continuous-reservation hosting for game servers. Multi-replica placement, persistent world state on c0mpute storage, proof-of-serve settlement."
Expand Down
2 changes: 1 addition & 1 deletion plugins/hosting/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[module]
id = "hosting"
name = "Hosting — censorship-resistant static sites"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "data"
description = "Static-site hosting with multi-replica placement, mutable naming, epoch settlement, and slashable proof-of-serve. See DIP-0015."
Expand Down
2 changes: 1 addition & 1 deletion plugins/infernet/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[module]
id = "infernet"
name = "Infernet Protocol — AI inference"
version = "0.2.63"
version = "0.2.64"
kind = "workload"
category = "ai"
description = "Decentralized AI inference workloads on c0mpute. Runs models on consumer/prosumer GPUs with model-hash and runtime-image verification. Also trains and serves temporal policies (CfC/LTC liquid networks, GRU baseline) and fine-tunes language models (LoRA) with live progress, on CPU or GPU."
Expand Down
Loading
Loading