halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.91k stars 1.07k forks source link

[asan] FuseGPUThreadLoops heap-use-after-free in ExtractSharedAndHeapAllocations #8482

Closed derek-gerstmann closed 1 day ago

derek-gerstmann commented 2 days ago

Discovered this testing main under address sanitizer. It's reproduceable on opencl, vulkan, etc:

(base) dg@dg-linux-ws:~/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build$ HL_JIT_TARGET=host-opencl-asan ./test/correctness/correctness_gpu_reuse_shared_memory 
=================================================================
==2304951==ERROR: AddressSanitizer: heap-use-after-free on address 0x504000142330 at pc 0x7f3c03dc6b3d bp 0x7ffc7f3b84f0 sp 0x7ffc7f3b84e8
READ of size 8 at 0x504000142330 thread T0
    #0 0x7f3c03dc6b3c in Halide::Internal::(anonymous namespace)::ExtractSharedAndHeapAllocations::rewrap_block(Halide::Internal::Stmt, Halide::Internal::(anonymous namespace)::ExtractBlockSize const&) FuseGPUThreadLoops.cpp
    #1 0x7f3c03db7a25 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #2 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #3 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #4 0x7f3c04004005 in Halide::Internal::IRMutator::visit(Halide::Internal::For const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d09005)
    #5 0x7f3c03db67b2 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #6 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #7 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #8 0x7f3c03d98258 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoops::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #9 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #10 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #11 0x7f3c04004005 in Halide::Internal::IRMutator::visit(Halide::Internal::For const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d09005)
    #12 0x7f3c03d9b500 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoops::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #13 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #14 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #15 0x7f3c04007bf9 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cbf9)
    #16 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #17 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #18 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #19 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #20 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #21 0x7f3c04003a52 in Halide::Internal::IRMutator::visit(Halide::Internal::ProducerConsumer const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d08a52)
    #22 0x7f3c03fb94d6 in Halide::Internal::StmtNode<Halide::Internal::ProducerConsumer>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe4d6)
    #23 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #24 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #25 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #26 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #27 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #28 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #29 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #30 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #31 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #32 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #33 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #34 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #35 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #36 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #37 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #38 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #39 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #40 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #41 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #42 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #43 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #44 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #45 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #46 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #47 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #48 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #49 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #50 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #51 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #52 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #53 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #54 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #55 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #56 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #57 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #58 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #59 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #60 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #61 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #62 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #63 0x7f3c040083ef in Halide::Internal::IRMutator::visit(Halide::Internal::IfThenElse const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0d3ef)
    #64 0x7f3c03fb9756 in Halide::Internal::StmtNode<Halide::Internal::IfThenElse>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe756)
    #65 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #66 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #67 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #68 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #69 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #70 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #71 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #72 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #73 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #74 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #75 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #76 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #77 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #78 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #79 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #80 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #81 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #82 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #83 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #84 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #85 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #86 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #87 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #88 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #89 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #90 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #91 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #92 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #93 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #94 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #95 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #96 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #97 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #98 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #99 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #100 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #101 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #102 0x7f3c04002b76 in Halide::Internal::IRMutator::visit(Halide::Internal::LetStmt const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d07b76)
    #103 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #104 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #105 0x7f3c04007c47 in Halide::Internal::IRMutator::visit(Halide::Internal::Block const*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3d0cc47)
    #106 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #107 0x7f3c03ff72da in Halide::Internal::IRMutator::mutate(Halide::Internal::Stmt const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cfc2da)
    #108 0x7f3c03d956a2 in Halide::Internal::fuse_gpu_thread_loops(Halide::Internal::Stmt) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3a9a6a2)
    #109 0x7f3c04179a20 in Halide::Internal::(anonymous namespace)::lower_impl(std::vector<Halide::Internal::Function, std::allocator<Halide::Internal::Function>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Halide::Target const&, std::vector<Halide::Argument, std::allocator<Halide::Argument>> const&, Halide::LinkageType, std::vector<Halide::Internal::Stmt, std::allocator<Halide::Internal::Stmt>> const&, bool, std::vector<Halide::Internal::IRMutator*, std::allocator<Halide::Internal::IRMutator*>> const&, Halide::Module&) Lower.cpp
    #110 0x7f3c041746ce in std::_Function_handler<void (), Halide::Internal::lower(std::vector<Halide::Internal::Function, std::allocator<Halide::Internal::Function>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Halide::Target const&, std::vector<Halide::Argument, std::allocator<Halide::Argument>> const&, Halide::LinkageType, std::vector<Halide::Internal::Stmt, std::allocator<Halide::Internal::Stmt>> const&, bool, std::vector<Halide::Internal::IRMutator*, std::allocator<Halide::Internal::IRMutator*>> const&)::$_0>::_M_invoke(std::_Any_data const&) Lower.cpp
    #111 0x7f3c04173d83 in Halide::Internal::lower(std::vector<Halide::Internal::Function, std::allocator<Halide::Internal::Function>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Halide::Target const&, std::vector<Halide::Argument, std::allocator<Halide::Argument>> const&, Halide::LinkageType, std::vector<Halide::Internal::Stmt, std::allocator<Halide::Internal::Stmt>> const&, bool, std::vector<Halide::Internal::IRMutator*, std::allocator<Halide::Internal::IRMutator*>> const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3e78d83)
    #112 0x7f3c042c9ce9 in Halide::Pipeline::compile_to_module(std::vector<Halide::Argument, std::allocator<Halide::Argument>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Halide::Target const&, Halide::LinkageType) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3fcece9)
    #113 0x7f3c042d062f in Halide::Pipeline::compile_jit(Halide::Target const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3fd562f)
    #114 0x7f3c042d6cda in Halide::Pipeline::realize(Halide::JITUserContext*, std::vector<int, std::allocator<int>>, Halide::Target const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3fdbcda)
    #115 0x7f3c042d5e3b in Halide::Pipeline::realize(std::vector<int, std::allocator<int>>, Halide::Target const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3fdae3b)
    #116 0x7f3c03d2c964 in Halide::Func::realize(std::vector<int, std::allocator<int>>, Halide::Target const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3a31964)
    #117 0x55b76752cee8 in multi_thread_type_test(Halide::MemoryType) gpu_reuse_shared_memory.cpp
    #118 0x55b767535ed0 in main gpu_reuse_shared_memory.cpp
    #119 0x7f3bffd95d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #120 0x7f3bffd95e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #121 0x55b767451e24 in _start (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/test/correctness/correctness_gpu_reuse_shared_memory+0x72e24)

0x504000142330 is located 32 bytes inside of 40-byte region [0x504000142310,0x504000142338)
freed by thread T0 here:
    #0 0x55b767528aed in operator delete(void*) /home/dg/Workspace/OpenSource/LLVM/Repos/llvm-v18.1.8/compiler-rt/lib/asan/asan_new_delete.cpp:143:3
    #1 0x7f3c03dbb0c0 in Halide::Internal::(anonymous namespace)::ExtractSharedAndHeapAllocations::rewrap_block(Halide::Internal::Stmt, Halide::Internal::(anonymous namespace)::ExtractBlockSize const&) FuseGPUThreadLoops.cpp
    #2 0x7f3c03db7a25 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #3 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #4 0x7f3c03db67b2 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #5 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #6 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #7 0x7f3c03d9b500 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoops::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #8 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #9 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #10 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #11 0x7f3c03fb94d6 in Halide::Internal::StmtNode<Halide::Internal::ProducerConsumer>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe4d6)
    #12 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #13 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #14 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #15 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #16 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #17 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #18 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #19 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #20 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #21 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #22 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #23 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #24 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #25 0x7f3c03fb9756 in Halide::Internal::StmtNode<Halide::Internal::IfThenElse>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe756)
    #26 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #27 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #28 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #29 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)

previously allocated by thread T0 here:
    #0 0x55b76752828d in operator new(unsigned long) /home/dg/Workspace/OpenSource/LLVM/Repos/llvm-v18.1.8/compiler-rt/lib/asan/asan_new_delete.cpp:86:3
    #1 0x7f3c03baff86 in Halide::Internal::IntImm::make(Halide::Type, long) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x38b4f86)
    #2 0x7f3c04919225 in void Halide::Internal::IRMatcher::Rewriter<Halide::Internal::IRMatcher::BinOp<Halide::Internal::Sub, Halide::Internal::IRMatcher::SpecificExpr, Halide::Internal::IRMatcher::SpecificExpr>>::build_replacement<Halide::Internal::IRMatcher::Fold<Halide::Internal::IRMatcher::BinOp<Halide::Internal::Sub, Halide::Internal::IRMatcher::WildConst<0>, Halide::Internal::IRMatcher::WildConst<1>>>>(Halide::Internal::IRMatcher::Fold<Halide::Internal::IRMatcher::BinOp<Halide::Internal::Sub, Halide::Internal::IRMatcher::WildConst<0>, Halide::Internal::IRMatcher::WildConst<1>>>) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x461e225)
    #3 0x7f3c048b2ea6 in Halide::Internal::Simplify::visit(Halide::Internal::Sub const*, Halide::Internal::Simplify::ExprInfo*)::$_0::operator()() const Simplify_Sub.cpp
    #4 0x7f3c048b1cf4 in Halide::Internal::Simplify::visit(Halide::Internal::Sub const*, Halide::Internal::Simplify::ExprInfo*) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x45b6cf4)
    #5 0x7f3c044ce32b in Halide::Expr Halide::Internal::VariadicVisitor<Halide::Internal::Simplify, Halide::Expr, Halide::Internal::Stmt>::dispatch_expr<Halide::Internal::Simplify::ExprInfo*&>(Halide::Internal::BaseExprNode const*, Halide::Internal::Simplify::ExprInfo*&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x41d332b)
    #6 0x7f3c044c67a9 in Halide::Internal::simplify(Halide::Expr const&, bool, Halide::Internal::Scope<Halide::Internal::Interval> const&, Halide::Internal::Scope<Halide::Internal::ModulusRemainder> const&, std::vector<Halide::Expr, std::allocator<Halide::Expr>> const&) (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x41cb7a9)
    #7 0x7f3c03dbb05d in Halide::Internal::(anonymous namespace)::ExtractSharedAndHeapAllocations::rewrap_block(Halide::Internal::Stmt, Halide::Internal::(anonymous namespace)::ExtractBlockSize const&) FuseGPUThreadLoops.cpp
    #8 0x7f3c03db7a25 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #9 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #10 0x7f3c03db67b2 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoopsSingleKernel::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #11 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #12 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #13 0x7f3c03d9b500 in Halide::Internal::(anonymous namespace)::FuseGPUThreadLoops::visit(Halide::Internal::For const*) FuseGPUThreadLoops.cpp
    #14 0x7f3c03fb9526 in Halide::Internal::StmtNode<Halide::Internal::For>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe526)
    #15 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #16 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #17 0x7f3c03fb94d6 in Halide::Internal::StmtNode<Halide::Internal::ProducerConsumer>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe4d6)
    #18 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #19 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #20 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #21 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #22 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #23 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #24 0x7f3c03fb9436 in Halide::Internal::StmtNode<Halide::Internal::LetStmt>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe436)
    #25 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #26 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #27 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #28 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)
    #29 0x7f3c03fb9706 in Halide::Internal::StmtNode<Halide::Internal::Block>::mutate_stmt(Halide::Internal::IRMutator*) const (/home/dg/Workspace/OpenSource/Halide/Repos/dg-test-vulkan-v19/build/src/libHalide.so.19+0x3cbe706)

SUMMARY: AddressSanitizer: heap-use-after-free FuseGPUThreadLoops.cpp in Halide::Internal::(anonymous namespace)::ExtractSharedAndHeapAllocations::rewrap_block(Halide::Internal::Stmt, Halide::Internal::(anonymous namespace)::ExtractBlockSize const&)
Shadow bytes around the buggy address:
  0x504000142080: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa
  0x504000142100: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
  0x504000142180: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
  0x504000142200: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
  0x504000142280: fa fa 00 00 00 00 00 00 fa fa fd fd fd fd fd fa
=>0x504000142300: fa fa fd fd fd fd[fd]fa fa fa fa fa fa fa fa fa
  0x504000142380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x504000142400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x504000142480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x504000142500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x504000142580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==2304951==ABORTING

I built Halide using the buildbot LLVM v18.1.8 binaries, and the ASAN toolchain:

> export LLVM_ROOT=<path-to-extracted-llvm-v18.1.8>
> cmake -G Ninja -S . -B build -DClang_DIR=$LLVM_ROOT/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=install -DHalide_TARGET=host-<GPU-BACKEND>-asan -DLLD_DIR=$LLVM_ROOT/lib/cmake/lld -DLLVM_DIR=$LLVM_ROOT/lib/cmake/llvm -DLLVM_ROOT=$LLVM_ROOT -DWITH_PYTHON_BINDINGS=OFF -DWITH_TEST_FUZZ=OFF -DCMAKE_BUILD_TYPE=Release -DHalide_LLVM_ROOT=$LLVM_ROOT -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain.linux-x64-asan.cmake 
> cmake --build build --config Release
> HL_JIT_TARGET=host-<GPU-BACKEND>-asan ./build/test/correctness/correctness_gpu_reuse_shared_memory
steven-johnson commented 2 days ago

https://github.com/halide/Halide/pull/8483