iree: 'util.initializer' op failed to inline into combined initializer
What happened?
The further error after https://github.com/iree-org/iree/issues/18232
repro.mlir:107:12: error: 'util.initializer' op failed to inline into combined initializer
%414 = affine.apply #map32()[%408, %409, %247]
^
repro.mlir:7:3: note: called from
func.func @torch_jit() -> index {
^
repro.mlir:107:12: note: see current operation:
"util.initializer"() <{function_type = () -> ()}> ({
%0 = "arith.constant"() <{value = 0 : i8}> : () -> i8
%1 = "util.global.load"() <{global = @__hoisted_i32_21}> : () -> i32
%2 = "stream.tensor.sizeof"() <{affinity = #hal.device.affinity<@__device_0>, encoding = tensor<1xi32>}> : () -> index
%3 = "stream.tensor.splat"(%0, %2) <{affinity = #hal.device.affinity<@__device_0>, result_encoding = tensor<1xi32>}> : (i8, index) -> !stream.resource<*>
%4 = "stream.tensor.sizeof"() <{affinity = #hal.device.affinity<@__device_0>, encoding = tensor<i32>}> : () -> index
%5 = "stream.async.transfer"(%3, %4, %4) <{result_affinity = #hal.device.affinity<@__device_0>, source_affinity = #hal.device.affinity<@__device_0>}> : (!stream.resource<*>, index, index) -> !stream.resource<staging>
%6 = "stream.tensor.load"(%5, %4) <{operandSegmentSizes = array<i32: 1, 0, 1, 0>, source_encoding = tensor<i32>}> : (!stream.resource<staging>, index) -> i32
%7 = "arith.index_cast"(%6) : (i32) -> index
%8 = "arith.index_cast"(%1) : (i32) -> index
%9 = "affine.apply"(%7, %8) <{map = affine_map<()[s0, s1] -> (s0 + s1 + 1)>}> : (index, index) -> index
%10 = "arith.index_cast"(%9) : (index) -> i64
"util.global.store"(%10) <{global = @__hoisted_i64}> : (i64) -> ()
"util.return"() : () -> ()
}) {stream.affinity.default = #hal.device.affinity<@__device_0>} : () -> ()
%414 = affine.apply #map32()[%408, %409, %247]
^
Steps to reproduce your issue
- Repro: https://gist.github.com/jinchen62/79d3f497ad8ef45c30b3f9803390685d
iree-compile --iree-input-demote-i64-to-i32 --iree-hal-target-backends=llvm-cpu repro.mlir -o test.vmfb
What component(s) does this issue relate to?
No response
Version information
Build TOM locally
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (12 by maintainers)
The
affine.applys are not the issue. It is the way this is lowered into Linalg. This is all essentially index computation. There shouldnt be any Linalg.@vivekkhandelwal1 I extracted the repro from one of the models of this list, maybe
onnx/models/botnet26t_256. This list is from HF CNN f32 and all had this issue, but it should be outdated. Maybe some shape inference related issues were resolved.@pdhirajkumarprasad It would be good to update the repro.
Good points - negative indexing and 0-element tensors are a big red flag. I’m quite sure that will cause issues somewhere. I don’t think it solves the failed to inline issue but maybe we won’t have that when the IR is cleaned up.
The comment may be dated but the code is still doing that - if you think it’s safe to remove (or conditionally do it based on the
opbeing inlined) that’d be useful!