NHA-EX-002 | Performance optimisation
SeedVR2 VAE FP16 memory optimisation
ComfyUI | Performance and memory evaluation
Evidence status
Public optimisation candidate; independent Linux testing; open upstream PR
The published work investigated excessive memory use and runtime in SeedVR2 VAE FP16 processing. A scoped candidate adjusts HIP layout eligibility and bounds the final RGB convolution fallback. Public Windows results and independent Linux measurements demonstrate the benefit under the tested conditions.
Illustrative project price
Illustrative project estimate; VAT excluded where applicable.
Compare example pricesIllustrative engagement scope
| Stage | Example fee |
|---|---|
| Investigation | £1,800 |
| Corrective engineering | £2,400 |
| Qualification | £1,800 |
| Technical handover | £600 |
| Illustrative total | £6,600 |
Actual public PR patch and changed VAE source, portable source-level checks, integration instructions and rollback plan alongside published benchmark evidence. The public candidate is supplied with a workload-specific acceptance and rollback process.
Actual engineering deliverables
Actual public PR patch and changed VAE source, portable source-level checks, integration instructions and rollback plan alongside published benchmark evidence. The public candidate is supplied with a workload-specific acceptance and rollback process.
Included in the ZIP
- Exact public candidate patch and changed VAE Python source.
- GPL-3.0 licence, upstream attribution, version pins and SHA-256 hashes.
- Portable checks of actual extracted layout, estimator and planner logic: 12/12 PASS; deployment and rollback instructions.
Implementation excerpt
Excerpt from the published candidate: HIP FP16 accelerated layout is used only when accumulation is opted in. The full patch also adjusts memory planning and bounds a specific final RGB convolution fallback.
return (x.is_cuda and x.dtype == torch.float16 and x.dim() == 5
and (not torch.version.hip or _fp16_accumulate_wanted(x)))Package verification
Patch check, byte-for-byte application and reversal on pinned sources, and Python AST parsing: PASS. New extracted-function controls: 12/12 PASS. These source-level checks qualify the extracted functions; the published hardware results cover the GPU investigation.
Installation, acceptance and rollback
Use the public optimisation candidate in an isolated ComfyUI checkout at the pinned revision, with matching runtime, model and inputs. Acceptance covers workload-specific accuracy, encode/decode, memory and rollback testing.
Detailed instructions are included in the implementation folder. Download the delivery ZIP.
Technical investigation
Tested environment
Public PR: Windows Strix Halo / Radeon 8060S gfx1151, ComfyUI v0.45.0, PyTorch 2.14.0+rocm10.1.0, ROCm SDK 10.1.0, comfy-kitchen 0.2.41, official SeedVR2 FP16 VAE and MIOpen disabled. Independent tester used Linux with a comparable gfx1151 setup.
- Compare identical isolated model workloads with FP16 accumulation off and on; synchronise and record allocator peak, time and output.
- The public PR identifies layout eligibility inconsistent with the accumulation setting and a final 128-input/3-output convolution that declines the HIP accelerated path.
- The fallback can allocate a large whole-slice temporary. The candidate targets this narrow branch rather than broad platform-wide changes.
Corrective engineering or recommendation
- Gate the accelerated HIP layout on explicit FP16 accumulation and retain the established standard-layout fallback behaviour.
- For the narrowly selected final convolution, use spatial-width bands with the required halo, bounded by the public PR's input-window budget; copy into preallocated output.
- Review the public upstream candidate and qualify exact workload shapes, numerical tolerance, fallback behaviour, throughput and memory under customer-specified constraints.
Published qualification evidence
Published hardware and engineering results are shown below, alongside the separate portable package qualification above.
| Evidence or condition | Published result | Scope / qualification |
|---|---|---|
| Windows 25-frame 512×512 decode, accumulation OFF | 66.38 → 20.71 GiB; 47.23 → 12.00 s | Public PR, original versus candidate |
| Windows accumulation ON, 25-frame 512×512 | 31.73 → 7.96 GiB; 9.41 → 8.88 s | Public PR, initial layout fix versus bounded fallback |
| Windows accumulation ON numerical result | RMSE 6.69e-6; max abs error 0.000244 | Decode vs prior accelerated path; not bit-identical |
| Linux 25-frame 512×512 ON, tested head | 8.0 GiB vs stock 31.7 GiB | Independent tester; RMSE 6.74e-6 |
| Linux 9-frame 1024×1024 ON, tested head | 12.8 GiB vs stock 38.9 GiB | Independent tester; RMSE 7.57e-6 |
| Linux planner cap / encode | 16.1 GiB measured at 16 GiB cap | Open limitation; not a general memory-fit guarantee |
Qualification scope
The sample covers published PR evidence and the tested Windows and Linux conditions. The Linux tester documented an encode-estimate gap and output dependence on slicing; these findings inform the workload-specific acceptance criteria for the open candidate.
Engineering handover
Example reproduction and acceptance checklist for a scoped customer engagement.
- Pin public PR head, framework/runtime versions, hardware, official model weights and deterministic input. Keep reference and candidate isolated.
- Run both accumulation paths on agreed frame counts and resolutions. Record max allocated GPU memory and synchronised timing separately from total system RAM.
- Compare numeric output and image-quality acceptance criteria agreed with the customer; do not assume bit identity when operation order or slice length changes.
- Exercise constrained memory, encode and decode separately; verify regression controls and rollback before considering integration.
Public sources
Download the sample package
Actual public PR patch and changed VAE source, portable source-level checks, integration instructions and rollback plan alongside published benchmark evidence. The public candidate is supplied with a workload-specific acceptance and rollback process. The ZIP also contains the PDF report, technical findings, evidence CSV, acceptance checklist, source references, example scope and SHA-256 manifest.
View original achievement · Confidentiality and NDAs · Discuss comparable work