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

[FEAT] [New Executor] [2/N] daft-execution crate + proof-of-concept compute ops and partition reference + metadata model for new executor. #2340

Merged
merged 8 commits into from
Jun 7, 2024

Conversation

clarkzinzow
Copy link
Contributor

@clarkzinzow clarkzinzow commented Jun 5, 2024

This PR adds the daft-execution subcrate containing a set of proof-of-concept local compute ops and the partition reference + metadata model for the new executor.

Partial metadata machinery isn't yet implemented since no task scheduler or exchange op has required it yet.

TODOs

  • Add unit tests for compute ops.
  • Add doc strings for abstractions.

@github-actions github-actions bot added the enhancement New feature or request label Jun 5, 2024
@clarkzinzow clarkzinzow force-pushed the clark/execution-model-prototype-2-compute-ops branch from 456ecfe to fc4cf7a Compare June 5, 2024 19:33
@clarkzinzow clarkzinzow changed the title [FEAT] [New Executor] [2/N] Proof-of-concept compute ops and partition reference + metadata model for new executor. [FEAT] [New Executor] [2/N] daft-execution crate + proof-of-concept compute ops and partition reference + metadata model for new executor. Jun 5, 2024
rayon = {workspace = true}
snafu = {workspace = true}
sysinfo = {workspace = true}
tokio = {workspace = true}
Copy link
Contributor Author

@clarkzinzow clarkzinzow Jun 5, 2024

Choose a reason for hiding this comment

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

Some of these dependencies will be used in future PRs in the stack; I already double-checked that only those required by the last PR in the stack are included here.

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 46.50655% with 490 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@021b103). Learn more about missing BASE report.

Current head b754804 differs from pull request most recent head 160b172

Please upload reports for the commit 160b172 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2340   +/-   ##
=======================================
  Coverage        ?   78.47%           
=======================================
  Files           ?      487           
  Lines           ?    56169           
  Branches        ?        0           
=======================================
  Hits            ?    44081           
  Misses          ?    12088           
  Partials        ?        0           
Files Coverage Δ
src/daft-micropartition/src/lib.rs 40.00% <ø> (ø)
...logical_optimization/rules/push_down_projection.rs 74.56% <100.00%> (ø)
src/lib.rs 97.22% <100.00%> (ø)
src/daft-execution/src/lib.rs 42.85% <42.85%> (ø)
src/daft-micropartition/src/micropartition.rs 92.19% <25.00%> (ø)
src/daft-execution/src/partition/partition_ref.rs 52.00% <52.00%> (ø)
src/daft-execution/src/ops/mod.rs 0.00% <0.00%> (ø)
src/daft-execution/src/ops/filter.rs 0.00% <0.00%> (ø)
src/daft-execution/src/ops/project.rs 0.00% <0.00%> (ø)
src/daft-execution/src/ops/scan.rs 0.00% <0.00%> (ø)
... and 7 more

input_meta: &[PartitionMetadata],
) -> ResourceRequest {
self.resource_request
.or_memory_bytes(input_meta.iter().map(|m| m.size_bytes).sum())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should eventually take the max of the heap memory estimate for all fused ops in the chain, using max output size estimates from previous ops in the chain. This would require looping in the approximate stats estimate logic that's currently tied to the physical plan, which we previously talked about factoring out.

src/daft-execution/src/ops/mod.rs Outdated Show resolved Hide resolved
src/daft-execution/src/ops/filter.rs Outdated Show resolved Hide resolved
#[derive(Debug)]
pub struct FusedOpBuilder<T> {
// Task op at the front of the chain.
source_op: Arc<dyn PartitionTaskOp<Input = T>>,
Copy link
Member

Choose a reason for hiding this comment

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

how does this look if we have some of these cases:

BroadcastJoin(ScanOP, ScanOP)

or

Concat(ScanOp, Micropartition)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline, current behavior in status quo execution model is to materialize scans before BroadcastJoin and the like, so tabling this as a post proof-of-concept optimization.

input_meta: &[PartitionMetadata],
) -> PartitionMetadata {
assert_eq!(input_meta.len(), 1);
let input_meta = &input_meta[0];
Copy link
Member

Choose a reason for hiding this comment

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

we should also be updating the number of bytes

Copy link
Contributor Author

@clarkzinzow clarkzinzow Jun 7, 2024

Choose a reason for hiding this comment

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

For sure, I'll fix that! Note that this is currently unused - the partial metadata machinery is still a TODO for all ops and the surrounding execution model, since no exchange or sink ops have needed it yet.

Copy link
Contributor Author

@clarkzinzow clarkzinzow Jun 7, 2024

Choose a reason for hiding this comment

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

Hmm our current behavior is to set size_bytes to None, since we don't know the exact new size in bytes until we actually apply the limit. E.g. you could remove 99% of the rows, but 99% of the size in bytes could be in that remaining 1% of rows if those rows are particularly large.

size_bytes=None,

assert_eq!(inputs.len(), 1);
let input = inputs.into_iter().next().unwrap();
let out = input.add_monotonically_increasing_id(
self.num_partitions.load(Ordering::SeqCst) as u64,
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we be using fetch_add() here instead of relying on with_input_metadata being called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with_input_metadata() is guaranteed to be called within the scheduler right before submission, while execute() is called at task execution time, potentially on a different machine if using a distributed executor, which wouldn't update the partition counter for other to-be-executed tasks. For that reason, we should ensure such state is mutated within the scheduler before submission.

src/daft-execution/src/ops/shuffle.rs Outdated Show resolved Hide resolved
@clarkzinzow clarkzinzow force-pushed the clark/execution-model-prototype-2-compute-ops branch from 378ddd0 to 160b172 Compare June 7, 2024 21:37
@clarkzinzow clarkzinzow merged commit 22ef02b into main Jun 7, 2024
42 checks passed
@clarkzinzow clarkzinzow deleted the clark/execution-model-prototype-2-compute-ops branch June 7, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants