UPSTREAM PR #1270: feat: accept legacy image parameter on v1/images/edits#64
UPSTREAM PR #1270: feat: accept legacy image parameter on v1/images/edits#64
Conversation
The OpenAI API originally supported only a single image, passed through 'image' instead of 'image[]'. 'Old' OpenAI modules (as recent as 1.69 from Debian stable), and probably other clients, send edit requests in this format.
OverviewAnalysis of stable-diffusion.cpp following commit 36b3937 ("feat: accept legacy image parameter on v1/images/edits") reveals minimal performance impact. Of 48,313 total functions, 55 were modified (0.11%), with 0 new or removed functions. Binaries analyzed:
The single-file change adds backward compatibility for legacy API parameters in HTTP request parsing, isolated from inference paths. Function AnalysisStandard Library Regressions:
Standard Library Improvements:
Quantization Function:
All regressions occur in standard library functions with no source code changes, suggesting compiler optimization differences. Absolute timing changes remain under 1 microsecond. HTTP processing functions show throughput increases but negligible response time impact, confirming isolation from critical paths. Additional FindingsThe code change affects only HTTP request parsing (examples/server/main.cpp), adding one boolean check and conditional file retrieval. No changes to inference pipeline, GPU operations, quantization algorithms, or ML workloads. The make_block_q4_Kx8 regression affects model loading (one-time cost) rather than inference. For a model with 10,000 quantized blocks, cumulative impact is 6.4ms, negligible compared to typical loading times (5-30 seconds). All performance-critical paths (attention mechanisms, convolutions, VAE operations) remain unchanged. 🔎 Full breakdown: Loci Inspector. |
Note
Source pull request: leejet/stable-diffusion.cpp#1270
The OpenAI API originally supported only a single image, passed through 'image' instead of 'image[]'. 'Old' OpenAI modules (as recent as 1.69 from Debian stable), and probably other clients, send edit requests in this format.