Skip to content

Emit torch.vtensor.literal for small initializers#36

Open
jtuyls wants to merge 1 commit into
iree-org:mainfrom
jtuyls:vtensor-literal-constants-v2
Open

Emit torch.vtensor.literal for small initializers#36
jtuyls wants to merge 1 commit into
iree-org:mainfrom
jtuyls:vtensor-literal-constants-v2

Conversation

@jtuyls
Copy link
Copy Markdown
Contributor

@jtuyls jtuyls commented Mar 30, 2026

Small initializers (<=256 bytes) now emit torch.vtensor.literal instead of flow.tensor.constant + torch_c.from_builtin_tensor. This allows torch-mlir conversion patterns to directly match constant values.

@jtuyls jtuyls force-pushed the vtensor-literal-constants-v2 branch from 7af0aec to 63efe40 Compare March 30, 2026 08:13
Small initializers (<=256 bytes) now emit torch.vtensor.literal instead
of flow.tensor.constant + torch_c.from_builtin_tensor. This allows
torch-mlir conversion patterns to directly match constant values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jorn <jorn.tuyls@gmail.com>
@jtuyls jtuyls force-pushed the vtensor-literal-constants-v2 branch from 63efe40 to 13d7348 Compare March 30, 2026 08:18
@jtuyls jtuyls requested review from Groverkss and IanWood1 March 30, 2026 08:25
Copy link
Copy Markdown
Collaborator

@Groverkss Groverkss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be needed. The folder for from_builtin... should fold any constant like operation. Can you check if the folders are working correctly? We already don't use dialect resources for small initializers.

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.

2 participants