Skip to content

Commit 6b49be0

Browse files
Vendor the annotations module for CUDA-specific refactoring (#463)
I found no standalone tests, however a somewhat related test imports this module. Some test cases from the upstream version did not seem suitable to the CUDA target, so I brought in only a few test cases from upstream. --------- Co-authored-by: Graham Markall <[email protected]>
1 parent e982764 commit 6b49be0

File tree

5 files changed

+579
-1
lines changed

5 files changed

+579
-1
lines changed

numba_cuda/numba/cuda/core/annotations/__init__.py

Whitespace-only changes.
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<html>
2+
3+
<head>
4+
5+
<style>
6+
7+
.annotation_table {
8+
color: #000000;
9+
font-family: monospace;
10+
margin: 5px;
11+
width: 100%;
12+
}
13+
14+
/* override JupyterLab style */
15+
.annotation_table td {
16+
text-align: left;
17+
background-color: transparent;
18+
padding: 1px;
19+
}
20+
21+
.annotation_table code
22+
{
23+
background-color: transparent;
24+
white-space: normal;
25+
}
26+
27+
/* End override JupyterLab style */
28+
29+
tr:hover {
30+
background-color: rgba(92, 200, 249, 0.25);
31+
}
32+
33+
td.object_tag summary ,
34+
td.lifted_tag summary{
35+
font-weight: bold;
36+
display: list-item;
37+
}
38+
39+
span.lifted_tag {
40+
color: #00cc33;
41+
}
42+
43+
span.object_tag {
44+
color: #cc3300;
45+
}
46+
47+
48+
td.lifted_tag {
49+
background-color: #cdf7d8;
50+
}
51+
52+
td.object_tag {
53+
background-color: #ffd3d3;
54+
}
55+
56+
code.ir_code {
57+
color: grey;
58+
font-style: italic;
59+
}
60+
61+
.metadata {
62+
border-bottom: medium solid black;
63+
display: inline-block;
64+
padding: 5px;
65+
width: 100%;
66+
}
67+
68+
.annotations {
69+
padding: 5px;
70+
}
71+
72+
.hidden {
73+
display: none;
74+
}
75+
76+
.buttons {
77+
padding: 10px;
78+
cursor: pointer;
79+
}
80+
81+
</style>
82+
83+
</head>
84+
85+
<body>
86+
87+
{% for func_key in func_data.keys() %}
88+
89+
{% set loop1 = loop %}
90+
91+
<div class="metadata">
92+
Function name: {{func_data[func_key]['funcname']}}<br />
93+
in file: {{func_data[func_key]['filename']}}<br />
94+
with signature: {{func_key[1]|e}}
95+
</div>
96+
97+
<div class="annotations">
98+
99+
<table class="annotation_table tex2jax_ignore">
100+
{%- for num, line in func_data[func_key]['python_lines'] -%}
101+
{%- if func_data[func_key]['ir_lines'][num] %}
102+
<tr><td class="{{func_data[func_key]['python_tags'][num]}}">
103+
<details>
104+
<summary>
105+
<code>
106+
{{num}}:
107+
{{func_data[func_key]['python_indent'][num]}}{{line|e}}
108+
</code>
109+
</summary>
110+
<table class="annotation_table">
111+
<tbody>
112+
{%- for ir_line, ir_line_type in func_data[func_key]['ir_lines'][num] %}
113+
<tr class="ir_code func{{loop1.index0}}_ir">
114+
<td><code>&nbsp;
115+
{{- func_data[func_key]['python_indent'][num]}}
116+
{{func_data[func_key]['ir_indent'][num][loop.index0]}}{{ir_line|e -}}
117+
<span class="object_tag">{{ir_line_type}}</span>
118+
</code>
119+
</td>
120+
</tr>
121+
{%- endfor -%}
122+
</tbody>
123+
</table>
124+
</details>
125+
</td></tr>
126+
{% else -%}
127+
<tr><td style=" padding-left: 22px;" class="{{func_data[func_key]['python_tags'][num]}}">
128+
<code>
129+
{{num}}:
130+
{{func_data[func_key]['python_indent'][num]}}{{line|e}}
131+
</code>
132+
</td></tr>
133+
{%- endif -%}
134+
{%- endfor -%}
135+
</table>
136+
</div>
137+
138+
<br /><br /><br />
139+
140+
{% endfor %}
141+
142+
</body>
143+
144+
</html>

0 commit comments

Comments
 (0)