Commit 879b1d4
authored
Fix inlining behaviour at the NVVM IR level (#247)
PR #181 aimed to align the behaviour of the `inline` kwarg with that of
upstream Numba, in that it now forces inlining at the Numba IR level.
It turns out that this kwarg in Numba-CUDA already had the prior effect
of enabling inlining at the NVVM IR level.
Because the default value of `inline` is `"never"`, this was interpreted
by the `compile_cuda()` function as a `True`ish value and every device
function got marked with the `alwaysinline` function attribute. This is
a minor problem in that it probably forces a lot of inlining that we
don't want, but also a major problem in that it triggers an NVVM bug
that was only resolved in CUDA 12.3 that causes a hang in
`nvvmCompileProgram()`.
To rectify these issues, we add the `forceinline` kwarg to the
`@cuda.jit` decorator and the `cuda.compile[_*]()` functions. Now,
`compile_cuda()` will only enable inlining at the NVVM IR level for
`forceinline` and not `inline`. This is aligned with the behaviour of
upstream Numba (see numba/numba#10068). We now document the `inline` and
`forceinline` kwargs to clarify the intent and behaviour for users.
For clarity: the behaviour is now:
- The `inline` kwarg enables inlining only at the Numba IR level.
- The `forceinline` kwarg enables inlining only at the NVVM IR level.1 parent 68e86a5 commit 879b1d4
File tree
4 files changed
+138
-7
lines changed- numba_cuda/numba/cuda
- tests/cudapy
4 files changed
+138
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
577 | 578 | | |
578 | 579 | | |
579 | 580 | | |
| |||
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
617 | 623 | | |
618 | 624 | | |
619 | 625 | | |
| |||
626 | 632 | | |
627 | 633 | | |
628 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
629 | 641 | | |
630 | 642 | | |
631 | 643 | | |
| |||
660 | 672 | | |
661 | 673 | | |
662 | 674 | | |
| 675 | + | |
663 | 676 | | |
664 | 677 | | |
665 | 678 | | |
| |||
699 | 712 | | |
700 | 713 | | |
701 | 714 | | |
| 715 | + | |
702 | 716 | | |
703 | 717 | | |
704 | 718 | | |
| |||
716 | 730 | | |
717 | 731 | | |
718 | 732 | | |
| 733 | + | |
719 | 734 | | |
720 | 735 | | |
721 | 736 | | |
| |||
730 | 745 | | |
731 | 746 | | |
732 | 747 | | |
| 748 | + | |
733 | 749 | | |
734 | 750 | | |
735 | 751 | | |
| |||
747 | 763 | | |
748 | 764 | | |
749 | 765 | | |
| 766 | + | |
750 | 767 | | |
751 | 768 | | |
752 | 769 | | |
| |||
760 | 777 | | |
761 | 778 | | |
762 | 779 | | |
| 780 | + | |
763 | 781 | | |
764 | 782 | | |
765 | 783 | | |
| |||
775 | 793 | | |
776 | 794 | | |
777 | 795 | | |
| 796 | + | |
778 | 797 | | |
779 | 798 | | |
780 | 799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| |||
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
| 154 | + | |
143 | 155 | | |
144 | 156 | | |
145 | 157 | | |
| |||
182 | 194 | | |
183 | 195 | | |
184 | 196 | | |
| 197 | + | |
185 | 198 | | |
186 | 199 | | |
187 | 200 | | |
| |||
206 | 219 | | |
207 | 220 | | |
208 | 221 | | |
| 222 | + | |
209 | 223 | | |
210 | 224 | | |
211 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| |||
1073 | 1074 | | |
1074 | 1075 | | |
1075 | 1076 | | |
1076 | | - | |
| 1077 | + | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
| |||
1091 | 1092 | | |
1092 | 1093 | | |
1093 | 1094 | | |
1094 | | - | |
| 1095 | + | |
1095 | 1096 | | |
1096 | 1097 | | |
1097 | 1098 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | | - | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
57 | 154 | | |
58 | 155 | | |
59 | 156 | | |
0 commit comments