Skip to content
New issue

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

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

Already on GitHub? # to your account

Introduce liftable constants to shaper to prepare for precompilation #33351

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Mar 19, 2024

Part of #25009

json reader writer proper fix

@maumar maumar requested a review from roji March 19, 2024 01:44
@maumar
Copy link
Contributor Author

maumar commented Mar 19, 2024

@roji created a separate PR to preserve the original code changes until we are happy with what we have. It's draft so far but should be ok to take a look. Only real outstanding issue is NTS, their value converter require SqlServerBytesReader/SqlServerBytesWriter, which in turn require NtsGeometryServices so it's a bit tricky to smuggle it in. Still a lot of small fixes, comments cleanups etc spoke too soon, still have lots of failures outside query

@maumar maumar force-pushed the aot_materializer branch from 3378012 to 05cf1e9 Compare March 19, 2024 02:14
@maumar maumar force-pushed the aot_materializer branch 6 times, most recently from 3548892 to fed9a36 Compare March 27, 2024 22:45
@maumar maumar force-pushed the aot_materializer branch 2 times, most recently from d708d97 to 339b9af Compare March 28, 2024 06:49
@maumar maumar marked this pull request as ready for review March 28, 2024 06:49
@maumar maumar force-pushed the aot_materializer branch 2 times, most recently from dd1cf50 to 487225a Compare March 28, 2024 08:11
@maumar maumar force-pushed the aot_materializer branch from 487225a to 0f61a77 Compare March 28, 2024 08:56
@maumar maumar requested a review from ajcvickers March 28, 2024 08:59
@maumar
Copy link
Contributor Author

maumar commented Mar 28, 2024

@ajcvickers specifically for changes in the EntityMaterializerSource and the area around (lazy loading, injectible service, parameter binding etc)

@maumar maumar force-pushed the aot_materializer branch from 0f61a77 to a424b3e Compare March 28, 2024 09:11
@maumar maumar force-pushed the aot_materializer branch from 1d415ae to c8a5950 Compare March 29, 2024 08:22
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Really nice to see this coming together! See first review comments.

@maumar maumar force-pushed the aot_materializer branch 6 times, most recently from 226a7c9 to 8c3691b Compare April 4, 2024 08:11
// NOTE: this is unreliable way to get type mapping. Only doing this as last resort, hoping to "guess" the right one
typeMappingExpression = liftableConstantFactory.CreateLiftableConstant(
typeMapping,
c => (RelationalTypeMapping)c.Dependencies.TypeMappingSource.FindMapping(type, c.Dependencies.Model, null)!,
Copy link
Member

Choose a reason for hiding this comment

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

Doing the same lookup for the regular/inline case would at least show us if there's a failing test where this logic isn't correct (this is in general why I prefer we avoid having different paths for regular vs. precompiled as much as possible).

@maumar maumar force-pushed the aot_materializer branch from 35fe741 to 49b9e76 Compare April 8, 2024 04:09
Copy link
Contributor

@ajcvickers ajcvickers left a comment

Choose a reason for hiding this comment

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

Changes to EntityMaterializerSource seem okay.

@maumar maumar force-pushed the aot_materializer branch 4 times, most recently from 828dbf0 to 36bb5a7 Compare April 9, 2024 06:04
@maumar
Copy link
Contributor Author

maumar commented Apr 9, 2024

@roji ready for the final peek, I removed all the changes not related to vanilla queries

@maumar maumar force-pushed the aot_materializer branch from 36bb5a7 to 805fdef Compare April 9, 2024 09:30
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

This looks almost ready - see remaining comments, I don't think they're blocking if they're problematic (let's discuss if so).

@maumar
Copy link
Contributor Author

maumar commented Apr 12, 2024

@roji updated with the latest feedback - all changes in separate commit for easier review

@maumar maumar force-pushed the aot_materializer branch from f47c305 to 3dcb48c Compare April 12, 2024 02:01
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @maumar!

Take a look at the remaining unresolved comments for final minor cleanup, but otherwise good to go!

Fix materializer code to replace non-primitive constants with liftable constants.
Precompilation is opt-in in QueryCompilationContext, switched on for relational, off for everything else.

Architecture, design and initial implementation done by @roji, polish done by @maumar

Part of #25009
@maumar maumar force-pushed the aot_materializer branch from 3dcb48c to 7880f1c Compare April 12, 2024 21:35
@maumar maumar merged commit f0e88d4 into main Apr 12, 2024
7 checks passed
@maumar maumar deleted the aot_materializer branch April 12, 2024 23:13
@roji
Copy link
Member

roji commented Apr 13, 2024

@maumar after rebasing the precompiled query PR (#33297) on top of this merged on, that PR build fails because of unsupported constant nodes (specifically ParameterBindingInfo, it seems). Can you please take a look?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants