Closed phoenix-meadowlark closed 2 years ago
It appears that lax.fori_loop
gives the same error when given a parameter (in this case an array of three integers):
def add_45(x):
def add(i, x):
return x + i
x = lax.fori_loop(0, 10, add, x)
return x
HloModule xla_computation_wrapped_function__1.41
body_computation__1.7 {
constant.12 = pred[] constant(false)
parameter.8 = (s32[], s32[], s32[3]{0}) parameter(0)
get-tuple-element.9 = s32[] get-tuple-element(parameter.8), index=0
constant.18 = s32[] constant(1)
add.19 = s32[] add(get-tuple-element.9, constant.18)
get-tuple-element.10 = s32[] get-tuple-element(parameter.8), index=1
constant.13 = s32[] constant(1)
add.14 = s32[] add(get-tuple-element.10, constant.13)
convert.15 = s32[] convert(get-tuple-element.10)
broadcast.16 = s32[3]{0} broadcast(convert.15), dimensions={}
get-tuple-element.11 = s32[3]{0} get-tuple-element(parameter.8), index=2
add.17 = s32[3]{0} add(broadcast.16, get-tuple-element.11)
ROOT tuple.20 = (s32[], s32[], s32[3]{0}) tuple(add.19, add.14, add.17)
}
cond_computation__1.21 {
parameter.22 = (s32[], s32[], s32[3]{0}) parameter(0)
get-tuple-element.24 = s32[] get-tuple-element(parameter.22), index=1
get-tuple-element.25 = s32[3]{0} get-tuple-element(parameter.22), index=2
constant.26 = pred[] constant(false)
get-tuple-element.23 = s32[] get-tuple-element(parameter.22), index=0
constant.27 = s32[] constant(10)
ROOT compare.28 = pred[] compare(get-tuple-element.23, constant.27), direction=LT
}
ENTRY xla_computation_wrapped_function__1.41 {
constant.2 = pred[] constant(false)
constant.4 = pred[] constant(false)
constant.5 = s32[] constant(0)
constant.3 = s32[] constant(0)
parameter.1 = s32[3]{0} parameter(0)
tuple.6 = (s32[], s32[], s32[3]{0}) tuple(constant.5, constant.3, parameter.1)
while.29 = (s32[], s32[], s32[3]{0}) while(tuple.6), condition=cond_computation__1.21, body=body_computation__1.7
get-tuple-element.30 = s32[] get-tuple-element(while.29), index=0
get-tuple-element.31 = s32[] get-tuple-element(while.29), index=1
get-tuple-element.32 = s32[3]{0} get-tuple-element(while.29), index=2
tuple.33 = (s32[], s32[], s32[3]{0}) tuple(get-tuple-element.30, get-tuple-element.31, get-tuple-element.32)
get-tuple-element.34 = s32[] get-tuple-element(tuple.33), index=0
get-tuple-element.35 = s32[] get-tuple-element(tuple.33), index=1
get-tuple-element.36 = s32[3]{0} get-tuple-element(tuple.33), index=2
tuple.37 = (s32[], s32[3]{0}) tuple(get-tuple-element.35, get-tuple-element.36)
get-tuple-element.38 = s32[] get-tuple-element(tuple.37), index=0
get-tuple-element.39 = s32[3]{0} get-tuple-element(tuple.37), index=1
ROOT tuple.40 = (s32[3]{0}) tuple(get-tuple-element.39)
}
LLVM ERROR: operation destroyed but still has uses
Stack dump:
0. Program arguments: iree-import-xla --xla-format=hlo_text /tmp/lax_fori_loop.hlo.txt
1. In-Flight Diagnostics:
loc("constant.27"): error: 'mhlo.constant' op operation destroyed but still has uses
...
[1] 695151 abort --xla-format=hlo_text /tmp/lax_fori_loop.hlo.txt
That seems reasonable since they just call the same op. The function I posted in #5510 still produces the operand #0 does not dominate this use
error though, even though it should be identical as far as the loop is concerned. (It looks like the difference in number of loop iterations also isn't the cause here).
With the latest updated, this now compiles but fails at runtime with:
ValueError: Error invoking function: third_party/iree/iree/modules/hal/hal_module.c:362: INVALID_ARGUMENT; load length byte count 16 exceeds max; while invoking native function hal.buffer.load; while calling import
Closing this in favor of #9499 as the HLO importer is defunct.
Lowering
lax.while_loop
fails due toerror: 'mhlo.constant' op operation destroyed but still has uses
. The python, HLO text and stack dump / reproduction instructions can be found below.