How do you lower mhlo.reduce_window?


I try to lower downto executable a rather simple neural network (a tf.keras.applications.ResNet50). This network contains a tf.keras.layers.MaxPool2D layer, which gets translated, in the first stages of tf-opt, to mhlo.reduce_window.

Unfortunately, tf-opt does not seem able to further lower mhlo.reduce_window. This seems to also be a problem in iree. Is there a work-around? I am posting this here, since the problem seems to be at MLIR level.


In IREE, we actually can execute mhlo.reduce_window end-to-end on both CPU and GPU, see here. IREE can also run models end-to-end, which includes ResNet50. We have a resnet50 test with fake_weights. There is also a tensorflow integration test for ResNet50 in IREE.