-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Explore replacing monomorphization with implicit conversion #11269
Comments
Certainly reasonable to require This sounds like an overall nice simplification. I have personally been confused by the idea of a Param (capitalized) in the past, and more unification would make things easier to reason about. |
#11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…11272) (#11277) #11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…11272) (#11275) #11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
I started working on breaking out a "runtime" component of this issue, and I realized that how you would do that ends up more directly guiding how "compiletime" might be implemented. See below. The runtime representation that we expect to have after this change is that the identity of a
To compute this smaller After computing the All of this is fine: but an interesting bit (and the connection to "compile time") is what to do about the
In short: it's possible that it's easier to reason about the "argument preparation" steps as a separate node in the compilation graph or specialized edge types perhaps. |
Have made some progress on an implicit-conversion based implementation of |
Note to self: a "union find" datastructure seems perfect for what I had already been calling "unifying" the solutions to various nodes: https://gist.github.com/cfbolz/ba9b4a9a54e6620b9eb86a213cc6d272 |
After revisiting this last month, I believe that fundamentally simplifying graph solving is the path forward. Closing this one in favor of #18905. |
We currently "monomorphize"
@rule
s in theRuleGraph
by creating a distinct copy of a@rule
per set ofParam
types that it might be used with. This is quite complicated, and a lot of time has been invested in making it "mostly work"... but the implementation is not perfect, and we've needed to apply constraints that can be difficult to reason about.A motivation for monomorphization is that it avoids needing
eq
orhash
implementations for positional arguments to@rules
which are computed fromParam
s, rather than beingParam
s themselves. That is of questionable value relative to the complexity it incurs. And additionally, because monomorphization creates additional copies of@rules
, it's likely that we are memoizing less than we could be.An alternative to monomorphization would be to instead treat the preparation of the positional arguments to a
@rule
as similar to "implicit conversion" (a native concept in Scala, and possible via theDeref
trait in Rust). This would involve optionally recursing to do "type conversion" via other rules (such as fromAddresses
toTargets
) before invoking a@rule
. For the purposes of these conversions, it's likely possible to keep a global lookup table of conversions that are possible, rather than actually encoding the conversion as a dependency of theRuleGraph
entry.The text was updated successfully, but these errors were encountered: