Skip to content

Add execute-backed EnsembleTable.replace_blocks - #1369

Draft
RBendias wants to merge 1 commit into
mainfrom
rbendias/ensemble-replace-blocks
Draft

RBendias wants to merge 1 commit into
mainfrom
rbendias/ensemble-replace-blocks

Conversation

@RBendias

Copy link
Copy Markdown
Collaborator

Summary

Add EnsembleTable.replace_blocks, assuming the ensemble execute API is available. Preserve member schemas and omitted blocks while accepting shared tensor replacements or member-aligned ensemble replacements.

Description of the change

This is an intentionally dependency-blocked extraction from #797: main does not yet provide EnsembleData.execute. The reconstruction path also uses the generic value container introduced by #1367. No execution implementation, runtime fallback executor, type-checker suppression, or existing PR changes are included here.

When all replacement ensembles use the table's member locations, the method delegates to execute(TableTensor.replace_blocks, ...). For differing layouts, it sends only column metadata, omitted blocks, and replacement values to execute(TableTensor, ...); old values of replaced blocks never participate in alignment. All actual alignment remains owned by execute. Semantic tensor types and underlying TableTensor validation are retained.

# Requires the execute implementation.
output = ensemble.replace_blocks(numerical=member_values)

Validation

The candidate method was injected in memory into the real execution backend from #797, without modifying that branch. All 41 selected tests passed: the two new contracts plus Standardize, recipe execution and existing execution regressions. Contract tests cover shared tensors, differently ordered/grouped inputs, simultaneous numerical/datetime replacement, different member schemas and row counts, and preservation of omitted categorical vocabularies.

CUDA measurements used eight members, 50,000 rows, and 32 numerical columns with torch.utils.benchmark.Timer.blocked_autorange(min_run_time=0.2) and peak allocated-memory statistics. Compared with the existing #797 method:

Layout Existing #797 Candidate Candidate extra CUDA memory
Shared table, member-specific replacement 652 µs 650 µs 0 bytes
Matching physical batch 523 µs 113 µs 0 bytes
Reordered source batch 592 µs 535 µs 0 bytes

A plain wrapper around execute(TableTensor.replace_blocks, ...) was also tested. It allocated 51,204,608 temporary CUDA bytes in the reordered case because it aligned source values that were immediately replaced. This is why the small location-based fast path and reconstruction path are both present. These are operation timings, not end-to-end estimator speedups.

Not merge-ready on main: the repository type check reports the two missing EnsembleData.execute accesses. All other pre-commit checks pass. On main, the two new integration tests are explicitly skipped until that dependency exists; they are executed against the real #797 backend during manual validation. The dependency failure is not suppressed.

@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

This branch has not been deployed

No deployments
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.

1 participant