Commit 1f9f770
GPU performance optimizations for CUDA and OptiX real-time path tracing and firefly HDRI artifacts (#26)
* Initial plan
* Implement CUDA and OptiX performance optimizations
- Precompute inverse ray direction for BVH traversal (eliminates 3 reciprocal ops per AABB test)
- Add __launch_bounds__(256) to render kernel for better register allocation
- GPU-side converged pixel counting via warp-shuffle reduction (replaces host-side D2H copy)
- Dedicated compute stream for CUDA render kernel (enables overlap with display pipeline)
- OptiX: dedicated CUDA stream for launches (replaces cudaDeviceSynchronize)
- OptiX: GPU-side gamma correction + pinned memory async D2H pipeline
- OptiX: proper resource cleanup for new stream/buffer resources
Co-authored-by: pmudry <4624112+pmudry@users.noreply.github.com>
* Add GPU performance techniques documentation
Create website/docs/how-it-works/gpu-performance.md documenting:
- Precomputed inverse ray direction for BVH traversal
- __launch_bounds__ on render kernel
- GPU-side converged pixel counting (warp-shuffle)
- Dedicated CUDA streams for render and display
- OptiX dedicated render stream
- OptiX GPU-side gamma correction with pinned memory
- Summary comparison table of all techniques
Co-authored-by: pmudry <4624112+pmudry@users.noreply.github.com>
* Add GPU performance techniques docs page (force-add past gitignore)
Co-authored-by: pmudry <4624112+pmudry@users.noreply.github.com>
* Address code review: fix memory leak, extract stream helper, fix doc formatting
- Move d_converged_count from local static to file-scope s_d_converged_count with cleanup
- Add getOptiXStream() helper to reduce stream fallback pattern duplication
- Fix digit grouping in documentation (65,536 instead of 65 536)
Co-authored-by: pmudry <4624112+pmudry@users.noreply.github.com>
* Fixed incoming bugs with shared buffers and init status
* Fixing HDRI firefly problem
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pmudry <4624112+pmudry@users.noreply.github.com>
Co-authored-by: Pierre-André Mudry <pmudry@gmail.com>1 parent adc8301 commit 1f9f770
File tree
10 files changed
+571
-60
lines changed- src/rayon/gpu_renderers
- optix
- shaders
- website
- docs/how-it-works
10 files changed
+571
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
159 | 164 | | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
165 | 171 | | |
166 | | - | |
| 172 | + | |
| 173 | + | |
167 | 174 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 175 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
184 | | - | |
185 | | - | |
186 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
194 | | - | |
195 | | - | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
533 | 535 | | |
534 | 536 | | |
535 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
536 | 542 | | |
537 | 543 | | |
538 | 544 | | |
| |||
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
546 | | - | |
547 | | - | |
| 552 | + | |
| 553 | + | |
548 | 554 | | |
549 | 555 | | |
550 | 556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
548 | 559 | | |
549 | 560 | | |
550 | 561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
98 | 111 | | |
99 | 112 | | |
100 | 113 | | |
| |||
262 | 275 | | |
263 | 276 | | |
264 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
265 | 284 | | |
266 | 285 | | |
267 | 286 | | |
| |||
665 | 684 | | |
666 | 685 | | |
667 | 686 | | |
668 | | - | |
669 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
670 | 690 | | |
671 | 691 | | |
672 | 692 | | |
| |||
721 | 741 | | |
722 | 742 | | |
723 | 743 | | |
724 | | - | |
725 | | - | |
726 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
727 | 749 | | |
728 | | - | |
| 750 | + | |
729 | 751 | | |
730 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
731 | 756 | | |
732 | 757 | | |
733 | 758 | | |
| |||
766 | 791 | | |
767 | 792 | | |
768 | 793 | | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
769 | 866 | | |
770 | 867 | | |
771 | 868 | | |
| |||
861 | 958 | | |
862 | 959 | | |
863 | 960 | | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
864 | 969 | | |
865 | 970 | | |
866 | 971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
57 | 71 | | |
58 | 72 | | |
59 | 73 | | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
63 | 82 | | |
64 | 83 | | |
65 | 84 | | |
| |||
148 | 167 | | |
149 | 168 | | |
150 | 169 | | |
151 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
152 | 174 | | |
153 | 175 | | |
154 | 176 | | |
| |||
381 | 403 | | |
382 | 404 | | |
383 | 405 | | |
384 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
385 | 411 | | |
386 | 412 | | |
387 | 413 | | |
| |||
394 | 420 | | |
395 | 421 | | |
396 | 422 | | |
397 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
398 | 426 | | |
399 | 427 | | |
400 | 428 | | |
| |||
512 | 540 | | |
513 | 541 | | |
514 | 542 | | |
515 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
516 | 546 | | |
517 | 547 | | |
518 | 548 | | |
| |||
529 | 559 | | |
530 | 560 | | |
531 | 561 | | |
532 | | - | |
533 | | - | |
534 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
535 | 573 | | |
536 | 574 | | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 575 | + | |
542 | 576 | | |
543 | 577 | | |
544 | 578 | | |
| |||
0 commit comments