Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@weidel-p
Copy link
Contributor

Handle DenseResourceElementsAttr in Canonicalization.cpp to deal with 1D dense resources.

Fixes: #22230

@weidel-p weidel-p force-pushed the fix/stablehlo-1d-resource branch from 8e6a0af to c4ad1bd Compare October 21, 2025 09:44
@weidel-p weidel-p changed the title Fix/stablehlo 1d resource [StableHLO] Fix/stablehlo 1d resource Oct 21, 2025
@kuhar
Copy link
Member

kuhar commented Oct 21, 2025

@weidel-p can you remove all the unrelated commits from this PR?

@weidel-p weidel-p force-pushed the fix/stablehlo-1d-resource branch from c4ad1bd to 4643144 Compare October 21, 2025 12:22
@weidel-p
Copy link
Contributor Author

sorry, the signoff added those by accident.

@kuhar kuhar removed request for benvanik and pashu123 October 21, 2025 21:39
@weidel-p weidel-p force-pushed the fix/stablehlo-1d-resource branch 2 times, most recently from ff884cb to 8d52a41 Compare October 21, 2025 22:10
@weidel-p
Copy link
Contributor Author

Thanks for the feedback, please take a look again.

@weidel-p weidel-p requested review from hanhanW and kuhar October 21, 2025 22:13
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

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

overall looks okay, just few nits.

// Test for reshape with dense_resource constants (regression test for crash)
// CHECK-LABEL: func.func @reshape_dense_resource
func.func @reshape_dense_resource() -> tensor<8x1x1xf32> {
%cst = stablehlo.constant dense_resource<torch_tensor_8_torch.float32> : tensor<8xf32>
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need any torch things in StableHLO directory. Can you just do something like dense_resource<__elided__> : tensor<8xf32>, or find a builtin one?

This test will be broken if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed the dense resource with elided.

@hanhanW
Copy link
Contributor

hanhanW commented Oct 21, 2025

Please update PR title. [StableHLO] Fix/stablehlo 1d resource is very meaningless when you skim through the commit history.

See https://google.github.io/eng-practices/review/developer/cl-descriptions.html for the guidance.

@weidel-p weidel-p changed the title [StableHLO] Fix/stablehlo 1d resource [StableHLO] Fix reshape canonicalization for dense_resource constants. Oct 22, 2025
weidel-p and others added 5 commits October 22, 2025 07:11
@weidel-p weidel-p force-pushed the fix/stablehlo-1d-resource branch from be292bd to 5070145 Compare October 22, 2025 14:11
@weidel-p weidel-p requested a review from kuhar October 22, 2025 14:11
@weidel-p weidel-p requested review from hanhanW and kuhar October 22, 2025 14:12
Signed-off-by: Philipp <[email protected]>
Signed-off-by: Philipp <[email protected]>
@weidel-p weidel-p requested a review from kuhar October 22, 2025 15:06
@weidel-p
Copy link
Contributor Author

sorry, I missed installing the pre-commit tool. Now linting should work.

Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

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

thanks!

@hanhanW hanhanW merged commit c6aee4a into iree-org:main Oct 22, 2025
46 checks passed
pstarkcdpr pushed a commit to pstarkcdpr/iree that referenced this pull request Nov 28, 2025
iree-org#22365)

Handle DenseResourceElementsAttr in Canonicalization.cpp to deal with 1D
dense resources.

Fixes: iree-org#22230

---------

Signed-off-by: Philipp <[email protected]>
Co-authored-by: Han-Chung Wang <[email protected]>
Co-authored-by: Jakub Kuderski <[email protected]>
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.

1D dense_resource (Bias) in stablehlo can't be compiled

3 participants