Skip to content

[compiler] ensure CDA result Array[Array[Byte]] can be GCed after dec…#13011

Merged
danking merged 3 commits intohail-is:mainfrom
tpoterba:free-encoded-results
May 11, 2023
Merged

[compiler] ensure CDA result Array[Array[Byte]] can be GCed after dec…#13011
danking merged 3 commits intohail-is:mainfrom
tpoterba:free-encoded-results

Conversation

@tpoterba
Copy link
Copy Markdown
Contributor

@tpoterba tpoterba commented May 9, 2023

…oding

danking
danking previously requested changes May 9, 2023

val encRes = cb.newLocal[Array[Array[Byte]]]("encRes")
val len = mb.newLocal[Int]("cda_result_length")
val ib = mb.newLocal[InputBuffer]("decode_ib")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why sometimes class builder sometimes method builder?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More direct: How do you pick when to use mb vs cb?

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.

These are aliased. Rewrote to use the more idiomatic "memoize" now and avoid explicit variable declarations.

The rule is basically to use the lowest-level builder that has the functionality you want. Module > Class > Method > Code, but codeBuilder doesn't duplicate the full functionality of everything above. So to create a field, use methodBuilder (it exists on MB and ClassB, not codeB).

.asBaseStruct
eltTupled.loadField(cb, 0)
}
cb.assign(encRes, Code._null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not possible to also free each block after decoding it? As written we'd need twice the RAM to read a given result array, I think.

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.

nice

})

val encRes = cb.newLocal[Array[Array[Byte]]]("encRes")
cb.assign(encRes, spark.invoke[BackendContext, HailClassLoader, FS, String, Array[Array[Byte]], Array[Byte], String, Option[TableStageDependency], Array[Array[Byte]]](
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved, but is it possible to use memoize here as well or is this special in some way?

@danking danking merged commit b2afe57 into hail-is:main May 11, 2023
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