Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more folding for composite instructions #4802

Merged
merged 3 commits into from
May 26, 2022

Conversation

s-perron
Copy link
Collaborator

Fold chains of insert into construct

If a chain of OpCompositeInsert instruction write to every element of a
composite object, then we can replace it with an OpCompositeConstruct.

Fold a construct fed by extracts to a single extract

We already fold an OpCompositeConstruct when it is simlpy reconstructing
an object that was decomposed by a series of OpCompositeExtract
instructions. However, we do not do that if that object is an element
of a larger object.

I have updated the rule, so that if the original object is a an element
of a larger object, then the OpCompositeConstruct is replaced with a
single OpCompositeExtract from the larger object.

Fixes #4371.

@s-perron s-perron self-assigned this May 13, 2022
Fold chains of insert into construct

If a chain of OpCompositeInsert instruction write to every element of a
composite object, then we can replace it with an OpCompositeConstruct.

Fold a construct fed by extracts to a single extract

We already fold an OpCompositeConstruct when it is simlpy reconstructing
an object that was decomposed by a series of OpCompositeExtract
instructions.  However, we do not do that if that object is an element
of a larger object.

I have updated the rule, so that if the original object is a an element
of a larger object, then the OpCompositeConstruct is replaced with a
single OpCompositeExtract from the larger object.

Fixes KhronosGroup#4371.
source/opt/folding_rules.cpp Outdated Show resolved Hide resolved
source/opt/folding_rules.cpp Outdated Show resolved Hide resolved
source/opt/folding_rules.cpp Show resolved Hide resolved
source/opt/folding_rules.cpp Outdated Show resolved Hide resolved
source/opt/folding_rules.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@vettoreldaniele vettoreldaniele left a comment

Choose a reason for hiding this comment

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

LGTM, just a typo

source/opt/folding_rules.cpp Outdated Show resolved Hide resolved
@s-perron s-perron changed the title Add move folding for composite instructions Add more folding for composite instructions May 16, 2022
@prideout
Copy link

CC @prideout

@s-perron s-perron merged commit 088cb1a into KhronosGroup:master May 26, 2022
@s-perron s-perron deleted the i4371 branch May 26, 2022 14:29
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.

Piecewise copy of matrix is poorly optimized
3 participants