Repository navigation
Avoid symbolic contiguity checks on compiled output buffers - #1259
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1259 +/- ##
==========================================
- Coverage 82.93% 82.91% -0.02%
==========================================
Files 173 173
Lines 11172 11191 +19
==========================================
+ Hits 9265 9279 +14
- Misses 1907 1912 +5 ☔ View full report in Codecov by Harness. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Compiled
TransformerBlockcan fail when category-dependent preprocessing produces a batch size known only at runtime. This was isolated while testing learned-class KumoTabular execution; the example replaces attention to expose the buffer check alone:The traceback points to this condition in
TransformerBlock._forward:A transposed buffer becomes contiguous when that batch dimension is one, so tracing cannot decide the condition from its shape alone. Use the existing functional residual path for every compiled output buffer, then copy into the supplied buffer. Dtype conversion and buffer identity are preserved; eager execution is unchanged.
L4, PyTorch 2.14: six real-Transformer contiguous-buffer FP32/BF16 cases had bitwise-equal outputs, identical generated GPU code using a shared warmed compiler cache, and unchanged peak allocated memory. Incremental peaks for medium/large cases were 12/24 MiB in FP32 and 6/12 MiB in BF16, before and after.
Steady normal-call timings: 100 warmups, then 31 paired AB/BA blocks of 100 calls. Shapes are
(batch, query length, key length, channels); percentage changes are paired medians.(1, 32, 32, 128)(4, 512, 2048, 256)The small case adds about 1.22 µs; the large-case interval includes no change. These are block measurements, not end-to-end KumoTabular or cold-compilation results. This fixes the buffer check, not other dynamic attention/chunking limitations.