Repository navigation
Add Feature-Extractor-Plugin: Spark expression fusion (batch) and Flink GPU operators (streaming) - #540
Conversation
…usion) An add-on for spark-rapids that fuses chains of row-independent expressions into one generated GPU kernel, with results bit-identical to spark-rapids. Includes the plugin source, build and self-test scripts, design notes and limits, the KuaiRand benchmark cases with real plans and a reproduction guide, and English and Chinese README with figures. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: binc <[email protected]>
…ators) A small Flink GPU operator library (window aggregation and bounded INNER lookup join) that a job calls explicitly, with its native CUDA/JNI layer, qualification and profiling tools, example jobs, the six KuaiRand benchmark cases with real plans, a one-command Mega-Flink build at a pinned commit for reproduction, and design, limits and how-it-works docs. README compares the approach with other Flink acceleration projects and explains when to use the CPU or the GPU. English and Chinese. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: binc <[email protected]>
…-plugin Signed-off-by: binc <[email protected]> # Conflicts: # .pre-commit-config.yaml
[Medium impact] The new GPU paths affect workloads that choose to install or call them. Fix the lost CASE nulls and the false-success test runner before merging. FindingsSummaryAdds independent Spark and Flink GPU examples:
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
S[Spark GPU expressions] --> T[Translate supported expressions]
T --> K[Generate and compile CUDA kernel]
K --> R[Run fused expression]
K --> F[Original expression on failure]
D[Flink DataStream] --> W[GPU window partials]
W --> M[Merge into keyed window state]
D --> L[Bounded dimension lookup]
Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
| def createsNulls(c: Call): Boolean = c.op match { | ||
| case "div" | "idiv" | "rem" | "pmod" | "log" | "logbase" => true | ||
| case "inset" => c.attr.lastOption.contains(java.lang.Boolean.TRUE) // NULL when not found and the list contains NULL | ||
| case _ => false |
There was a problem hiding this comment.
createsNulls misses casewhen without an ELSE. For example, CASE WHEN a > 0 THEN b WHEN a < 0 THEN c END must return NULL when a = 0. When the input columns have no null masks, selfNull stays false and FusionRuntime.run allocates no output null mask. The kernel's placeholder zero then becomes a non-null result, which can also change later counts and calculations.
Mark casewhen without an ELSE as able to create nulls, and add a test with null-free inputs.
| ./gpu-run.sh ${PART:+-p $PART} -t 03:00:00 -- bash -c " | ||
| python3 fz/directed.py --out $OUT/directed --modes $MODES > $OUT/directed.log 2>&1; | ||
| fz/fuzz_loop.sh --data $DATA --out $OUT/fuzz --cases $CASES --seed $SEED --modes $MODES --time-limit 5400 > $OUT/fuzz.log 2>&1; | ||
| [ -f udf/udfs.jar ] || udf/build.sh > $OUT/udf-build.log 2>&1; | ||
| python3 udf/coverage.py --data $DATA --out $OUT/coverage.json --modes $MODES > $OUT/coverage.log 2>&1" | ||
| PYTHONPATH=${PYLIB_DIR:-} python3 fz/report.py $OUT; rc=$? |
There was a problem hiding this comment.
run-all.sh can exit successfully when the tests never ran. Commands inside bash -c ignore earlier failures, and the status from gpu-run.sh is discarded before report.py runs. If the GPU allocation fails, or Spark fails before writing results, report.py skips the missing files and exits zero.
Preserve the test commands' failure status and require the expected reports before declaring success.
Merge main up to 476cdc0: NVIDIA#544 and NVIDIA#547 in DynamicEmb; NVIDIA#535, NVIDIA#537, NVIDIA#539 and NVIDIA#540 outside it. - NVIDIA#544 deduplicates int32 keys as int64 in _dedup_indices and returns them in the input's dtype, as this branch did. The merge keeps main's widening (indices_64bit) and drops this branch's copy of it, so the keys are widened once. It keeps this branch's structure: a sharding on the hierarchical dist keeps its unique keys sized on the device, and TorchRec's dists slice them to the count. The docstring says both. - NVIDIA#544 also bucketizes an int32 key as the int64 key of its value. The hierarchical dist's own bucketize still reads a key in its own width; the next commit gives it int32 keys as int64. - DynamicEmb_APIs.md: main's paragraph on how the rules read a key, then this branch's line that the hierarchical dist takes roundrobin and hash_roundrobin only. - test_sequence_embedding_fw.py and test_twin_module.py: main's int32 runs (NVIDIA#544) and no-grad forward (NVIDIA#547), with this branch's checks that a sharding took the dist it was given (check_path, check_totals). - NVIDIA#547 (a no-grad training forward releases its slot pins, after refreshing its slots past a rehash) merges without conflicts next to this branch's row map and load_from_flat_by. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Description
Adds
examples/Feature-Extractor-Plugin/with two independent parts. English and Chinese docs for both.batch (Spark): an add-on for spark-rapids that fuses chains of row-independent expressions into one generated GPU kernel, with results bit-identical to spark-rapids. Separate jar; spark-rapids is not modified. Includes the plugin source, build and self-test scripts, five KuaiRand cases with real plans, and a reproduction guide.
streaming (Flink): a small Flink GPU operator library (window aggregation and bounded INNER lookup join) that a job calls explicitly from DataStream code, with no planner override. Includes the native CUDA/JNI layer, two example jobs, qualification and profiling tools, six KuaiRand benchmark cases with real plans, and a one-command rebuild of the research plugin Mega-Flink at a pinned commit so all six cases can be rerun. The README compares the approach with other Flink acceleration projects and explains when to use the CPU or the GPU.
Only files under
examples/Feature-Extractor-Plugin/are added, plus one word (ForSt, a Flink state backend name) in the codespell ignore list of.pre-commit-config.yaml.Verification
pre-commithooks (isort, autoflake, codespell, black, mypy) pass on the added Python files.streaming/docs/LIMITS.md.Checklist