Skip to content

Commit c4ecd51

Browse files
authored
Remove pass that promotes heap allocs to stack in quantum function (#2172)
**Context:** The [`promote-buffers-to-stack`](https://mlir.llvm.org/docs/Passes/#-promote-buffers-to-stack) when used with quantum operators in deep nested structures has been observed to perform a large number of `alloca` calls whose lifetime is at the function scope. This has caused failures due to the limited stack size on given systems, resulting in catastrophic program failure during execution. This PR temporarily removes the pass from the given bufferization pipeline stage, which has been observed to remediate the issue. **Description of the Change:** Remove `promote-buffers-to-stack` pass from Catalyst's pipeline **Benefits:** Fixes issues with stack allocations resulting in SIGSEGV errrors. **Possible Drawbacks:** Potential performance loss due to non-conversion of heap allocations. **Related GitHub Issues:**
1 parent 0537811 commit c4ecd51

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

doc/releases/changelog-dev.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
<h3>Bug fixes 🐛</h3>
3131

32+
* Fixes an issue where a heap-to-stack allocation conversion pass was causing SIGSEGV issues
33+
during program execution at runtime.
34+
[(#2172)](https://github.com/PennyLaneAI/catalyst/pull/2172)
35+
3236
* Fixes the issue with capturing unutilized abstracted adjoint and controlled rules
3337
by the graph in the new decomposition framework.
3438
[(#2160)](https://github.com/PennyLaneAI/catalyst/pull/2160)
@@ -99,6 +103,7 @@ This release contains contributions from (in alphabetical order):
99103
Ali Asadi,
100104
Christina Lee,
101105
River McCubbin,
106+
Lee J. O'Riordan,
102107
Roberto Turrado,
103108
Paul Haochen Wang,
104109
Hongsheng Zheng.

frontend/catalyst/pipelines.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ def get_bufferization_stage(options: CompileOptions) -> List[str]:
292292
# introduced during gradient-bufferize of callbacks
293293
"func.func(buffer-hoisting)",
294294
"func.func(buffer-loop-hoisting)",
295-
"func.func(promote-buffers-to-stack)",
295+
# TODO: investigate re-adding this after new buffer dealloc pipeline
296+
# removed due to high stack memory use in nested structures
297+
# "func.func(promote-buffers-to-stack)",
296298
# TODO: migrate to new buffer deallocation "buffer-deallocation-pipeline"
297299
"func.func(buffer-deallocation)",
298300
"convert-arraylist-to-memref",

0 commit comments

Comments
 (0)