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

Avoid concatentating multiple host buffers when reading Parquet #11911

Merged
merged 6 commits into from
Jan 14, 2025

Conversation

jlowe
Copy link
Contributor

@jlowe jlowe commented Jan 3, 2025

Depends upon rapidsai/cudf#17673.

Updates the multithreaded Parquet reader to leverage the new multiple host buffers reader interface. This removes the need to concatenate multiple host buffers into a single buffer before decoding the data via the GPU. This also makes it easier to accept "late arrivals" in the multithreaded combine reader after waking up with the GPU semaphore, since we only need to fabricate a new footer to accommodate the additional buffers in the read.

@jlowe jlowe added the cudf_dependency An issue or PR with this label depends on a new feature in cudf label Jan 3, 2025
@jlowe jlowe self-assigned this Jan 3, 2025
@abellina abellina self-requested a review January 3, 2025 16:39
Copy link
Collaborator

@abellina abellina left a comment

Choose a reason for hiding this comment

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

just some nits

@@ -2123,7 +2123,7 @@ class MultiFileCloudOrcPartitionReader(
}
} catch {
case e: Throwable =>
hostBuffers.foreach(_.hmb.safeClose())
hostBuffers.foreach(_.hmbs.foreach(_.safeClose()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not technically part of this PR, but couldn't safeClose throw and then we don't see e? We should probably also use the Seq variant of safeClose(e)

@@ -2737,7 +2713,7 @@ class MultiFileCloudParquetPartitionReader(
}
} catch {
case e: Throwable =>
hostBuffers.foreach(_.hmb.safeClose())
hostBuffers.foreach(_.hmbs.safeClose())
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, could we use safeClose(e)?

revans2
revans2 previously approved these changes Jan 6, 2025
@abellina
Copy link
Collaborator

abellina commented Jan 7, 2025

I was able to run this in one of our performance cluster. I ran the MULTITHREADED reader, and I compared with and without the patch. The benchmark is ~2% faster, though it doesn't detect a significant improvement there, and one query was 40% faster. q9 is on average 11% better, but it's deemed not a significant change.

query1: Previous (1470.6 ms) vs Current (1686.0 ms) Diff -215 E2E 0.87x
query2: Previous (1451.8 ms) vs Current (1506.8 ms) Diff -55 E2E 0.96x
query3: Previous (469.8 ms) vs Current (447.6 ms) Diff 22 E2E 1.05x
query4: Previous (6264.4 ms) vs Current (6166.8 ms) Diff 97 E2E 1.02x
query5: Previous (1265.4 ms) vs Current (1315.0 ms) Diff -49 E2E 0.96x
query6: Previous (859.4 ms) vs Current (819.8 ms) Diff 39 E2E 1.05x
query7: Previous (2664.0 ms) vs Current (2504.2 ms) Diff 159 E2E 1.06x
query8: Previous (1159.6 ms) vs Current (1337.8 ms) Diff -178 E2E 0.87x
query9: Previous (3642.2 ms) vs Current (3276.4 ms) Diff 365 E2E 1.11x
query10: Previous (1259.6 ms) vs Current (1344.0 ms) Diff -84 E2E 0.94x
query11: Previous (3816.0 ms) vs Current (3760.6 ms) Diff 55 E2E 1.01x
query12: Previous (624.2 ms) vs Current (710.4 ms) Diff -86 E2E 0.88x
query13: Previous (1359.0 ms) vs Current (1294.0 ms) Diff 65 E2E 1.05x
query14_part1: Previous (5267.8 ms) vs Current (5241.4 ms) Diff 26 E2E 1.01x
query14_part2: Previous (4502.6 ms) vs Current (5031.6 ms) Diff -529 E2E 0.89x
query15: Previous (973.4 ms) vs Current (946.4 ms) Diff 27 E2E 1.03x
query16: Previous (1409.6 ms) vs Current (1328.0 ms) Diff 81 E2E 1.06x
query17: Previous (1416.0 ms) vs Current (1400.0 ms) Diff 16 E2E 1.01x
query18: Previous (1944.2 ms) vs Current (2080.8 ms) Diff -136 E2E 0.93x
query19: Previous (1178.6 ms) vs Current (1227.4 ms) Diff -48 E2E 0.96x
query20: Previous (651.4 ms) vs Current (637.2 ms) Diff 14 E2E 1.02x
query21: Previous (523.8 ms) vs Current (534.8 ms) Diff -11 E2E 0.98x
query22: Previous (722.0 ms) vs Current (707.0 ms) Diff 15 E2E 1.02x
query23_part1: Previous (7114.2 ms) vs Current (6882.2 ms) Diff 232 E2E 1.03x
query23_part2: Previous (9013.0 ms) vs Current (9117.2 ms) Diff -104 E2E 0.99x
query24_part1: Previous (6237.0 ms) vs Current (6361.8 ms) Diff -124 E2E 0.98x
query24_part2: Previous (5901.8 ms) vs Current (5830.4 ms) Diff 71 E2E 1.01x
query25: Previous (1357.4 ms) vs Current (1365.4 ms) Diff -8 E2E 0.99x
query26: Previous (863.2 ms) vs Current (931.8 ms) Diff -68 E2E 0.93x
query27: Previous (1223.2 ms) vs Current (1063.0 ms) Diff 160 E2E 1.15x
query28: Previous (6162.0 ms) vs Current (5977.8 ms) Diff 184 E2E 1.03x
query29: Previous (1525.4 ms) vs Current (1849.6 ms) Diff -324 E2E 0.82x
query30: Previous (1638.8 ms) vs Current (1791.6 ms) Diff -152 E2E 0.91x
query31: Previous (2487.0 ms) vs Current (2455.0 ms) Diff 32 E2E 1.01x
query32: Previous (820.6 ms) vs Current (833.2 ms) Diff -12 E2E 0.98x
query33: Previous (1299.6 ms) vs Current (1430.6 ms) Diff -131 E2E 0.91x
query34: Previous (1759.6 ms) vs Current (1712.6 ms) Diff 47 E2E 1.03x
query35: Previous (2042.6 ms) vs Current (1778.4 ms) Diff 264 E2E 1.15x
query36: Previous (964.0 ms) vs Current (964.6 ms) Diff 0 E2E 1.00x
query37: Previous (750.0 ms) vs Current (895.4 ms) Diff -145 E2E 0.84x
query38: Previous (2317.6 ms) vs Current (2315.2 ms) Diff 2 E2E 1.00x
query39_part1: Previous (2204.4 ms) vs Current (2100.4 ms) Diff 104 E2E 1.05x
query39_part2: Previous (1226.4 ms) vs Current (1289.6 ms) Diff -63 E2E 0.95x
query40: Previous (958.4 ms) vs Current (1047.4 ms) Diff -89 E2E 0.92x
query41: Previous (362.0 ms) vs Current (377.8 ms) Diff -15 E2E 0.96x
query42: Previous (384.2 ms) vs Current (526.0 ms) Diff -141 E2E 0.73x
query43: Previous (797.8 ms) vs Current (746.4 ms) Diff 51 E2E 1.07x
query44: Previous (725.4 ms) vs Current (919.0 ms) Diff -193 E2E 0.79x
query45: Previous (1014.2 ms) vs Current (968.0 ms) Diff 46 E2E 1.05x
query46: Previous (1401.2 ms) vs Current (1392.6 ms) Diff 8 E2E 1.01x
query47: Previous (1908.4 ms) vs Current (1516.6 ms) Diff 391 E2E 1.26x
query48: Previous (1218.2 ms) vs Current (876.8 ms) Diff 341 E2E 1.39x
query49: Previous (2257.4 ms) vs Current (2110.2 ms) Diff 147 E2E 1.07x
query50: Previous (5246.6 ms) vs Current (5255.8 ms) Diff -9 E2E 1.00x
query51: Previous (2227.4 ms) vs Current (1958.0 ms) Diff 269 E2E 1.14x
query52: Previous (444.0 ms) vs Current (404.4 ms) Diff 39 E2E 1.10x
query53: Previous (667.0 ms) vs Current (674.0 ms) Diff -7 E2E 0.99x
query54: Previous (1301.2 ms) vs Current (1358.4 ms) Diff -57 E2E 0.96x
query55: Previous (402.2 ms) vs Current (410.2 ms) Diff -8 E2E 0.98x
query56: Previous (956.0 ms) vs Current (1017.8 ms) Diff -61 E2E 0.94x
query57: Previous (1510.8 ms) vs Current (1483.0 ms) Diff 27 E2E 1.02x
query58: Previous (1052.6 ms) vs Current (1019.6 ms) Diff 32 E2E 1.03x
query59: Previous (1499.8 ms) vs Current (1491.4 ms) Diff 8 E2E 1.01x
query60: Previous (1412.0 ms) vs Current (1415.2 ms) Diff -3 E2E 1.00x
query61: Previous (1298.4 ms) vs Current (1341.6 ms) Diff -43 E2E 0.97x
query62: Previous (809.4 ms) vs Current (865.2 ms) Diff -55 E2E 0.94x
query63: Previous (870.0 ms) vs Current (802.6 ms) Diff 67 E2E 1.08x
query64: Previous (6640.2 ms) vs Current (6321.0 ms) Diff 319 E2E 1.05x
query65: Previous (2309.0 ms) vs Current (2407.8 ms) Diff -98 E2E 0.96x
query66: Previous (2804.8 ms) vs Current (2708.6 ms) Diff 96 E2E 1.04x
query67: Previous (15981.0 ms) vs Current (15751.4 ms) Diff 229 E2E 1.01x
query68: Previous (1022.4 ms) vs Current (995.4 ms) Diff 27 E2E 1.03x
query69: Previous (1182.4 ms) vs Current (1178.4 ms) Diff 4 E2E 1.00x
query70: Previous (1542.4 ms) vs Current (1472.0 ms) Diff 70 E2E 1.05x
query71: Previous (2422.8 ms) vs Current (2427.8 ms) Diff -5 E2E 1.00x
query72: Previous (2097.2 ms) vs Current (2059.4 ms) Diff 37 E2E 1.02x
query73: Previous (932.2 ms) vs Current (969.0 ms) Diff -36 E2E 0.96x
query74: Previous (3306.0 ms) vs Current (3026.8 ms) Diff 279 E2E 1.09x
query75: Previous (5273.8 ms) vs Current (5310.8 ms) Diff -37 E2E 0.99x
query76: Previous (2409.4 ms) vs Current (2240.0 ms) Diff 169 E2E 1.08x
query77: Previous (1069.8 ms) vs Current (1021.2 ms) Diff 48 E2E 1.05x
query78: Previous (4303.8 ms) vs Current (4026.6 ms) Diff 277 E2E 1.07x
query79: Previous (1071.6 ms) vs Current (1126.0 ms) Diff -54 E2E 0.95x
query80: Previous (6039.8 ms) vs Current (4243.0 ms) Diff 1796 E2E 1.42x
query81: Previous (1931.6 ms) vs Current (1952.4 ms) Diff -20 E2E 0.99x
query82: Previous (1807.4 ms) vs Current (1496.6 ms) Diff 310 E2E 1.21x
query83: Previous (750.8 ms) vs Current (759.8 ms) Diff -9 E2E 0.99x
query84: Previous (919.4 ms) vs Current (829.8 ms) Diff 89 E2E 1.11x
query85: Previous (1448.6 ms) vs Current (1473.6 ms) Diff -25 E2E 0.98x
query86: Previous (859.0 ms) vs Current (892.2 ms) Diff -33 E2E 0.96x
query87: Previous (2394.2 ms) vs Current (2229.4 ms) Diff 164 E2E 1.07x
query88: Previous (3284.4 ms) vs Current (3397.8 ms) Diff -113 E2E 0.97x
query89: Previous (842.8 ms) vs Current (837.2 ms) Diff 5 E2E 1.01x
query90: Previous (641.8 ms) vs Current (608.0 ms) Diff 33 E2E 1.06x
query91: Previous (979.4 ms) vs Current (957.8 ms) Diff 21 E2E 1.02x
query92: Previous (619.4 ms) vs Current (527.6 ms) Diff 91 E2E 1.17x
query93: Previous (3983.8 ms) vs Current (4157.0 ms) Diff -173 E2E 0.96x
query94: Previous (1784.0 ms) vs Current (1749.2 ms) Diff 34 E2E 1.02x
query95: Previous (4024.6 ms) vs Current (3625.4 ms) Diff 399 E2E 1.11x
query96: Previous (4547.0 ms) vs Current (4651.6 ms) Diff -104 E2E 0.98x
query97: Previous (1363.6 ms) vs Current (1344.8 ms) Diff 18 E2E 1.01x
query98: Previous (1251.4 ms) vs Current (1151.2 ms) Diff 100 E2E 1.09x
query99: Previous (1208.4 ms) vs Current (1234.2 ms) Diff -25 E2E 0.98x
benchmark: Previous (228400.0 ms) vs Current (224400.0 ms) Diff 4000 E2E 1.02x

--------------------------------------------------------------------
Name = query80
Means = 6039.8, 4243.0
Time diff = 1796.8000000000002
Speedup = 1.4234739571058215
T-Test (test statistic, p value, df) = 16.451246579174136, 1.8796271170631424e-07, 8.0
T-Test Confidence Interval = 1544.9389504318738, 2048.6610495681266
ALERT: significant change has been detected (p-value < 0.05)
ALERT: improvement in performance has been observed

abellina
abellina previously approved these changes Jan 7, 2025
@abellina
Copy link
Collaborator

abellina commented Jan 8, 2025

I'll resolve conflicts.

@abellina abellina dismissed stale reviews from revans2 and themself via a927711 January 8, 2025 14:55
@abellina
Copy link
Collaborator

abellina commented Jan 8, 2025

build

revans2
revans2 previously approved these changes Jan 8, 2025
@abellina
Copy link
Collaborator

abellina commented Jan 8, 2025

build

revans2
revans2 previously approved these changes Jan 8, 2025
@abellina
Copy link
Collaborator

abellina commented Jan 8, 2025

Seeing a segfault here all around avro.

Fix issue in GpuAvroScan.readBatches
@abellina
Copy link
Collaborator

ok I reproed an issue locally, and fixed it here: 675fe5f

Will re-run CI

@abellina
Copy link
Collaborator

build

@abellina abellina merged commit 03b85b1 into NVIDIA:branch-25.02 Jan 14, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf_dependency An issue or PR with this label depends on a new feature in cudf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants