tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[HEXAGON] Disable automatic unrolling in LLVM

Open joshherr-quic opened this issue 3 years ago • 4 comments
trafficstars

Automatic unrolling in LLVM was causing significant issues with compile time and binary size of a bert int8 model. This patch disables unrolling in LLVM for the hexagon backend. While not a permanent solution, this should unblock some development efforts on this path.

cc @mehrdadh

joshherr-quic avatar Aug 29 '22 21:08 joshherr-quic

@joshherr-quic please update the PR description :)

mehrdadh avatar Sep 01 '22 21:09 mehrdadh

I see that this is failing CI on Hexagon with this error (link):

[2022-08-29T22:19:07.000Z] tests/python/contrib/test_hexagon/test_2d_physical_buffers.py::TestElementWise::test_build[nhwc-nhwc-int8-16-32-32x32-nhwc-global-hexagon] LLVM ERROR: Cannot select: 0x3fbc580: v8i8 = HexagonISD::VASL 0x3e53240, Constant:i32<1>
[2022-08-29T22:19:07.000Z]   0x3e53240: v8i8,ch = load<(load (s64) from %ir.cgep31, align 64, !tbaa !97)> 0x3da4928, 0x3d14738, undef:i32
[2022-08-29T22:19:07.000Z]     0x3d14738: i32 = add 0x3d14390, Constant:i32<-128>
[2022-08-29T22:19:07.000Z]       0x3d14390: i32,ch = CopyFromReg 0x3da4928, Register:i32 %14
[2022-08-29T22:19:07.000Z]         0x3d14a78: i32 = Register %14
[2022-08-29T22:19:07.000Z]       0x3d13f80: i32 = Constant<-128>
[2022-08-29T22:19:07.000Z]     0x3f81c38: i32 = undef
[2022-08-29T22:19:07.000Z]   0x3d14120: i32 = Constant<1>
[2022-08-29T22:19:07.000Z] In function: default_function_compute_
[2022-08-29T22:19:07.000Z] Fatal Python error: Aborted

If CI is using LLVM build provided by Hexagon SDK 4.5.0.3 (link) (I could be mistaken), does that mean this PR requires a newer version of the SDK?

cconvey avatar Sep 18 '22 18:09 cconvey

Is this crash solved by https://github.com/llvm/llvm-project/commit/3c817574c2db9dbb003914dc40d58fe1dcfda855? If so, this could be gated on TVM_LLVM_VERSION >= 160

supersat avatar Sep 18 '22 19:09 supersat

Is this crash solved by https://github.com/llvm/llvm-project/commit/3c817574c2db9dbb003914dc40d58fe1dcfda855? If so, this could be gated on TVM_LLVM_VERSION >= 160

That's correct, I'll go ahead and gate it and push a followup commit.

joshherr-quic avatar Sep 19 '22 15:09 joshherr-quic