Allow CUDA row smoke on partitioned PLE records

This commit is contained in:
Pavlo Ratushnyi
2026-10-03 08:46:21 +02:00
parent 7fdbe3cb1a
commit 7683b6bb19
3 changed files with 11 additions and 5 deletions
+1
View File
@@ -199,3 +199,4 @@ The test toolchain was installed into ignored `artifacts/tool-venv/` for this ru
- The isolated CUDA smoke path now rejects a compressed record whose staged prefix, F32 output, and optional row ID would cross a free-VRAM reserve of `max(512 MiB, total VRAM / 16)`. It checks the selected record's declared level before estimating memory and performs the admission check before CUDA allocations. Allocation can still fail if another process consumes VRAM after the check.
- Local `clang++ -std=c++20 -Wall -Wextra -Werror -fsyntax-only` passed for the smoke source with a temporary CUDA API declaration stub; `git diff --check` passed. No CUDA execution or CPU/GPU checksum comparison was performed because the Linux RTX 5090 remained occupied. The temporary stub was removed.
- The original full-tensor size cap also rejected split PLE records in `--row` mode despite their bounded output. The smoke input check now caps the actual decoded output at 100 million F32 values, allowing a larger compressed record when only one row is requested. The compressed-prefix VRAM admission check still applies. This change has no GPU runtime result yet.
+2
View File
@@ -31,3 +31,5 @@ The smoke program validates the KAR container and payload CRCs, reserves a chose
Before any CUDA allocation, the smoke program checks the selected prefix, F32 output, and optional row ID against currently free VRAM. It leaves at least 512 MiB or one sixteenth of total VRAM free, whichever is larger, and refuses the run if that reserve would be crossed. This admission check protects shared GPU experiments; another process can still allocate memory afterward, so CUDA allocation errors remain possible. It is not an inference scheduler.
`--row ROW_ID` selects the CUDA row-gather decoder for one row of a compressed record. The row ID is local to the selected KAR part, so `--row 0` on a split PLE part addresses that part's first row. This mode stages the same complete compressed level prefix with `kar_reserve`, then allocates and writes only one F32 row. It reports `mode=row` and the one-row output checksum. Compare a real-model result with `model checksum-kar-row` on the selected archive and part name; that CPU command verifies the complete archive before bounded range decoding. The one-row synthetic fixture above has the same checksum as its full-tensor decode. Row mode does not reduce the initial PCIe transfer of that part and does not make the full model fit in VRAM.
The smoke program caps the decoded F32 output at 100 million elements. A large PLE part can therefore be used with `--row` if its selected compressed prefix fits the available VRAM; its complete tensor need not fit the full-output cap.
+8 -5
View File
@@ -139,8 +139,8 @@ int main(int argc, char** argv) {
return 1;
}
const kar_tensor_info* tensor = kar_tensor(archive, static_cast<uint32_t>(index));
if (!tensor || tensor->n_elements == 0 || tensor->n_elements > 100'000'000ull) {
std::cerr << "smoke tensor must contain 1..100 million elements\n";
if (!tensor || tensor->n_elements == 0) {
std::cerr << "smoke tensor must contain at least one element\n";
return 1;
}
if (tensor->storage_class == KAR_RAW) {
@@ -155,6 +155,11 @@ int main(int argc, char** argv) {
std::cerr << "row mode requires a compressed record with an addressable row ID\n";
return 1;
}
const uint64_t output_elements = row_mode ? tensor->row_len : tensor->n_elements;
if (output_elements == 0 || output_elements > 100'000'000ull) {
std::cerr << "smoke output must contain 1..100 million elements\n";
return 1;
}
cudaDeviceProp device{};
int driver = 0, runtime = 0;
if (!cuda_ok(cudaGetDeviceProperties(&device, 0), "cudaGetDeviceProperties") ||
@@ -162,9 +167,7 @@ int main(int argc, char** argv) {
!cuda_ok(cudaRuntimeGetVersion(&runtime), "cudaRuntimeGetVersion")) {
return 1;
}
const size_t output_elements =
row_mode ? tensor->row_len : static_cast<size_t>(tensor->n_elements);
const size_t output_bytes = output_elements * sizeof(float);
const size_t output_bytes = static_cast<size_t>(output_elements) * sizeof(float);
const kar_cost cost = row_mode
? kar_decode_rows_cost(archive, static_cast<uint32_t>(index), level, 1)
: kar_decode_cost(archive, static_cast<uint32_t>(index), level);