numba-cuda 0.18.1__py3-none-any.whl → 0.19.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of numba-cuda might be problematic. Click here for more details.

Files changed (88) hide show
  1. numba_cuda/VERSION +1 -1
  2. numba_cuda/numba/cuda/__init__.py +1 -1
  3. numba_cuda/numba/cuda/_internal/cuda_bf16.py +2 -2
  4. numba_cuda/numba/cuda/_internal/cuda_fp16.py +1 -1
  5. numba_cuda/numba/cuda/api.py +2 -7
  6. numba_cuda/numba/cuda/compiler.py +7 -4
  7. numba_cuda/numba/cuda/core/interpreter.py +3592 -0
  8. numba_cuda/numba/cuda/core/ir_utils.py +2645 -0
  9. numba_cuda/numba/cuda/core/sigutils.py +55 -0
  10. numba_cuda/numba/cuda/cuda_paths.py +9 -17
  11. numba_cuda/numba/cuda/cudadecl.py +1 -1
  12. numba_cuda/numba/cuda/cudadrv/driver.py +4 -19
  13. numba_cuda/numba/cuda/cudadrv/libs.py +1 -2
  14. numba_cuda/numba/cuda/cudadrv/nvrtc.py +44 -44
  15. numba_cuda/numba/cuda/cudadrv/nvvm.py +3 -18
  16. numba_cuda/numba/cuda/cudadrv/runtime.py +12 -1
  17. numba_cuda/numba/cuda/cudamath.py +1 -1
  18. numba_cuda/numba/cuda/decorators.py +4 -3
  19. numba_cuda/numba/cuda/deviceufunc.py +2 -1
  20. numba_cuda/numba/cuda/dispatcher.py +3 -2
  21. numba_cuda/numba/cuda/extending.py +1 -1
  22. numba_cuda/numba/cuda/itanium_mangler.py +211 -0
  23. numba_cuda/numba/cuda/libdevicedecl.py +1 -1
  24. numba_cuda/numba/cuda/libdevicefuncs.py +1 -1
  25. numba_cuda/numba/cuda/lowering.py +1 -1
  26. numba_cuda/numba/cuda/simulator/api.py +1 -1
  27. numba_cuda/numba/cuda/simulator/cudadrv/driver.py +0 -7
  28. numba_cuda/numba/cuda/target.py +1 -2
  29. numba_cuda/numba/cuda/testing.py +4 -6
  30. numba_cuda/numba/cuda/tests/core/test_itanium_mangler.py +80 -0
  31. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +1 -1
  32. numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +1 -1
  33. numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +1 -1
  34. numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +1 -1
  35. numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +1 -1
  36. numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +1 -1
  37. numba_cuda/numba/cuda/tests/cudadrv/test_mvc.py +1 -1
  38. numba_cuda/numba/cuda/tests/cudadrv/test_nvrtc.py +4 -6
  39. numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +0 -4
  40. numba_cuda/numba/cuda/tests/cudadrv/test_ptds.py +1 -1
  41. numba_cuda/numba/cuda/tests/cudapy/test_bfloat16.py +1 -3
  42. numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +1 -3
  43. numba_cuda/numba/cuda/tests/cudapy/test_caching.py +146 -3
  44. numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +1 -1
  45. numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +0 -4
  46. numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +1 -1
  47. numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +1 -1
  48. numba_cuda/numba/cuda/tests/cudapy/test_debug.py +1 -1
  49. numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +1 -284
  50. numba_cuda/numba/cuda/tests/cudapy/test_debuginfo_types.py +473 -0
  51. numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +1 -1
  52. numba_cuda/numba/cuda/tests/cudapy/test_errors.py +1 -1
  53. numba_cuda/numba/cuda/tests/cudapy/test_extending.py +1 -6
  54. numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +1 -1
  55. numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +1 -1
  56. numba_cuda/numba/cuda/tests/cudapy/test_ir_utils.py +295 -0
  57. numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +1 -1
  58. numba_cuda/numba/cuda/tests/cudapy/test_operator.py +1 -1
  59. numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +1 -1
  60. numba_cuda/numba/cuda/tests/cudapy/test_warning.py +5 -1
  61. numba_cuda/numba/cuda/tests/doc_examples/test_cpointer.py +1 -1
  62. numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +1 -1
  63. numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +1 -1
  64. numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +1 -1
  65. numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +1 -1
  66. numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +1 -1
  67. numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +1 -1
  68. numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +1 -1
  69. numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +1 -1
  70. numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +1 -1
  71. numba_cuda/numba/cuda/tests/nocuda/test_import.py +1 -1
  72. numba_cuda/numba/cuda/tests/nrt/test_nrt.py +2 -2
  73. numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +1 -1
  74. numba_cuda/numba/cuda/tests/support.py +752 -0
  75. numba_cuda/numba/cuda/tests/test_binary_generation/Makefile +3 -3
  76. numba_cuda/numba/cuda/tests/test_binary_generation/generate_raw_ltoir.py +4 -1
  77. numba_cuda/numba/cuda/typing/__init__.py +8 -0
  78. numba_cuda/numba/cuda/typing/templates.py +1453 -0
  79. numba_cuda/numba/cuda/vector_types.py +3 -3
  80. {numba_cuda-0.18.1.dist-info → numba_cuda-0.19.0.dist-info}/METADATA +21 -28
  81. {numba_cuda-0.18.1.dist-info → numba_cuda-0.19.0.dist-info}/RECORD +84 -79
  82. numba_cuda/numba/cuda/include/11/cuda_bf16.h +0 -3749
  83. numba_cuda/numba/cuda/include/11/cuda_bf16.hpp +0 -2683
  84. numba_cuda/numba/cuda/include/11/cuda_fp16.h +0 -3794
  85. numba_cuda/numba/cuda/include/11/cuda_fp16.hpp +0 -2614
  86. {numba_cuda-0.18.1.dist-info → numba_cuda-0.19.0.dist-info}/WHEEL +0 -0
  87. {numba_cuda-0.18.1.dist-info → numba_cuda-0.19.0.dist-info}/licenses/LICENSE +0 -0
  88. {numba_cuda-0.18.1.dist-info → numba_cuda-0.19.0.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,9 @@ import os
3
3
  import shutil
4
4
  import unittest
5
5
  import warnings
6
+ import sys
7
+ import stat
8
+ import subprocess
6
9
 
7
10
  from numba import cuda
8
11
  from numba.core.errors import NumbaWarning
@@ -14,12 +17,152 @@ from numba.cuda.testing import (
14
17
  skip_if_mvc_enabled,
15
18
  test_data_dir,
16
19
  )
17
- from numba.tests.test_caching import (
18
- DispatcherCacheUsecasesTest,
19
- skip_bad_access,
20
+ from numba.cuda.tests.support import (
21
+ TestCase,
22
+ temp_directory,
23
+ import_dynamic,
20
24
  )
21
25
 
22
26
 
27
+ class BaseCacheTest(TestCase):
28
+ # The source file that will be copied
29
+ usecases_file = None
30
+ # Make sure this doesn't conflict with another module
31
+ modname = None
32
+
33
+ def setUp(self):
34
+ self.tempdir = temp_directory("test_cache")
35
+ sys.path.insert(0, self.tempdir)
36
+ self.modfile = os.path.join(self.tempdir, self.modname + ".py")
37
+ self.cache_dir = os.path.join(self.tempdir, "__pycache__")
38
+ shutil.copy(self.usecases_file, self.modfile)
39
+ os.chmod(self.modfile, stat.S_IREAD | stat.S_IWRITE)
40
+ self.maxDiff = None
41
+
42
+ def tearDown(self):
43
+ sys.modules.pop(self.modname, None)
44
+ sys.path.remove(self.tempdir)
45
+
46
+ def import_module(self):
47
+ # Import a fresh version of the test module. All jitted functions
48
+ # in the test module will start anew and load overloads from
49
+ # the on-disk cache if possible.
50
+ old = sys.modules.pop(self.modname, None)
51
+ if old is not None:
52
+ # Make sure cached bytecode is removed
53
+ cached = [old.__cached__]
54
+ for fn in cached:
55
+ try:
56
+ os.unlink(fn)
57
+ except FileNotFoundError:
58
+ pass
59
+ mod = import_dynamic(self.modname)
60
+ self.assertEqual(mod.__file__.rstrip("co"), self.modfile)
61
+ return mod
62
+
63
+ def cache_contents(self):
64
+ try:
65
+ return [
66
+ fn
67
+ for fn in os.listdir(self.cache_dir)
68
+ if not fn.endswith((".pyc", ".pyo"))
69
+ ]
70
+ except FileNotFoundError:
71
+ return []
72
+
73
+ def get_cache_mtimes(self):
74
+ return dict(
75
+ (fn, os.path.getmtime(os.path.join(self.cache_dir, fn)))
76
+ for fn in sorted(self.cache_contents())
77
+ )
78
+
79
+ def check_pycache(self, n):
80
+ c = self.cache_contents()
81
+ self.assertEqual(len(c), n, c)
82
+
83
+ def dummy_test(self):
84
+ pass
85
+
86
+
87
+ class DispatcherCacheUsecasesTest(BaseCacheTest):
88
+ here = os.path.dirname(__file__)
89
+ usecases_file = os.path.join(here, "cache_usecases.py")
90
+ modname = "dispatcher_caching_test_fodder"
91
+
92
+ def run_in_separate_process(self, *, envvars={}):
93
+ # Cached functions can be run from a distinct process.
94
+ # Also stresses issue #1603: uncached function calling cached function
95
+ # shouldn't fail compiling.
96
+ code = """if 1:
97
+ import sys
98
+
99
+ sys.path.insert(0, %(tempdir)r)
100
+ mod = __import__(%(modname)r)
101
+ mod.self_test()
102
+ """ % dict(tempdir=self.tempdir, modname=self.modname)
103
+
104
+ subp_env = os.environ.copy()
105
+ subp_env.update(envvars)
106
+ popen = subprocess.Popen(
107
+ [sys.executable, "-c", code],
108
+ stdout=subprocess.PIPE,
109
+ stderr=subprocess.PIPE,
110
+ env=subp_env,
111
+ )
112
+ out, err = popen.communicate()
113
+ if popen.returncode != 0:
114
+ raise AssertionError(
115
+ "process failed with code %s: \n"
116
+ "stdout follows\n%s\n"
117
+ "stderr follows\n%s\n"
118
+ % (popen.returncode, out.decode(), err.decode()),
119
+ )
120
+
121
+ def check_hits(self, func, hits, misses=None):
122
+ st = func.stats
123
+ self.assertEqual(sum(st.cache_hits.values()), hits, st.cache_hits)
124
+ if misses is not None:
125
+ self.assertEqual(
126
+ sum(st.cache_misses.values()), misses, st.cache_misses
127
+ )
128
+
129
+
130
+ def check_access_is_preventable():
131
+ # This exists to check whether it is possible to prevent access to
132
+ # a file/directory through the use of `chmod 500`. If a user has
133
+ # elevated rights (e.g. root) then writes are likely to be possible
134
+ # anyway. Tests that require functioning access prevention are
135
+ # therefore skipped based on the result of this check.
136
+ tempdir = temp_directory("test_cache")
137
+ test_dir = os.path.join(tempdir, "writable_test")
138
+ os.mkdir(test_dir)
139
+ # check a write is possible
140
+ with open(os.path.join(test_dir, "write_ok"), "wt") as f:
141
+ f.write("check1")
142
+ # now forbid access
143
+ os.chmod(test_dir, 0o500)
144
+ try:
145
+ with open(os.path.join(test_dir, "write_forbidden"), "wt") as f:
146
+ f.write("check2")
147
+ # access prevention is not possible
148
+ return False
149
+ except PermissionError:
150
+ # Check that the cause of the exception is due to access/permission
151
+ # as per
152
+ # https://github.com/conda/conda/blob/4.5.0/conda/gateways/disk/permissions.py#L35-L37 # noqa: E501
153
+ # errno reports access/perm fail so access prevention via
154
+ # `chmod 500` works for this user.
155
+ return True
156
+ finally:
157
+ os.chmod(test_dir, 0o775)
158
+ shutil.rmtree(test_dir)
159
+
160
+
161
+ _access_preventable = check_access_is_preventable()
162
+ _access_msg = "Cannot create a directory to which writes are preventable"
163
+ skip_bad_access = unittest.skipUnless(_access_preventable, _access_msg)
164
+
165
+
23
166
  @skip_on_cudasim("Simulator does not implement caching")
24
167
  class CUDACachingTest(DispatcherCacheUsecasesTest):
25
168
  here = os.path.dirname(__file__)
@@ -7,7 +7,7 @@ from numba.cuda.testing import (
7
7
  unittest,
8
8
  CUDATestCase,
9
9
  )
10
- from numba.tests.support import skip_unless_cffi
10
+ from numba.cuda.tests.support import skip_unless_cffi
11
11
 
12
12
 
13
13
  @skip_unless_cffi
@@ -6,7 +6,6 @@ from numba.cuda import (
6
6
  compile_ptx,
7
7
  compile_ptx_for_current_device,
8
8
  )
9
- from numba.cuda.cudadrv import runtime
10
9
  from numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase
11
10
 
12
11
 
@@ -226,9 +225,6 @@ class TestCompile(unittest.TestCase):
226
225
  )
227
226
 
228
227
  def test_compile_to_ltoir(self):
229
- if runtime.get_version() < (11, 5):
230
- self.skipTest("-gen-lto unavailable in this toolkit version")
231
-
232
228
  ltoir, resty = compile(
233
229
  f_module, int32(int32, int32), device=True, output="ltoir"
234
230
  )
@@ -4,7 +4,7 @@ from numba import vectorize, guvectorize
4
4
  from numba import cuda
5
5
  from numba.cuda.testing import unittest, ContextResettingTestCase, ForeignArray
6
6
  from numba.cuda.testing import skip_on_cudasim, skip_if_external_memmgr
7
- from numba.tests.support import linux_only, override_config
7
+ from numba.cuda.tests.support import linux_only, override_config
8
8
  from unittest.mock import call, patch
9
9
 
10
10
 
@@ -1,7 +1,7 @@
1
1
  from numba import cuda
2
2
  import numpy as np
3
3
  from numba.cuda.testing import CUDATestCase
4
- from numba.tests.support import override_config
4
+ from numba.cuda.tests.support import override_config
5
5
  import unittest
6
6
 
7
7
 
@@ -2,7 +2,7 @@ import numpy as np
2
2
 
3
3
  from numba.core.utils import PYVERSION
4
4
  from numba.cuda.testing import skip_on_cudasim, CUDATestCase
5
- from numba.tests.support import (
5
+ from numba.cuda.tests.support import (
6
6
  override_config,
7
7
  captured_stderr,
8
8
  captured_stdout,
@@ -1,4 +1,4 @@
1
- from numba.tests.support import override_config, captured_stdout
1
+ from numba.cuda.tests.support import override_config, captured_stdout
2
2
  from numba.cuda.testing import skip_on_cudasim
3
3
  from numba import cuda
4
4
  from numba.core import types
@@ -501,289 +501,6 @@ class TestCudaDebugInfo(CUDATestCase):
501
501
  ir = foo.inspect_llvm()[sig]
502
502
  self.assertFileCheckMatches(ir, foo.__doc__)
503
503
 
504
- def test_DITypes(self):
505
- """Tests that DITypes are emitted for the types used in the kernel."""
506
- sig = (
507
- types.float32,
508
- types.float64,
509
- types.int8,
510
- types.int16,
511
- types.int32,
512
- types.int64,
513
- types.uint8,
514
- types.uint16,
515
- types.uint32,
516
- types.uint64,
517
- types.complex64,
518
- types.complex128,
519
- )
520
-
521
- @cuda.jit(sig, debug=True)
522
- def foo(a, b, c, d, e, f, g, h, i, j, k, l):
523
- """
524
- CHECK: [[DBG1:.+]] = !DIBasicType(encoding: DW_ATE_boolean, name: "i8", size: 8)
525
- CHECK: [[DBG2:.+]] = !DIDerivedType(
526
- CHECK-SAME: baseType: [[DBG1]]
527
- CHECK-SAME: size: 64
528
- CHECK-SAME: tag: DW_TAG_pointer_type
529
- CHECK: [[DBG3:.+]] = !DIDerivedType(
530
- CHECK-SAME: baseType: [[DBG2]]
531
- CHECK-SAME: size: 64
532
- CHECK-SAME: tag: DW_TAG_pointer_type
533
- CHECK: [[DBG4:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float32", size: 32)
534
- CHECK: [[DBG5:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float64", size: 64)
535
- CHECK: [[DBG6:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int8", size: 8)
536
- CHECK: [[DBG7:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int16", size: 16)
537
- CHECK: [[DBG8:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int32", size: 32)
538
- CHECK: [[DBG9:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int64", size: 64)
539
- CHECK: [[DBG10:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint8", size: 8)
540
- CHECK: [[DBG11:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint16", size: 16)
541
- CHECK: [[DBG12:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint32", size: 32)
542
- CHECK: [[DBG13:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint64", size: 64)
543
- CHECK: [[DBG14:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float", size: 32)
544
- CHECK: [[DBG15:.+]] = !DIDerivedType(
545
- CHECK-SAME: baseType: [[DBG14]]
546
- CHECK-SAME: name: "real"
547
- CHECK-SAME: offset: 0
548
- CHECK-SAME: size: 32
549
- CHECK-SAME: tag: DW_TAG_member
550
- CHECK: [[DBG16:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float", size: 32)
551
- CHECK: [[DBG17:.+]] = !DIDerivedType(
552
- CHECK-SAME: baseType: [[DBG16]]
553
- CHECK-SAME: name: "imag"
554
- CHECK-SAME: offset: 32
555
- CHECK-SAME: size: 32
556
- CHECK-SAME: tag: DW_TAG_member
557
- CHECK: [[DBG18:.+]] = !{ [[DBG15]], [[DBG17]] }
558
- CHECK: [[DBG19:.+]] = distinct !DICompositeType(
559
- CHECK-SAME: elements: [[DBG18]]
560
- CHECK-SAME: name: "complex64 ({float, float})"
561
- CHECK-SAME: size: 64
562
- CHECK-SAME: tag: DW_TAG_structure_type
563
- CHECK: [[DBG20:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "double", size: 64)
564
- CHECK: [[DBG21:.+]] = !DIDerivedType(
565
- CHECK-SAME: baseType: [[DBG20]]
566
- CHECK-SAME: name: "real"
567
- CHECK-SAME: offset: 0
568
- CHECK-SAME: size: 64
569
- CHECK-SAME: tag: DW_TAG_member
570
- CHECK: [[DBG22:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "double", size: 64)
571
- CHECK: [[DBG23:.+]] = !DIDerivedType(
572
- CHECK-SAME: baseType: [[DBG22]]
573
- CHECK-SAME: name: "imag"
574
- CHECK-SAME: offset: 64
575
- CHECK-SAME: size: 64
576
- CHECK-SAME: tag: DW_TAG_member
577
- CHECK: [[DBG24:.+]] = !{ [[DBG21]], [[DBG23]] }
578
- CHECK: [[DBG25:.+]] = distinct !DICompositeType(
579
- CHECK-SAME: elements: [[DBG24]]
580
- CHECK-SAME: name: "complex128 ({double, double})"
581
- CHECK-SAME: size: 128
582
- CHECK-SAME: tag: DW_TAG_structure_type
583
- CHECK: [[DBG32:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float32", size: 32)
584
- CHECK: [[DBG33:.+]] = !DILocalVariable(
585
- CHECK-SAME: name: "a"
586
- CHECK-SAME: type: [[DBG32]]
587
- CHECK: [[DBG34:.+]] = !DIExpression()
588
- CHECK: [[DBG35:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float64", size: 64)
589
- CHECK: [[DBG36:.+]] = !DILocalVariable(
590
- CHECK-SAME: name: "b"
591
- CHECK-SAME: type: [[DBG35]]
592
- CHECK: [[DBG37:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int8", size: 8)
593
- CHECK: [[DBG38:.+]] = !DILocalVariable(
594
- CHECK-SAME: name: "c"
595
- CHECK-SAME: type: [[DBG37]]
596
- CHECK: [[DBG39:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int16", size: 16)
597
- CHECK: [[DBG40:.+]] = !DILocalVariable(
598
- CHECK-SAME: name: "d"
599
- CHECK-SAME: type: [[DBG39]]
600
- CHECK: [[DBG41:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int32", size: 32)
601
- CHECK: [[DBG42:.+]] = !DILocalVariable(
602
- CHECK-SAME: name: "e"
603
- CHECK-SAME: type: [[DBG41]]
604
- CHECK: [[DBG43:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int64", size: 64)
605
- CHECK: [[DBG44:.+]] = !DILocalVariable(
606
- CHECK-SAME: name: "f"
607
- CHECK-SAME: type: [[DBG43]]
608
- CHECK: [[DBG45:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint8", size: 8)
609
- CHECK: [[DBG46:.+]] = !DILocalVariable(
610
- CHECK-SAME: name: "g"
611
- CHECK-SAME: type: [[DBG45]]
612
- CHECK: [[DBG47:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint16", size: 16)
613
- CHECK: [[DBG48:.+]] = !DILocalVariable(
614
- CHECK-SAME: name: "h"
615
- CHECK-SAME: type: [[DBG47]]
616
- CHECK: [[DBG49:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint32", size: 32)
617
- CHECK: [[DBG50:.+]] = !DILocalVariable(
618
- CHECK-SAME: name: "i"
619
- CHECK-SAME: type: [[DBG49]]
620
- CHECK: [[DBG51:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "uint64", size: 64)
621
- CHECK: [[DBG52:.+]] = !DILocalVariable(
622
- CHECK-SAME: name: "j"
623
- CHECK-SAME: type: [[DBG51]]
624
- CHECK: [[DBG53:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float", size: 32)
625
- CHECK: [[DBG54:.+]] = !DIDerivedType(
626
- CHECK-SAME: baseType: [[DBG53]]
627
- CHECK-SAME: name: "real"
628
- CHECK-SAME: offset: 0
629
- CHECK-SAME: size: 32
630
- CHECK-SAME: tag: DW_TAG_member
631
- CHECK: [[DBG55:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float", size: 32)
632
- CHECK: [[DBG56:.+]] = !DIDerivedType(
633
- CHECK-SAME: baseType: [[DBG55]]
634
- CHECK-SAME: name: "imag"
635
- CHECK-SAME: offset: 32
636
- CHECK-SAME: size: 32
637
- CHECK-SAME: tag: DW_TAG_member
638
- CHECK: [[DBG57:.+]] = !{ [[DBG54]], [[DBG56]] }
639
- CHECK: [[DBG58:.+]] = distinct !DICompositeType(
640
- CHECK-SAME: elements: [[DBG57]]
641
- CHECK-SAME: name: "complex64 ({float, float})"
642
- CHECK-SAME: size: 64
643
- CHECK-SAME: tag: DW_TAG_structure_type
644
- CHECK: [[DBG59:.+]] = !DILocalVariable(
645
- CHECK-SAME: name: "k"
646
- CHECK-SAME: type: [[DBG58]]
647
- CHECK: [[DBG60:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "double", size: 64)
648
- CHECK: [[DBG61:.+]] = !DIDerivedType(
649
- CHECK-SAME: baseType: [[DBG60]]
650
- CHECK-SAME: name: "real"
651
- CHECK-SAME: offset: 0
652
- CHECK-SAME: size: 64
653
- CHECK-SAME: tag: DW_TAG_member
654
- CHECK: [[DBG62:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "double", size: 64)
655
- CHECK: [[DBG63:.+]] = !DIDerivedType(
656
- CHECK-SAME: baseType: [[DBG62]]
657
- CHECK-SAME: name: "imag"
658
- CHECK-SAME: offset: 64
659
- CHECK-SAME: size: 64
660
- CHECK-SAME: tag: DW_TAG_member
661
- CHECK: [[DBG64:.+]] = !{ [[DBG61]], [[DBG63]] }
662
- CHECK: [[DBG65:.+]] = distinct !DICompositeType(
663
- CHECK-SAME: elements: [[DBG64]]
664
- CHECK-SAME: name: "complex128 ({double, double})"
665
- CHECK-SAME: size: 128
666
- CHECK-SAME: tag: DW_TAG_structure_type
667
- CHECK: [[DBG66:.+]] = !DILocalVariable(
668
- CHECK-SAME: name: "l"
669
- CHECK-SAME: type: [[DBG65]]
670
- """
671
- pass
672
-
673
- ir = foo.inspect_llvm()[sig]
674
- self.assertFileCheckMatches(ir, foo.__doc__)
675
-
676
- def test_arrays(self):
677
- """Tests that arrays are emitted as DIBasicType."""
678
- sig = (types.float32[::1],)
679
-
680
- @cuda.jit(sig, debug=True)
681
- def foo(a):
682
- """
683
- CHECK: distinct !DICompileUnit
684
- CHECK: distinct !DISubprogram
685
- CHECK: [[DBG127:.+]] = !DIBasicType(encoding: DW_ATE_boolean, name: "i8", size: 8)
686
- CHECK: [[DBG128:.+]] = !DIDerivedType(
687
- CHECK-SAME: baseType: [[DBG127]]
688
- CHECK-SAME: size: 64
689
- CHECK-SAME: tag: DW_TAG_pointer_type
690
- CHECK-SAME: )
691
- CHECK: [[DBG129:.+]] = !DIDerivedType(
692
- CHECK-SAME: baseType: [[DBG128]]
693
- CHECK-SAME: name: "meminfo"
694
- CHECK-SAME: offset: 0
695
- CHECK-SAME: size: 64
696
- CHECK-SAME: tag: DW_TAG_member
697
- CHECK-SAME: )
698
- CHECK: [[DBG130:.+]] = !DIBasicType(encoding: DW_ATE_boolean, name: "i8", size: 8)
699
- CHECK: [[DBG131:.+]] = !DIDerivedType(
700
- CHECK-SAME: baseType: [[DBG130]]
701
- CHECK-SAME: size: 64
702
- CHECK-SAME: tag: DW_TAG_pointer_type
703
- CHECK-SAME: )
704
- CHECK: [[DBG132:.+]] = !DIDerivedType(
705
- CHECK-SAME: baseType: [[DBG131]]
706
- CHECK-SAME: name: "parent"
707
- CHECK-SAME: offset: 64
708
- CHECK-SAME: size: 64
709
- CHECK-SAME: tag: DW_TAG_member
710
- CHECK-SAME: )
711
- CHECK: [[DBG133:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int64", size: 64)
712
- CHECK: [[DBG134:.+]] = !DIDerivedType(
713
- CHECK-SAME: baseType: [[DBG133]]
714
- CHECK-SAME: name: "nitems"
715
- CHECK-SAME: offset: 128
716
- CHECK-SAME: size: 64
717
- CHECK-SAME: tag: DW_TAG_member
718
- CHECK-SAME: )
719
- CHECK: [[DBG135:.+]] = !DIBasicType(encoding: DW_ATE_signed, name: "int64", size: 64)
720
- CHECK: [[DBG136:.+]] = !DIDerivedType(
721
- CHECK-SAME: baseType: [[DBG135]]
722
- CHECK-SAME: name: "itemsize"
723
- CHECK-SAME: offset: 192
724
- CHECK-SAME: size: 64
725
- CHECK-SAME: tag: DW_TAG_member
726
- CHECK-SAME: )
727
- CHECK: [[DBG137:.+]] = !DIBasicType(encoding: DW_ATE_float, name: "float32", size: 32)
728
- CHECK: [[DBG138:.+]] = !DIDerivedType(
729
- CHECK-SAME: baseType: [[DBG137]]
730
- CHECK-SAME: size: 64
731
- CHECK-SAME: tag: DW_TAG_pointer_type
732
- CHECK-SAME: )
733
- CHECK: [[DBG139:.+]] = !DIDerivedType(
734
- CHECK-SAME: baseType: [[DBG138]]
735
- CHECK-SAME: name: "data"
736
- CHECK-SAME: offset: 256
737
- CHECK-SAME: size: 64
738
- CHECK-SAME: tag: DW_TAG_member
739
- CHECK-SAME: )
740
- CHECK: [[DBG140:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "i64", size: 64)
741
- CHECK: [[DBG141:.+]] = !DICompositeType(
742
- CHECK-SAME: baseType: [[DBG140]]
743
- CHECK-SAME: identifier: "[1 x i64]"
744
- CHECK-SAME: name: "UniTuple(int64 x 1) ([1 x i64])"
745
- CHECK-SAME: tag: DW_TAG_array_type
746
- CHECK-SAME: )
747
- CHECK: [[DBG142:.+]] = !DIDerivedType(
748
- CHECK-SAME: baseType: [[DBG141]]
749
- CHECK-SAME: name: "shape"
750
- CHECK-SAME: offset: 320
751
- CHECK-SAME: size: 64
752
- CHECK-SAME: tag: DW_TAG_member
753
- CHECK-SAME: )
754
- CHECK: [[DBG143:.+]] = !DIBasicType(encoding: DW_ATE_unsigned, name: "i64", size: 64)
755
- CHECK: [[DBG144:.+]] = !DICompositeType(
756
- CHECK-SAME: baseType: [[DBG143]]
757
- CHECK-SAME: identifier: "[1 x i64]"
758
- CHECK-SAME: name: "UniTuple(int64 x 1) ([1 x i64])"
759
- CHECK-SAME: size: 64
760
- CHECK-SAME: tag: DW_TAG_array_type
761
- CHECK-SAME: )
762
- CHECK: [[DBG145:.+]] = !DIDerivedType(
763
- CHECK-SAME: baseType: [[DBG144]]
764
- CHECK-SAME: name: "strides"
765
- CHECK-SAME: offset: 384
766
- CHECK-SAME: size: 64
767
- CHECK-SAME: tag: DW_TAG_member
768
- CHECK-SAME: )
769
- CHECK: [[DBG146:.+]] = !{ [[DBG129]], [[DBG132]], [[DBG134]], [[DBG136]], [[DBG139]], [[DBG142]], [[DBG145]] }
770
- CHECK: [[DBG147:.+]] = distinct !DICompositeType(
771
- CHECK-SAME: elements: [[DBG146]]
772
- CHECK-SAME: identifier: "{i8*, i8*, i64, i64, float*, [1 x i64], [1 x i64]}"
773
- CHECK-SAME: name: "array(float32, 1d, C) ({i8*, i8*, i64, i64, float*, [1 x i64], [1 x i64]})"
774
- CHECK-SAME: size: 448
775
- CHECK-SAME: tag: DW_TAG_structure_type
776
- CHECK-SAME: )
777
- CHECK: !DILocalVariable(
778
- CHECK-SAME: name: "a"
779
- CHECK-SAME: type: [[DBG147]]
780
- CHECK-SAME: )
781
- """
782
- pass
783
-
784
- ir = foo.inspect_llvm()[sig]
785
- self.assertFileCheckMatches(ir, foo.__doc__)
786
-
787
504
 
788
505
  if __name__ == "__main__":
789
506
  unittest.main()