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

Cost-based optimizer: Implement simple cost model that demonstrates benefits with NDS queries #2744

Merged
merged 12 commits into from
Jun 23, 2021

Conversation

andygrove
Copy link
Contributor

@andygrove andygrove commented Jun 18, 2021

Closes #2718 and #2717

Changes in this PR:

  • Implements a simple cost model by specifying default CPU and GPU operator costs, and implements special handling for ProjectExec and UnionExec
  • Fixes a bug where writes would fall back to the CPU because the optimizer considered that AdaptiveSparkPlanExec was a CPU plan ([BUG] CBO falls back to CPU to write to Parquet in some cases #2718)
  • Fixes a bug where joins were sometimes falling back to CPU ([BUG] CBO forces joins back onto CPU in some cases #2717)
  • Added trace logging showing the costs calculated by the cost-based optimizer, and the actions it takes. This makes it possible to debug a query and see what the optimizer is doing.

Real-world benefits of this PR with NDS benchmarks:

  • 20+ queries no longer fall back to CPU for writes
  • q6: Avoids moving to the GPU for a trivial projection followed by a shuffle
  • q11 & q74: Avoids moving to the GPU for a trivial projection following a CPU SortMergeJoin. The next operator moves to the GPU anyway, so this isn't of much benefit overall.
  • q23a: Avoids moving to the GPU just for a union
  • q58: Avoids moving to the GPU for a trivial projection between two CPU SortMergeJoins.

WIP because I can't test everything locally and need time on environments to do full runs at scale after code changes, to confirm no regressions. I also need to figure out how to write good tests for the current capabilites.

Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
@andygrove andygrove added the performance A performance related task/issue label Jun 18, 2021
@andygrove andygrove added this to the June 7 - June 18 milestone Jun 18, 2021
@andygrove andygrove self-assigned this Jun 18, 2021
Signed-off-by: Andy Grove <andygrove@nvidia.com>
@andygrove andygrove changed the title WIP: Cost-based optimizer: Implement simple cost model that demonstrates benefits with NDS queries Cost-based optimizer: Implement simple cost model that demonstrates benefits with NDS queries Jun 18, 2021
@andygrove andygrove marked this pull request as ready for review June 18, 2021 22:11
Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
@jlowe jlowe linked an issue Jun 22, 2021 that may be closed by this pull request
Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
Signed-off-by: Andy Grove <andygrove@nvidia.com>
@jlowe
Copy link
Member

jlowe commented Jun 23, 2021

build

@andygrove andygrove merged commit a7b4526 into NVIDIA:branch-21.08 Jun 23, 2021
@andygrove andygrove deleted the cbo-simple-model branch June 23, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance A performance related task/issue
Projects
None yet
3 participants