Skip to content

[compiler] Use code tuple size to decide whether to create an InsertF…#12760

Merged
danking merged 1 commit into
hail-is:mainfrom
tpoterba:insertfields-smaller-limit
Mar 7, 2023
Merged

[compiler] Use code tuple size to decide whether to create an InsertF…#12760
danking merged 1 commit into
hail-is:mainfrom
tpoterba:insertfields-smaller-limit

Conversation

@tpoterba

@tpoterba tpoterba commented Mar 7, 2023

Copy link
Copy Markdown
Contributor

…ieldsStruct or pointer


def insert(cb: EmitCodeBuilder, region: Value[Region], newType: TStruct, fields: (String, EmitValue)*): SBaseStructValue = {
if (newType.size < 64 || fields.length < 16)
if (st.settableTupleTypes().length + fields.map(_._2.emitType.settableTupleTypes.length).sum < 64)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Besides changing to measure struct size by code tuple size, this also changes from "new struct is small, or added fields are small" to just "new struct is small". Can you explain that change? Do we not want to use an InsertFieldsStruct when adding a few fields to a big struct? (Actually, why does the size of the original struct matter at all?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The original behavior was really intended to control the settable tuple size, but obviously ineffectively. We don't have a way to call methods where the scode args have more than 255 code members right now, and the general fix is to support that, but I don't know when we'll get to that. Leo's hitting an issue where encoder methods have too many params: #12533 #12532 #12531

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good question, should have clarified the reason in the initial comment!

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.

3 participants