Skip to content

Relax TorchIndexSelectOp to fuse with other ops. - #3682

Merged
hanhanW merged 1 commit into
iree-org:mainfrom
hanhanW:torch-fuse
Nov 5, 2020
Merged

hanhanW merged 1 commit into
iree-org:mainfrom
hanhanW:torch-fuse

Conversation

@hanhanW

@hanhanW hanhanW commented Nov 2, 2020 •

Copy link
Copy Markdown
Contributor

After moving the op to tensors world, the ops can be fused with their
consumer. The patch also allows the ops to live with their producers in
the same dispatch function. This does not break any models. Go through
some models and lowering from TF, the input of the ops usually are from
constant or model input, which becomes a buffer in IREE.

Fixes #3562

@hanhanW

hanhanW commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

Already tested with internal model tests, and they are passing.

@hanhanW

hanhanW commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

There is an issue in unidirectional_lstm.mlir. I'm still working on this.

Crashed in llvm-ir. But Passed on vulkan but with three following error messages.

E ../iree/hal/vulkan/debug_reporter.cc:40] Validation Error: [ VUID-VkWriteDescriptorSet-descriptorType-00331 ] Object 0: handle = 0x4000000000
4, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0xde8c9ed7 | vkCmdPushDescriptorSetKHR() failed update validation: Write update t
o Push Descriptors defined with VkDescriptorSetLayout VkDescriptorSetLayout 0x40000000004[] binding #0 failed with error message: Attempted wri
te update to buffer descriptor failed due to: Buffer (VkBuffer 0x460000000046[]) with usage mask 0x3 being used for a descriptor update of type
 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER does not have VK_BUFFER_USAGE_STORAGE_BUFFER_BIT set.. The Vulkan spec states: If descriptorType is VK_DESCR
IPTOR_TYPE_STORAGE_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, the buffer member of each element of pBufferInfo must have been created
 with VK_BUFFER_USAGE_STORAGE_BUFFER_BIT set (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkWriteDescrip
torSet-descriptorType-00331)

@hanhanW

hanhanW commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

This fails in llvm-ir backend, because of "LLVM IR fails to verify".

More log:

I ../iree/tools/iree-run-mlir-main.cc:207] Compiling for target backend 'llvm-ir*'...
iree-run-mlir: ../third_party/llvm-project/llvm/lib/IR/Instructions.cpp:2296: void llvm::InsertValueInst::init(llvm::Value *, llvm::Value *, ArrayRef<unsigned int>, const llvm::Twine &): Assertion `ExtractValueInst::getIndexedType(Agg->getType(), Idxs) == Val->getType() && "Inserted value must match indexed type!"' failed.

It doesn't happen before the patch, I'll look into more details.

After moving the op to tensors world, the ops can be fused with their
consumer. The patch also allows the ops to live with their producers in
the same dispatch function. This does not break any models. Go through
some models and lowering from TF, and the input of the ops usually are
from constant or model input, which becomes a buffer in IREE.
@hanhanW

hanhanW commented Nov 5, 2020

Copy link
Copy Markdown
Contributor Author

Synced to ToT and tested internally, PTAL.

@hanhanW
hanhanW requested a review from asaadaldien November 5, 2020 08:21
@hanhanW
hanhanW merged commit 3b9a9f0 into iree-org:main Nov 5, 2020
@hanhanW
hanhanW deleted the torch-fuse branch November 5, 2020 16:40
@hanhanW hanhanW mentioned this pull request Nov 5, 2020
hanhanW added a commit that referenced this pull request Nov 5, 2020
hanhanW added a commit that referenced this pull request Nov 5, 2020
@hanhanW hanhanW mentioned this pull request Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fuse operations with torch_index_select op (aka gather op)

2 participants