mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-27 04:53:59 +00:00
feat!: layer GPU settings and total execution limits (#5146)
BREAKING CHANGE: Resource inputs use the same names at Function
registration, column/MV creation, and refresh. Use total_cpu_millis,
total_memory_bytes, and total_gpu_count for execution-wide worker
budgets, plus gpu_class and positive gpu_count for each worker. Replace
budget dictionary inputs and unprefixed aggregate limits with these
fields. Move existing refresh gpu_count caps to total_gpu_count;
gpu_count now selects devices per worker.
Each setting resolves independently: refresh > column/MV creation >
Function annotation > deployment. Creation settings also apply to
initial MV population and automatic refresh. MVs sum total budgets
across distinct pinned Function versions; per-worker GPU counts use the
largest Function default unless overridden. An unset GPU class resolves
to gpu_class="any" after inheritance; an explicit "any" overrides a
registered concrete class. Use gpu_class="default" to pin the default
pool explicitly.
```python
@function(
gpu=True, gpu_class="h100", gpu_count=2,
total_cpu_millis=8000,
total_memory_bytes=16 * 1024**3,
total_gpu_count=4,
)
def embed(text: str) -> list[float]: ...
version = db.create_function(embed)
table.add_columns(
{"embedding": version(text=col("text"))},
gpu_class="any", gpu_count=1, total_gpu_count=8,
)
table.refresh_column_async(
"embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8,
)
mv = db.create_materialized_view(
"embeddings", query="SELECT embed(text) AS embedding FROM documents",
gpu_class="any", gpu_count=2, total_gpu_count=8,
)
mv.refresh(gpu_count=4, total_gpu_count=8)
```
```mermaid
flowchart TD
R["Refresh settings"] --> E["Effective settings, resolved per field"]
D["Column or MV creation settings"] --> E
F["Function settings"] --> E
C["Deployment defaults"] --> E
E --> W["GPU class and device count per worker"]
E --> T["Total CPU, memory and GPU ceilings"]
```
Pinned Function images retain their identity. Registration GPU counts
are defaults; execution overrides determine worker allocation. Admission
rejects GPU counts below an image's minimum requirement or above the
total budget. Python, Rust, SQL/REST and supported TypeScript operations
use the same resource model.
No local builds or tests, as requested; regression coverage runs in CI.
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
|
||||
Options for `Table.refreshColumn` and `Table.refreshColumnAsync`. Every
|
||||
option is LanceDB Enterprise only; a LanceDB Embedded refresh ignores
|
||||
`batchSize`, `gpuClass` and `gpuCount` and rejects the rest, including
|
||||
`resourceBudget`.
|
||||
`batchSize`, `gpuClass` and `totalGpuCount` and rejects the rest.
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -50,7 +49,7 @@ GPU class for Function workers.
|
||||
optional gpuCount: number;
|
||||
```
|
||||
|
||||
Positive aggregate GPU budget for Function workers.
|
||||
Positive GPU count allocated to each Function worker.
|
||||
|
||||
***
|
||||
|
||||
@@ -140,17 +139,6 @@ Requires LanceDB Enterprise with non-Blob Function outputs.
|
||||
|
||||
***
|
||||
|
||||
### resourceBudget?
|
||||
|
||||
```ts
|
||||
optional resourceBudget: FunctionWorkerResourceBudget;
|
||||
```
|
||||
|
||||
Complete aggregate CPU and memory budget for a registered Function
|
||||
refresh. `gpuCount` inside the budget defaults to zero.
|
||||
|
||||
***
|
||||
|
||||
### retryPolicy?
|
||||
|
||||
```ts
|
||||
@@ -181,6 +169,36 @@ CPU, memory, and ephemeral-storage limits for the refresh supervisor.
|
||||
|
||||
***
|
||||
|
||||
### totalCpuMillis?
|
||||
|
||||
```ts
|
||||
optional totalCpuMillis: number;
|
||||
```
|
||||
|
||||
Override the total CPU budget in millicores for this refresh.
|
||||
|
||||
***
|
||||
|
||||
### totalGpuCount?
|
||||
|
||||
```ts
|
||||
optional totalGpuCount: number;
|
||||
```
|
||||
|
||||
Nonnegative total GPU budget for Function workers.
|
||||
|
||||
***
|
||||
|
||||
### totalMemoryBytes?
|
||||
|
||||
```ts
|
||||
optional totalMemoryBytes: number;
|
||||
```
|
||||
|
||||
Override the total memory budget in bytes for this refresh.
|
||||
|
||||
***
|
||||
|
||||
### where?
|
||||
|
||||
```ts
|
||||
|
||||
Reference in New Issue
Block a user