Repository navigation
[SPARK-2571] Correctly report shuffle read metrics. - #1476
kayousterhout wants to merge 2 commits into
Conversation
|
QA tests have started for PR 1476. This patch merges cleanly. |
|
QA results for PR 1476: |
|
QA tests have started for PR 1476. This patch merges cleanly. |
There was a problem hiding this comment.
how does this pass unit tests without calling updateShuffleReadMetrics again? It seems to expect 2000 bytes read
There was a problem hiding this comment.
It expects 2000 bytes read because the listener is adding up the total across all tasks in the stage -- so 1000 for the earlier task + 1000 for this task. The lines that I deleted were redundant (remoteBytesRead was already set to 1000 and shuffleReadMetrics had already been set as taskMetrics.shuffleReadMetrics).
There was a problem hiding this comment.
Ahh, gotcha, apologies. Any chance we could get a new unit test for the particular problem in this PR? The changes you added do look correct and verifiable from just reading them, so I'd be fine with this being merged without, but doesn't hurt to ask :)
There was a problem hiding this comment.
The test I changed in SparkListenerSuite tests this problem (since before the test only checked that the value is > 0, and I changed it to test for the correct value -- the updated test fails with the old code). Were you thinking to break this issue out into its own test?
There was a problem hiding this comment.
Gotcha, no, that's fine. Funny that we had the test already but with relaxed constraints.
|
QA results for PR 1476: |
There was a problem hiding this comment.
minor: No need to do this here, since we're creating a TaskMetrics from scratch anyway (though the result should be the same)
There was a problem hiding this comment.
What do you mean here? updateShuffleReadMetrics is the only way to set it right?
|
Couple minor comments, but the changes look good. |
|
Thanks for the review @andrewor14 and @aarondav ! Merged into master (I decided not to back port -- I figured since no one has noticed this bug it's not worth back porting -- but happy to go ahead and do that if someone thinks it's worthwhile). |
Currently, shuffle read metrics are incorrectly reported when stages have multiple shuffle dependencies (they are set to be the metrics from just one of the shuffle dependencies, rather than the accumulated metrics from all of the shuffle dependencies). This fixes that problem, and should probably be back-ported to the 0.9 branch. Thanks ryanra for discovering this problem! cc rxin andrewor14 Author: Kay Ousterhout <kayousterhout@gmail.com> Closes apache#1476 from kayousterhout/join_bug and squashes the following commits: 0203a16 [Kay Ousterhout] Fix broken unit tests. f463c2e [Kay Ousterhout] [SPARK-2571] Correctly report shuffle read metrics. Conflicts: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala core/src/main/scala/org/apache/spark/util/JsonProtocol.scala core/src/test/scala/org/apache/spark/ui/jobs/JobProgressListenerSuite.scala core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala
Currently, shuffle read metrics are incorrectly reported when stages have multiple shuffle dependencies (they are set to be the metrics from just one of the shuffle dependencies, rather than the accumulated metrics from all of the shuffle dependencies). This fixes that problem, and should probably be back-ported to the 0.9 branch. Thanks ryanra for discovering this problem! cc rxin andrewor14 Author: Kay Ousterhout <kayousterhout@gmail.com> Closes apache#1476 from kayousterhout/join_bug and squashes the following commits: 0203a16 [Kay Ousterhout] Fix broken unit tests. f463c2e [Kay Ousterhout] [SPARK-2571] Correctly report shuffle read metrics.
…YC run (apache#1491) ### What changes were proposed in this pull request? This PR commits a second EPYC 7763 runner run of `VarkaWideConversionBenchmark` at both vector widths and records what it shows in row 583 of `sql/varka/plans/m8/PLAN.md`, which it marks Done. It also brings row 600, which cites the same runs, up to date. It changes no code. apache#1476 made two cheaper exact forms the defaults for a `BIGINT` cast to `DOUBLE` and `FLOAT` on x86 hosts without AVX512DQ, where C2 has no instruction for the Vector API's `L2D` and `L2F`: - `L2D` uses the XOR split (`wideConversionForm=XOR_SPLIT`) instead of 343b1's split (`SPLIT`). 343b1's bounded magic (`MAGIC`) stays an option. - `L2F` uses new sign and arm-mask steps (`roundToOddByShifts=false`) instead of 343b1's shifts. Its runner evidence was one run per width: runs 42894474041 (256 bits) and 42894494552 (128 bits, `-XX:MaxVectorSize=16`), committed as `sql/catalyst/benchmarks/VarkaWideConversionBenchmark-jdk25-runner-epyc7763-results.txt` and its `-128bit` twin. The new runs are vecbricks/varka runs 42968007113 (256 bits) and 42968017626 (128 bits, `-XX:MaxVectorSize=16`), both on an AMD EPYC 7763. Their artifacts are committed unchanged as the `-2-` twins of those two files, with their provenance files, which is how row 313 (apache#844) committed a repeated runner run. Both runs were dispatched from master and checked out `refs/pull/1476/head` at `e03d06d58d4`. That commit and the one before it only add results and plan text, so the code under test is the same as in the first pair at `d6208553a03`. The provenance files name the commit. Taking each arm's best time over the two runs (Spark's benchmark computes the Rate column from the best time): | ratio | 256-bit, L2 | 256-bit, L3 | 256-bit, past L3 | 128-bit, L2 | 128-bit, L3 | 128-bit, past L3 | |---|---|---|---|---|---|---| | new `L2F` steps / 343b1's shifts | 1.21 | 1.22 | 1.18 | 1.17 | 1.17 | 1.17 | | bounded magic / XOR split | 1.04 | 1.03 | 1.07 | 0.011 | 0.013 | 0.025 | | XOR split / 343b1's split | 1.69 | 1.68 | 1.02 | 2.38 | 2.03 | 1.24 | - **The `L2F` gain holds.** By the two runs' minimums it is 17 to 22% at every rung and both widths. Its arms moved under 1.5% between the runs. - **At 256 bits the magic stays ahead, but by an unsettled margin.** It leads the XOR split at every rung in both runs. In L3, though, the XOR and magic arms moved 20% and 22% between runs, much more than the lead. The magic is not the default, and the reason is unchanged: it is exact only for rows inside its window, and at 128 bits its range guard runs as the Vector API's Java fallback, at about 40 M rows/s in both runs. - **Past L3 at 256 bits, the XOR split's lead over 343b1's split did not hold.** Run 1 measured 1.05 times. By the minimums it is 1.02 times, and in run 2 the XOR split was 0.4% slower. So the two forms tie there, where every arm is memory-bound. At 128 bits past L3 the lead was 1.24 times in both runs. - **In cache the XOR split's lead stays well above 1.3 times.** At 256 bits run 2 measured 1.69 in L2 and 1.68 in L3, against run 1's 1.85 and 1.45. No default changes. ### Why are the changes needed? `sql/varka/AGENTS.md` requires a second run, compared by minimums, before a claim that rests on a ratio under about 1.3 times is written down. Row 583 recorded the `L2F` gain, the magic's lead and the XOR split's lead past L3 from one runner run per width, and marked them as owed that second run. This PR supplies the second run. Two of the claims hold, at least in direction, and the third (the 256-bit lead past L3) is corrected to a tie. ### Does this PR introduce _any_ user-facing change? No. Results files and plan text only. ### How was this patch tested? - The four new files are the two runs' artifacts, downloaded with `gh run download` and copied without edits. Their provenance files give the CPU (AMD EPYC 7763), the JDK (Zulu 25.0.5), the vector datapath check and the commit checked out. - I computed the ratios by parsing the Rate column of both runs' results files for each arm. - `dev/varka_plan_lint.py --check`, `dev/varka_msg_check.py pr` and `dev/varka_push_check.py` pass. ### Accepted trade-offs and follow-ups - **Row 583 is marked Done.** With apache#1476 merged and this second run recorded, its Done-when conditions are met: both forms are built below level 3, proven exact in `round_to_odd.smt2`, held to Java's casts by the wide-conversion suite, and measured against 343b1's forms on the EPYC 7763 runners, and each replaces its form where it wins. apache#1476's open review items are not Done-when conditions. Among them is the emit budget weighing an `L2D` at the old split's 10 calls although the default emits 8. - **Row 600 is updated.** That row owns `L2F`'s gap to a scalar loop. It now quotes the `L2F` gain as 1.17 to 1.22 times by two-run minimums, and the scalar gap past L3 at 256 bits as 78% (the minimum), not run 1's 79%. It also says the results are on master. - **A `/code-review high` of this change** found misquoted or stale figures in the row text: the magic's L2 lead by minimums (1.04, not 1.05), the `L2F` arms' movement (under 1.5%, not 1%), the L3 spread (20 and 22%), the run-1 in-cache ratios left unrequoted, and the scalar gap given only for the cache rungs. All are fixed. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
Currently, shuffle read metrics are incorrectly reported when stages have multiple shuffle dependencies (they are set to be the metrics from just one of the shuffle dependencies, rather than the accumulated metrics from all of the shuffle dependencies). This fixes that problem, and should probably be back-ported to the 0.9 branch.
Thanks @ryanra for discovering this problem!
cc @rxin @andrewor14