The GitHub Actions job "Lint" on tvm.git/fix-avg-pool2d-llvm-codegen-crash has 
failed.
Run started by GitHub user hamzaqureshi5 (triggered by cbalint13).

Head commit for run:
35ba189cbe9ea308813930e9c892efd4195d2ee2 / Hamza Qureshi 
<[email protected]>
[Target][LLVM] Fall back to unoptimized module on invalid post-opt IR

relax.build(target="llvm") hard-crashed during LLVM codegen verification
for avg_pool2d with input shape [N, C=4, H(even>=6), W=3], e.g. [1,4,6,3]:

    InternalError: LLVM module verification failed:
    Instruction does not dominate all uses!
      %314 = shufflevector <4 x float> %287, <4 x float> %311, <2 x i32> <i32 
2, i32 6>
      %90  = shufflevector <2 x float> %314, <2 x float> %89,  <4 x i32> <i32 
0, 1, 2, 3>

Root cause is an LLVM optimizer bug, not TVM codegen. The TIR TVM lowers is
scalar and the IR TVM emits verifies clean (both llvm::verifyModule and
llvm-as accept it); the crash only appears at opt-level >= 2. Running stock
`opt -passes='default<O2>'` on TVM's valid IR reproduces the identical
"does not dominate all uses" abort, so LLVM's own vectorizer turns valid IR
into a structurally-invalid module (C=4 fills a 4-wide vector and W=3
misaligns the strided gather, steering the SLP/loop vectorizer into the bug).

Rather than hard-crash on a backend-optimizer bug, CodeGenLLVM::Finish() now
keeps a verified clone of the pre-optimization module and, if the optimized
module fails verification, warns and falls back to that known-good module.
The build then produces correct (unoptimized) code and never emits the broken
module. The pre-opt Verify() still throws, so genuine TVM codegen bugs remain
surfaced.

Adds a numerical regression test in test_vm_build.py covering the crashing
and neighbouring shapes.

Report URL: https://github.com/apache/tvm/actions/runs/29581972497

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to