numba-cuda 0.22.0__cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.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.
- _numba_cuda_redirector.pth +4 -0
- _numba_cuda_redirector.py +89 -0
- numba_cuda/VERSION +1 -0
- numba_cuda/__init__.py +6 -0
- numba_cuda/_version.py +11 -0
- numba_cuda/numba/cuda/__init__.py +70 -0
- numba_cuda/numba/cuda/_internal/cuda_bf16.py +16394 -0
- numba_cuda/numba/cuda/_internal/cuda_fp16.py +8112 -0
- numba_cuda/numba/cuda/api.py +580 -0
- numba_cuda/numba/cuda/api_util.py +76 -0
- numba_cuda/numba/cuda/args.py +72 -0
- numba_cuda/numba/cuda/bf16.py +397 -0
- numba_cuda/numba/cuda/cache_hints.py +287 -0
- numba_cuda/numba/cuda/cext/__init__.py +2 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpp +159 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_devicearray.h +29 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpp +1098 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_hashtable.cpp +532 -0
- numba_cuda/numba/cuda/cext/_hashtable.h +135 -0
- numba_cuda/numba/cuda/cext/_helperlib.c +71 -0
- numba_cuda/numba/cuda/cext/_helperlib.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_helpermod.c +82 -0
- numba_cuda/numba/cuda/cext/_pymodule.h +38 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpp +206 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_typeof.cpp +1159 -0
- numba_cuda/numba/cuda/cext/_typeof.h +19 -0
- numba_cuda/numba/cuda/cext/capsulethunk.h +111 -0
- numba_cuda/numba/cuda/cext/mviewbuf.c +385 -0
- numba_cuda/numba/cuda/cext/mviewbuf.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/typeconv.cpp +212 -0
- numba_cuda/numba/cuda/cext/typeconv.hpp +101 -0
- numba_cuda/numba/cuda/cg.py +67 -0
- numba_cuda/numba/cuda/cgutils.py +1294 -0
- numba_cuda/numba/cuda/cloudpickle/__init__.py +21 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle.py +1598 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle_fast.py +17 -0
- numba_cuda/numba/cuda/codegen.py +541 -0
- numba_cuda/numba/cuda/compiler.py +1396 -0
- numba_cuda/numba/cuda/core/analysis.py +758 -0
- numba_cuda/numba/cuda/core/annotations/__init__.py +0 -0
- numba_cuda/numba/cuda/core/annotations/pretty_annotate.py +288 -0
- numba_cuda/numba/cuda/core/annotations/type_annotations.py +305 -0
- numba_cuda/numba/cuda/core/base.py +1332 -0
- numba_cuda/numba/cuda/core/boxing.py +1411 -0
- numba_cuda/numba/cuda/core/bytecode.py +728 -0
- numba_cuda/numba/cuda/core/byteflow.py +2346 -0
- numba_cuda/numba/cuda/core/caching.py +744 -0
- numba_cuda/numba/cuda/core/callconv.py +392 -0
- numba_cuda/numba/cuda/core/codegen.py +171 -0
- numba_cuda/numba/cuda/core/compiler.py +199 -0
- numba_cuda/numba/cuda/core/compiler_lock.py +85 -0
- numba_cuda/numba/cuda/core/compiler_machinery.py +497 -0
- numba_cuda/numba/cuda/core/config.py +650 -0
- numba_cuda/numba/cuda/core/consts.py +124 -0
- numba_cuda/numba/cuda/core/controlflow.py +989 -0
- numba_cuda/numba/cuda/core/entrypoints.py +57 -0
- numba_cuda/numba/cuda/core/environment.py +66 -0
- numba_cuda/numba/cuda/core/errors.py +917 -0
- numba_cuda/numba/cuda/core/event.py +511 -0
- numba_cuda/numba/cuda/core/funcdesc.py +330 -0
- numba_cuda/numba/cuda/core/generators.py +387 -0
- numba_cuda/numba/cuda/core/imputils.py +509 -0
- numba_cuda/numba/cuda/core/inline_closurecall.py +1787 -0
- numba_cuda/numba/cuda/core/interpreter.py +3617 -0
- numba_cuda/numba/cuda/core/ir.py +1812 -0
- numba_cuda/numba/cuda/core/ir_utils.py +2638 -0
- numba_cuda/numba/cuda/core/optional.py +129 -0
- numba_cuda/numba/cuda/core/options.py +262 -0
- numba_cuda/numba/cuda/core/postproc.py +249 -0
- numba_cuda/numba/cuda/core/pythonapi.py +1859 -0
- numba_cuda/numba/cuda/core/registry.py +46 -0
- numba_cuda/numba/cuda/core/removerefctpass.py +123 -0
- numba_cuda/numba/cuda/core/rewrites/__init__.py +26 -0
- numba_cuda/numba/cuda/core/rewrites/ir_print.py +91 -0
- numba_cuda/numba/cuda/core/rewrites/registry.py +104 -0
- numba_cuda/numba/cuda/core/rewrites/static_binop.py +41 -0
- numba_cuda/numba/cuda/core/rewrites/static_getitem.py +189 -0
- numba_cuda/numba/cuda/core/rewrites/static_raise.py +100 -0
- numba_cuda/numba/cuda/core/sigutils.py +68 -0
- numba_cuda/numba/cuda/core/ssa.py +498 -0
- numba_cuda/numba/cuda/core/targetconfig.py +330 -0
- numba_cuda/numba/cuda/core/tracing.py +231 -0
- numba_cuda/numba/cuda/core/transforms.py +956 -0
- numba_cuda/numba/cuda/core/typed_passes.py +867 -0
- numba_cuda/numba/cuda/core/typeinfer.py +1950 -0
- numba_cuda/numba/cuda/core/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/core/unsafe/bytes.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/eh.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/refcount.py +98 -0
- numba_cuda/numba/cuda/core/untyped_passes.py +1979 -0
- numba_cuda/numba/cuda/cpython/builtins.py +1153 -0
- numba_cuda/numba/cuda/cpython/charseq.py +1218 -0
- numba_cuda/numba/cuda/cpython/cmathimpl.py +560 -0
- numba_cuda/numba/cuda/cpython/enumimpl.py +103 -0
- numba_cuda/numba/cuda/cpython/iterators.py +167 -0
- numba_cuda/numba/cuda/cpython/listobj.py +1326 -0
- numba_cuda/numba/cuda/cpython/mathimpl.py +499 -0
- numba_cuda/numba/cuda/cpython/numbers.py +1475 -0
- numba_cuda/numba/cuda/cpython/rangeobj.py +289 -0
- numba_cuda/numba/cuda/cpython/slicing.py +322 -0
- numba_cuda/numba/cuda/cpython/tupleobj.py +456 -0
- numba_cuda/numba/cuda/cpython/unicode.py +2865 -0
- numba_cuda/numba/cuda/cpython/unicode_support.py +1597 -0
- numba_cuda/numba/cuda/cpython/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/cpython/unsafe/numbers.py +64 -0
- numba_cuda/numba/cuda/cpython/unsafe/tuple.py +92 -0
- numba_cuda/numba/cuda/cuda_paths.py +691 -0
- numba_cuda/numba/cuda/cudadecl.py +543 -0
- numba_cuda/numba/cuda/cudadrv/__init__.py +14 -0
- numba_cuda/numba/cuda/cudadrv/devicearray.py +954 -0
- numba_cuda/numba/cuda/cudadrv/devices.py +249 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +3238 -0
- numba_cuda/numba/cuda/cudadrv/drvapi.py +435 -0
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +562 -0
- numba_cuda/numba/cuda/cudadrv/enums.py +613 -0
- numba_cuda/numba/cuda/cudadrv/error.py +48 -0
- numba_cuda/numba/cuda/cudadrv/libs.py +220 -0
- numba_cuda/numba/cuda/cudadrv/linkable_code.py +184 -0
- numba_cuda/numba/cuda/cudadrv/mappings.py +14 -0
- numba_cuda/numba/cuda/cudadrv/ndarray.py +26 -0
- numba_cuda/numba/cuda/cudadrv/nvrtc.py +193 -0
- numba_cuda/numba/cuda/cudadrv/nvvm.py +756 -0
- numba_cuda/numba/cuda/cudadrv/rtapi.py +13 -0
- numba_cuda/numba/cuda/cudadrv/runtime.py +34 -0
- numba_cuda/numba/cuda/cudaimpl.py +983 -0
- numba_cuda/numba/cuda/cudamath.py +149 -0
- numba_cuda/numba/cuda/datamodel/__init__.py +7 -0
- numba_cuda/numba/cuda/datamodel/cuda_manager.py +66 -0
- numba_cuda/numba/cuda/datamodel/cuda_models.py +1446 -0
- numba_cuda/numba/cuda/datamodel/cuda_packer.py +224 -0
- numba_cuda/numba/cuda/datamodel/cuda_registry.py +22 -0
- numba_cuda/numba/cuda/datamodel/cuda_testing.py +153 -0
- numba_cuda/numba/cuda/datamodel/manager.py +11 -0
- numba_cuda/numba/cuda/datamodel/models.py +9 -0
- numba_cuda/numba/cuda/datamodel/packer.py +9 -0
- numba_cuda/numba/cuda/datamodel/registry.py +11 -0
- numba_cuda/numba/cuda/datamodel/testing.py +11 -0
- numba_cuda/numba/cuda/debuginfo.py +997 -0
- numba_cuda/numba/cuda/decorators.py +294 -0
- numba_cuda/numba/cuda/descriptor.py +35 -0
- numba_cuda/numba/cuda/device_init.py +155 -0
- numba_cuda/numba/cuda/deviceufunc.py +1021 -0
- numba_cuda/numba/cuda/dispatcher.py +2463 -0
- numba_cuda/numba/cuda/errors.py +72 -0
- numba_cuda/numba/cuda/extending.py +697 -0
- numba_cuda/numba/cuda/flags.py +178 -0
- numba_cuda/numba/cuda/fp16.py +357 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/initialize.py +24 -0
- numba_cuda/numba/cuda/intrinsics.py +531 -0
- numba_cuda/numba/cuda/itanium_mangler.py +214 -0
- numba_cuda/numba/cuda/kernels/__init__.py +2 -0
- numba_cuda/numba/cuda/kernels/reduction.py +265 -0
- numba_cuda/numba/cuda/kernels/transpose.py +65 -0
- numba_cuda/numba/cuda/libdevice.py +3386 -0
- numba_cuda/numba/cuda/libdevicedecl.py +20 -0
- numba_cuda/numba/cuda/libdevicefuncs.py +1060 -0
- numba_cuda/numba/cuda/libdeviceimpl.py +88 -0
- numba_cuda/numba/cuda/locks.py +19 -0
- numba_cuda/numba/cuda/lowering.py +1980 -0
- numba_cuda/numba/cuda/mathimpl.py +374 -0
- numba_cuda/numba/cuda/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/memory_management/memsys.cu +99 -0
- numba_cuda/numba/cuda/memory_management/memsys.cuh +22 -0
- numba_cuda/numba/cuda/memory_management/nrt.cu +212 -0
- numba_cuda/numba/cuda/memory_management/nrt.cuh +48 -0
- numba_cuda/numba/cuda/memory_management/nrt.py +390 -0
- numba_cuda/numba/cuda/memory_management/nrt_context.py +438 -0
- numba_cuda/numba/cuda/misc/appdirs.py +594 -0
- numba_cuda/numba/cuda/misc/cffiimpl.py +24 -0
- numba_cuda/numba/cuda/misc/coverage_support.py +43 -0
- numba_cuda/numba/cuda/misc/dump_style.py +41 -0
- numba_cuda/numba/cuda/misc/findlib.py +75 -0
- numba_cuda/numba/cuda/misc/firstlinefinder.py +96 -0
- numba_cuda/numba/cuda/misc/gdb_hook.py +240 -0
- numba_cuda/numba/cuda/misc/literal.py +28 -0
- numba_cuda/numba/cuda/misc/llvm_pass_timings.py +412 -0
- numba_cuda/numba/cuda/misc/special.py +94 -0
- numba_cuda/numba/cuda/models.py +56 -0
- numba_cuda/numba/cuda/np/arraymath.py +5130 -0
- numba_cuda/numba/cuda/np/arrayobj.py +7635 -0
- numba_cuda/numba/cuda/np/extensions.py +11 -0
- numba_cuda/numba/cuda/np/linalg.py +3087 -0
- numba_cuda/numba/cuda/np/math/__init__.py +0 -0
- numba_cuda/numba/cuda/np/math/cmathimpl.py +558 -0
- numba_cuda/numba/cuda/np/math/mathimpl.py +487 -0
- numba_cuda/numba/cuda/np/math/numbers.py +1461 -0
- numba_cuda/numba/cuda/np/npdatetime.py +969 -0
- numba_cuda/numba/cuda/np/npdatetime_helpers.py +217 -0
- numba_cuda/numba/cuda/np/npyfuncs.py +1808 -0
- numba_cuda/numba/cuda/np/npyimpl.py +1027 -0
- numba_cuda/numba/cuda/np/numpy_support.py +798 -0
- numba_cuda/numba/cuda/np/polynomial/__init__.py +4 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_core.py +242 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_functions.py +380 -0
- numba_cuda/numba/cuda/np/ufunc/__init__.py +4 -0
- numba_cuda/numba/cuda/np/ufunc/decorators.py +203 -0
- numba_cuda/numba/cuda/np/ufunc/sigparse.py +68 -0
- numba_cuda/numba/cuda/np/ufunc/ufuncbuilder.py +65 -0
- numba_cuda/numba/cuda/np/ufunc_db.py +1282 -0
- numba_cuda/numba/cuda/np/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/np/unsafe/ndarray.py +84 -0
- numba_cuda/numba/cuda/nvvmutils.py +254 -0
- numba_cuda/numba/cuda/printimpl.py +126 -0
- numba_cuda/numba/cuda/random.py +308 -0
- numba_cuda/numba/cuda/reshape_funcs.cu +156 -0
- numba_cuda/numba/cuda/serialize.py +267 -0
- numba_cuda/numba/cuda/simulator/__init__.py +63 -0
- numba_cuda/numba/cuda/simulator/_internal/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/_internal/cuda_bf16.py +2 -0
- numba_cuda/numba/cuda/simulator/api.py +179 -0
- numba_cuda/numba/cuda/simulator/bf16.py +4 -0
- numba_cuda/numba/cuda/simulator/compiler.py +38 -0
- numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +462 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devices.py +122 -0
- numba_cuda/numba/cuda/simulator/cudadrv/driver.py +66 -0
- numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/dummyarray.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/error.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/libs.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/linkable_code.py +61 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvrtc.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +32 -0
- numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +22 -0
- numba_cuda/numba/cuda/simulator/dispatcher.py +11 -0
- numba_cuda/numba/cuda/simulator/kernel.py +320 -0
- numba_cuda/numba/cuda/simulator/kernelapi.py +509 -0
- numba_cuda/numba/cuda/simulator/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/memory_management/nrt.py +21 -0
- numba_cuda/numba/cuda/simulator/reduction.py +19 -0
- numba_cuda/numba/cuda/simulator/tests/support.py +4 -0
- numba_cuda/numba/cuda/simulator/vector_types.py +65 -0
- numba_cuda/numba/cuda/simulator_init.py +18 -0
- numba_cuda/numba/cuda/stubs.py +624 -0
- numba_cuda/numba/cuda/target.py +505 -0
- numba_cuda/numba/cuda/testing.py +347 -0
- numba_cuda/numba/cuda/tests/__init__.py +62 -0
- numba_cuda/numba/cuda/tests/benchmarks/__init__.py +0 -0
- numba_cuda/numba/cuda/tests/benchmarks/test_kernel_launch.py +119 -0
- numba_cuda/numba/cuda/tests/cloudpickle_main_class.py +9 -0
- numba_cuda/numba/cuda/tests/core/serialize_usecases.py +113 -0
- numba_cuda/numba/cuda/tests/core/test_itanium_mangler.py +83 -0
- numba_cuda/numba/cuda/tests/core/test_serialize.py +371 -0
- numba_cuda/numba/cuda/tests/cudadrv/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +147 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +161 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +397 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +24 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +180 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +313 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +191 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +621 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +247 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +100 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +200 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_events.py +53 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +72 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_init.py +138 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +43 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py +15 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linkable_code.py +58 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +348 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +128 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +301 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +174 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvrtc.py +28 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +185 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +39 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +23 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +38 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +48 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +44 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +127 -0
- numba_cuda/numba/cuda/tests/cudapy/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +231 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +50 -0
- numba_cuda/numba/cuda/tests/cudapy/cg_cache_usecases.py +36 -0
- numba_cuda/numba/cuda/tests/cudapy/complex_usecases.py +116 -0
- numba_cuda/numba/cuda/tests/cudapy/enum_usecases.py +59 -0
- numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +28 -0
- numba_cuda/numba/cuda/tests/cudapy/overload_usecases.py +33 -0
- numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +104 -0
- numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_analysis.py +1122 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array.py +344 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_alignment.py +268 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +203 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +63 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_reductions.py +360 -0
- numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +1815 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16.py +599 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +377 -0
- numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +160 -0
- numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +27 -0
- numba_cuda/numba/cuda/tests/cudapy/test_byteflow.py +98 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cache_hints.py +210 -0
- numba_cuda/numba/cuda/tests/cudapy/test_caching.py +683 -0
- numba_cuda/numba/cuda/tests/cudapy/test_casting.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +718 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex.py +370 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +142 -0
- numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +178 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_copy_propagate.py +131 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +438 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debug.py +105 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +978 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo_types.py +476 -0
- numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +500 -0
- numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +820 -0
- numba_cuda/numba/cuda/tests/cudapy/test_enums.py +152 -0
- numba_cuda/numba/cuda/tests/cudapy/test_errors.py +111 -0
- numba_cuda/numba/cuda/tests/cudapy/test_exception.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending.py +1088 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending_types.py +71 -0
- numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_flow_control.py +1433 -0
- numba_cuda/numba/cuda/tests/cudapy/test_forall.py +57 -0
- numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +34 -0
- numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +69 -0
- numba_cuda/numba/cuda/tests/cudapy/test_globals.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +474 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +167 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +92 -0
- numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inline.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +255 -0
- numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +1219 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +263 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir.py +598 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir_utils.py +276 -0
- numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lang.py +68 -0
- numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +123 -0
- numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +194 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +220 -0
- numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +173 -0
- numba_cuda/numba/cuda/tests/cudapy/test_make_function_to_jit_function.py +364 -0
- numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_math.py +842 -0
- numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +76 -0
- numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +78 -0
- numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +25 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +145 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +82 -0
- numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +53 -0
- numba_cuda/numba/cuda/tests/cudapy/test_operator.py +504 -0
- numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +93 -0
- numba_cuda/numba/cuda/tests/cudapy/test_overload.py +402 -0
- numba_cuda/numba/cuda/tests/cudapy/test_powi.py +128 -0
- numba_cuda/numba/cuda/tests/cudapy/test_print.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +37 -0
- numba_cuda/numba/cuda/tests/cudapy/test_random.py +117 -0
- numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +614 -0
- numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +130 -0
- numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +83 -0
- numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +86 -0
- numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm.py +457 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +233 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ssa.py +454 -0
- numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +56 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sync.py +277 -0
- numba_cuda/numba/cuda/tests/cudapy/test_tracing.py +200 -0
- numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +90 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeconv.py +333 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeinfer.py +538 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +585 -0
- numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +485 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +312 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +183 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warning.py +206 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +446 -0
- numba_cuda/numba/cuda/tests/cudasim/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/support.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +111 -0
- numba_cuda/numba/cuda/tests/data/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/data/cta_barrier.cu +28 -0
- numba_cuda/numba/cuda/tests/data/cuda_include.cu +10 -0
- numba_cuda/numba/cuda/tests/data/error.cu +12 -0
- numba_cuda/numba/cuda/tests/data/include/add.cuh +8 -0
- numba_cuda/numba/cuda/tests/data/jitlink.cu +28 -0
- numba_cuda/numba/cuda/tests/data/jitlink.ptx +49 -0
- numba_cuda/numba/cuda/tests/data/warn.cu +12 -0
- numba_cuda/numba/cuda/tests/doc_examples/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/functions.cu +54 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/include/mul.cuh +8 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/saxpy.cu +14 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +86 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpointer.py +68 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +81 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +141 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +160 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +180 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +119 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_random.py +66 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +80 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +206 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +53 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +76 -0
- numba_cuda/numba/cuda/tests/nocuda/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +452 -0
- numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +48 -0
- numba_cuda/numba/cuda/tests/nocuda/test_import.py +63 -0
- numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +252 -0
- numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +59 -0
- numba_cuda/numba/cuda/tests/nrt/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt.py +387 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +124 -0
- numba_cuda/numba/cuda/tests/support.py +900 -0
- numba_cuda/numba/cuda/typeconv/__init__.py +4 -0
- numba_cuda/numba/cuda/typeconv/castgraph.py +137 -0
- numba_cuda/numba/cuda/typeconv/rules.py +63 -0
- numba_cuda/numba/cuda/typeconv/typeconv.py +121 -0
- numba_cuda/numba/cuda/types/__init__.py +233 -0
- numba_cuda/numba/cuda/types/__init__.pyi +167 -0
- numba_cuda/numba/cuda/types/abstract.py +9 -0
- numba_cuda/numba/cuda/types/common.py +9 -0
- numba_cuda/numba/cuda/types/containers.py +9 -0
- numba_cuda/numba/cuda/types/cuda_abstract.py +533 -0
- numba_cuda/numba/cuda/types/cuda_common.py +110 -0
- numba_cuda/numba/cuda/types/cuda_containers.py +971 -0
- numba_cuda/numba/cuda/types/cuda_function_type.py +230 -0
- numba_cuda/numba/cuda/types/cuda_functions.py +798 -0
- numba_cuda/numba/cuda/types/cuda_iterators.py +120 -0
- numba_cuda/numba/cuda/types/cuda_misc.py +569 -0
- numba_cuda/numba/cuda/types/cuda_npytypes.py +690 -0
- numba_cuda/numba/cuda/types/cuda_scalars.py +280 -0
- numba_cuda/numba/cuda/types/ext_types.py +101 -0
- numba_cuda/numba/cuda/types/function_type.py +11 -0
- numba_cuda/numba/cuda/types/functions.py +9 -0
- numba_cuda/numba/cuda/types/iterators.py +9 -0
- numba_cuda/numba/cuda/types/misc.py +9 -0
- numba_cuda/numba/cuda/types/npytypes.py +9 -0
- numba_cuda/numba/cuda/types/scalars.py +9 -0
- numba_cuda/numba/cuda/typing/__init__.py +19 -0
- numba_cuda/numba/cuda/typing/arraydecl.py +939 -0
- numba_cuda/numba/cuda/typing/asnumbatype.py +130 -0
- numba_cuda/numba/cuda/typing/bufproto.py +70 -0
- numba_cuda/numba/cuda/typing/builtins.py +1209 -0
- numba_cuda/numba/cuda/typing/cffi_utils.py +219 -0
- numba_cuda/numba/cuda/typing/cmathdecl.py +47 -0
- numba_cuda/numba/cuda/typing/collections.py +138 -0
- numba_cuda/numba/cuda/typing/context.py +782 -0
- numba_cuda/numba/cuda/typing/ctypes_utils.py +125 -0
- numba_cuda/numba/cuda/typing/dictdecl.py +63 -0
- numba_cuda/numba/cuda/typing/enumdecl.py +74 -0
- numba_cuda/numba/cuda/typing/listdecl.py +147 -0
- numba_cuda/numba/cuda/typing/mathdecl.py +158 -0
- numba_cuda/numba/cuda/typing/npdatetime.py +322 -0
- numba_cuda/numba/cuda/typing/npydecl.py +749 -0
- numba_cuda/numba/cuda/typing/setdecl.py +115 -0
- numba_cuda/numba/cuda/typing/templates.py +1446 -0
- numba_cuda/numba/cuda/typing/typeof.py +301 -0
- numba_cuda/numba/cuda/ufuncs.py +746 -0
- numba_cuda/numba/cuda/utils.py +724 -0
- numba_cuda/numba/cuda/vector_types.py +214 -0
- numba_cuda/numba/cuda/vectorizers.py +260 -0
- numba_cuda-0.22.0.dist-info/METADATA +109 -0
- numba_cuda-0.22.0.dist-info/RECORD +487 -0
- numba_cuda-0.22.0.dist-info/WHEEL +6 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE +26 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE.numba +24 -0
- numba_cuda-0.22.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from .common import SimpleIterableType, SimpleIteratorType
|
|
5
|
+
from numba.cuda.core.errors import TypingError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RangeType(SimpleIterableType):
|
|
9
|
+
def __init__(self, dtype):
|
|
10
|
+
self.dtype = dtype
|
|
11
|
+
name = "range_state_%s" % (dtype,)
|
|
12
|
+
super(SimpleIterableType, self).__init__(name)
|
|
13
|
+
self._iterator_type = RangeIteratorType(self.dtype)
|
|
14
|
+
|
|
15
|
+
def unify(self, typingctx, other):
|
|
16
|
+
if isinstance(other, RangeType):
|
|
17
|
+
dtype = typingctx.unify_pairs(self.dtype, other.dtype)
|
|
18
|
+
if dtype is not None:
|
|
19
|
+
return RangeType(dtype)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RangeIteratorType(SimpleIteratorType):
|
|
23
|
+
def __init__(self, dtype):
|
|
24
|
+
name = "range_iter_%s" % (dtype,)
|
|
25
|
+
super(SimpleIteratorType, self).__init__(name)
|
|
26
|
+
self._yield_type = dtype
|
|
27
|
+
|
|
28
|
+
def unify(self, typingctx, other):
|
|
29
|
+
if isinstance(other, RangeIteratorType):
|
|
30
|
+
dtype = typingctx.unify_pairs(self.yield_type, other.yield_type)
|
|
31
|
+
if dtype is not None:
|
|
32
|
+
return RangeIteratorType(dtype)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Generator(SimpleIteratorType):
|
|
36
|
+
"""
|
|
37
|
+
Type class for Numba-compiled generator objects.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self, gen_func, yield_type, arg_types, state_types, has_finalizer
|
|
42
|
+
):
|
|
43
|
+
self.gen_func = gen_func
|
|
44
|
+
self.arg_types = tuple(arg_types)
|
|
45
|
+
self.state_types = tuple(state_types)
|
|
46
|
+
self.has_finalizer = has_finalizer
|
|
47
|
+
name = "%s generator(func=%s, args=%s, has_finalizer=%s)" % (
|
|
48
|
+
yield_type,
|
|
49
|
+
self.gen_func,
|
|
50
|
+
self.arg_types,
|
|
51
|
+
self.has_finalizer,
|
|
52
|
+
)
|
|
53
|
+
super(Generator, self).__init__(name, yield_type)
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def key(self):
|
|
57
|
+
return (
|
|
58
|
+
self.gen_func,
|
|
59
|
+
self.arg_types,
|
|
60
|
+
self.yield_type,
|
|
61
|
+
self.has_finalizer,
|
|
62
|
+
self.state_types,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class EnumerateType(SimpleIteratorType):
|
|
67
|
+
"""
|
|
68
|
+
Type class for `enumerate` objects.
|
|
69
|
+
Type instances are parametered with the underlying source type.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
def __init__(self, iterable_type):
|
|
73
|
+
from numba.cuda.types import Tuple, intp
|
|
74
|
+
|
|
75
|
+
self.source_type = iterable_type.iterator_type
|
|
76
|
+
yield_type = Tuple([intp, self.source_type.yield_type])
|
|
77
|
+
name = "enumerate(%s)" % (self.source_type)
|
|
78
|
+
super(EnumerateType, self).__init__(name, yield_type)
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def key(self):
|
|
82
|
+
return self.source_type
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ZipType(SimpleIteratorType):
|
|
86
|
+
"""
|
|
87
|
+
Type class for `zip` objects.
|
|
88
|
+
Type instances are parametered with the underlying source types.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
def __init__(self, iterable_types):
|
|
92
|
+
from numba.cuda.types import Tuple
|
|
93
|
+
|
|
94
|
+
self.source_types = tuple(tp.iterator_type for tp in iterable_types)
|
|
95
|
+
yield_type = Tuple([tp.yield_type for tp in self.source_types])
|
|
96
|
+
name = "zip(%s)" % ", ".join(str(tp) for tp in self.source_types)
|
|
97
|
+
super(ZipType, self).__init__(name, yield_type)
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def key(self):
|
|
101
|
+
return self.source_types
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class ArrayIterator(SimpleIteratorType):
|
|
105
|
+
"""
|
|
106
|
+
Type class for iterators of array and buffer objects.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
def __init__(self, array_type):
|
|
110
|
+
self.array_type = array_type
|
|
111
|
+
name = "iter(%s)" % (self.array_type,)
|
|
112
|
+
nd = array_type.ndim
|
|
113
|
+
if nd == 0:
|
|
114
|
+
raise TypingError("iteration over a 0-d array")
|
|
115
|
+
elif nd == 1:
|
|
116
|
+
yield_type = array_type.dtype
|
|
117
|
+
else:
|
|
118
|
+
# iteration semantics leads to A order layout
|
|
119
|
+
yield_type = array_type.copy(ndim=array_type.ndim - 1, layout="A")
|
|
120
|
+
super(ArrayIterator, self).__init__(name, yield_type)
|
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from numba.cuda.types.abstract import Callable, Literal, Type, Hashable
|
|
5
|
+
from numba.cuda.types.common import (
|
|
6
|
+
Dummy,
|
|
7
|
+
IterableType,
|
|
8
|
+
Opaque,
|
|
9
|
+
SimpleIteratorType,
|
|
10
|
+
)
|
|
11
|
+
from numba.cuda.typeconv import Conversion
|
|
12
|
+
from numba.cuda.core.errors import TypingError, LiteralTypingError
|
|
13
|
+
from numba.cuda.utils import get_hashable_key
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PyObject(Dummy):
|
|
17
|
+
"""
|
|
18
|
+
A generic CPython object.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def is_precise(self):
|
|
22
|
+
return False
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Phantom(Dummy):
|
|
26
|
+
"""
|
|
27
|
+
A type that cannot be materialized. A Phantom cannot be used as
|
|
28
|
+
argument or return type.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Undefined(Dummy):
|
|
33
|
+
"""
|
|
34
|
+
A type that is left imprecise. This is used as a temporaray placeholder
|
|
35
|
+
during type inference in the hope that the type can be later refined.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def is_precise(self):
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class UndefVar(Dummy):
|
|
43
|
+
"""
|
|
44
|
+
A type that is created by Expr.undef to represent an undefined variable.
|
|
45
|
+
This type can be promoted to any other type.
|
|
46
|
+
This is introduced to handle Python 3.12 LOAD_FAST_AND_CLEAR.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def can_convert_to(self, typingctx, other):
|
|
50
|
+
return Conversion.promote
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class RawPointer(Opaque):
|
|
54
|
+
"""
|
|
55
|
+
A raw pointer without any specific meaning.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class StringLiteral(Literal, Dummy):
|
|
60
|
+
def can_convert_to(self, typingctx, other):
|
|
61
|
+
if isinstance(other, UnicodeType):
|
|
62
|
+
return Conversion.safe
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Literal.ctor_map[str] = StringLiteral
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def unliteral(lit_type):
|
|
69
|
+
"""
|
|
70
|
+
Get base type from Literal type.
|
|
71
|
+
"""
|
|
72
|
+
if hasattr(lit_type, "__unliteral__"):
|
|
73
|
+
return lit_type.__unliteral__()
|
|
74
|
+
return getattr(lit_type, "literal_type", lit_type)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def literal(value):
|
|
78
|
+
"""Returns a Literal instance or raise LiteralTypingError"""
|
|
79
|
+
ty = type(value)
|
|
80
|
+
if isinstance(value, Literal):
|
|
81
|
+
msg = "the function does not accept a Literal type; got {} ({})"
|
|
82
|
+
raise ValueError(msg.format(value, ty))
|
|
83
|
+
try:
|
|
84
|
+
ctor = Literal.ctor_map[ty]
|
|
85
|
+
except KeyError:
|
|
86
|
+
raise LiteralTypingError("{} cannot be used as a literal".format(ty))
|
|
87
|
+
else:
|
|
88
|
+
return ctor(value)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def maybe_literal(value):
|
|
92
|
+
"""Get a Literal type for the value or None."""
|
|
93
|
+
try:
|
|
94
|
+
return literal(value)
|
|
95
|
+
except LiteralTypingError:
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Omitted(Opaque):
|
|
100
|
+
"""
|
|
101
|
+
An omitted function argument with a default value.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
def __init__(self, value):
|
|
105
|
+
self._value = value
|
|
106
|
+
# Use helper function to support both hashable and non-hashable
|
|
107
|
+
# values. See discussion in gh #6957.
|
|
108
|
+
self._value_key = get_hashable_key(value)
|
|
109
|
+
super(Omitted, self).__init__("omitted(default=%r)" % (value,))
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def key(self):
|
|
113
|
+
return type(self._value), self._value_key
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def value(self):
|
|
117
|
+
return self._value
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class VarArg(Type):
|
|
121
|
+
"""
|
|
122
|
+
Special type representing a variable number of arguments at the
|
|
123
|
+
end of a function's signature. Only used for signature matching,
|
|
124
|
+
not for actual values.
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
def __init__(self, dtype):
|
|
128
|
+
self.dtype = dtype
|
|
129
|
+
super(VarArg, self).__init__("*%s" % dtype)
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def key(self):
|
|
133
|
+
return self.dtype
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class Module(Dummy):
|
|
137
|
+
def __init__(self, pymod):
|
|
138
|
+
self.pymod = pymod
|
|
139
|
+
super(Module, self).__init__("Module(%s)" % pymod)
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def key(self):
|
|
143
|
+
return self.pymod
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class MemInfoPointer(Type):
|
|
147
|
+
"""
|
|
148
|
+
Pointer to a Numba "meminfo" (i.e. the information for a managed
|
|
149
|
+
piece of memory).
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
mutable = True
|
|
153
|
+
|
|
154
|
+
def __init__(self, dtype):
|
|
155
|
+
self.dtype = dtype
|
|
156
|
+
name = "memory-managed *%s" % dtype
|
|
157
|
+
super(MemInfoPointer, self).__init__(name)
|
|
158
|
+
|
|
159
|
+
@property
|
|
160
|
+
def key(self):
|
|
161
|
+
return self.dtype
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class CPointer(Type):
|
|
165
|
+
"""
|
|
166
|
+
Type class for pointers to other types.
|
|
167
|
+
|
|
168
|
+
Attributes
|
|
169
|
+
----------
|
|
170
|
+
dtype : The pointee type
|
|
171
|
+
addrspace : int
|
|
172
|
+
The address space pointee belongs to.
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
mutable = True
|
|
176
|
+
|
|
177
|
+
def __init__(self, dtype, addrspace=None):
|
|
178
|
+
self.dtype = dtype
|
|
179
|
+
self.addrspace = addrspace
|
|
180
|
+
if addrspace is not None:
|
|
181
|
+
name = "%s_%s*" % (dtype, addrspace)
|
|
182
|
+
else:
|
|
183
|
+
name = "%s*" % dtype
|
|
184
|
+
super(CPointer, self).__init__(name)
|
|
185
|
+
|
|
186
|
+
@property
|
|
187
|
+
def key(self):
|
|
188
|
+
return self.dtype, self.addrspace
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class EphemeralPointer(CPointer):
|
|
192
|
+
"""
|
|
193
|
+
Type class for pointers which aren't guaranteed to last long - e.g.
|
|
194
|
+
stack-allocated slots. The data model serializes such pointers
|
|
195
|
+
by copying the data pointed to.
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class EphemeralArray(Type):
|
|
200
|
+
"""
|
|
201
|
+
Similar to EphemeralPointer, but pointing to an array of elements,
|
|
202
|
+
rather than a single one. The array size must be known at compile-time.
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
def __init__(self, dtype, count):
|
|
206
|
+
self.dtype = dtype
|
|
207
|
+
self.count = count
|
|
208
|
+
name = "*%s[%d]" % (dtype, count)
|
|
209
|
+
super(EphemeralArray, self).__init__(name)
|
|
210
|
+
|
|
211
|
+
@property
|
|
212
|
+
def key(self):
|
|
213
|
+
return self.dtype, self.count
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class Object(Type):
|
|
217
|
+
# XXX unused?
|
|
218
|
+
mutable = True
|
|
219
|
+
|
|
220
|
+
def __init__(self, clsobj):
|
|
221
|
+
self.cls = clsobj
|
|
222
|
+
name = "Object(%s)" % clsobj.__name__
|
|
223
|
+
super(Object, self).__init__(name)
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def key(self):
|
|
227
|
+
return self.cls
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class Optional(Type):
|
|
231
|
+
"""
|
|
232
|
+
Type class for optional types, i.e. union { some type, None }
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
def __init__(self, typ):
|
|
236
|
+
assert not isinstance(typ, (Optional, NoneType))
|
|
237
|
+
typ = unliteral(typ)
|
|
238
|
+
self.type = typ
|
|
239
|
+
name = "OptionalType(%s)" % self.type
|
|
240
|
+
super(Optional, self).__init__(name)
|
|
241
|
+
|
|
242
|
+
@property
|
|
243
|
+
def key(self):
|
|
244
|
+
return self.type
|
|
245
|
+
|
|
246
|
+
def can_convert_to(self, typingctx, other):
|
|
247
|
+
if isinstance(other, Optional):
|
|
248
|
+
return typingctx.can_convert(self.type, other.type)
|
|
249
|
+
else:
|
|
250
|
+
conv = typingctx.can_convert(self.type, other)
|
|
251
|
+
if conv is not None:
|
|
252
|
+
return max(conv, Conversion.safe)
|
|
253
|
+
|
|
254
|
+
def can_convert_from(self, typingctx, other):
|
|
255
|
+
if isinstance(other, NoneType):
|
|
256
|
+
return Conversion.promote
|
|
257
|
+
elif isinstance(other, Optional):
|
|
258
|
+
return typingctx.can_convert(other.type, self.type)
|
|
259
|
+
else:
|
|
260
|
+
conv = typingctx.can_convert(other, self.type)
|
|
261
|
+
if conv is not None:
|
|
262
|
+
return max(conv, Conversion.promote)
|
|
263
|
+
|
|
264
|
+
def unify(self, typingctx, other):
|
|
265
|
+
if isinstance(other, Optional):
|
|
266
|
+
unified = typingctx.unify_pairs(self.type, other.type)
|
|
267
|
+
else:
|
|
268
|
+
unified = typingctx.unify_pairs(self.type, other)
|
|
269
|
+
|
|
270
|
+
if unified is not None:
|
|
271
|
+
if isinstance(unified, Optional):
|
|
272
|
+
return unified
|
|
273
|
+
else:
|
|
274
|
+
return Optional(unified)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class NoneType(Opaque):
|
|
278
|
+
"""
|
|
279
|
+
The type for None.
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
def unify(self, typingctx, other):
|
|
283
|
+
"""
|
|
284
|
+
Turn anything to a Optional type;
|
|
285
|
+
"""
|
|
286
|
+
if isinstance(other, (Optional, NoneType)):
|
|
287
|
+
return other
|
|
288
|
+
return Optional(other)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class EllipsisType(Opaque):
|
|
292
|
+
"""
|
|
293
|
+
The type for the Ellipsis singleton.
|
|
294
|
+
"""
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class ExceptionClass(Callable, Phantom):
|
|
298
|
+
"""
|
|
299
|
+
The type of exception classes (not instances).
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
def __init__(self, exc_class):
|
|
303
|
+
assert issubclass(exc_class, BaseException)
|
|
304
|
+
name = "%s" % (exc_class.__name__)
|
|
305
|
+
self.exc_class = exc_class
|
|
306
|
+
super(ExceptionClass, self).__init__(name)
|
|
307
|
+
|
|
308
|
+
def get_call_type(self, context, args, kws):
|
|
309
|
+
return self.get_call_signatures()[0][0]
|
|
310
|
+
|
|
311
|
+
def get_call_signatures(self):
|
|
312
|
+
from numba.cuda import typing
|
|
313
|
+
|
|
314
|
+
return_type = ExceptionInstance(self.exc_class)
|
|
315
|
+
return [typing.signature(return_type)], False
|
|
316
|
+
|
|
317
|
+
def get_impl_key(self, sig):
|
|
318
|
+
return type(self)
|
|
319
|
+
|
|
320
|
+
@property
|
|
321
|
+
def key(self):
|
|
322
|
+
return self.exc_class
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class ExceptionInstance(Phantom):
|
|
326
|
+
"""
|
|
327
|
+
The type of exception instances. *exc_class* should be the
|
|
328
|
+
exception class.
|
|
329
|
+
"""
|
|
330
|
+
|
|
331
|
+
def __init__(self, exc_class):
|
|
332
|
+
assert issubclass(exc_class, BaseException)
|
|
333
|
+
name = "%s(...)" % (exc_class.__name__,)
|
|
334
|
+
self.exc_class = exc_class
|
|
335
|
+
super(ExceptionInstance, self).__init__(name)
|
|
336
|
+
|
|
337
|
+
@property
|
|
338
|
+
def key(self):
|
|
339
|
+
return self.exc_class
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class SliceType(Type):
|
|
343
|
+
def __init__(self, name, members):
|
|
344
|
+
assert members in (2, 3)
|
|
345
|
+
self.members = members
|
|
346
|
+
self.has_step = members >= 3
|
|
347
|
+
super(SliceType, self).__init__(name)
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def key(self):
|
|
351
|
+
return self.members
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class SliceLiteral(Literal, SliceType):
|
|
355
|
+
def __init__(self, value):
|
|
356
|
+
self._literal_init(value)
|
|
357
|
+
name = "Literal[slice]({})".format(value)
|
|
358
|
+
members = 2 if value.step is None else 3
|
|
359
|
+
SliceType.__init__(self, name=name, members=members)
|
|
360
|
+
|
|
361
|
+
@property
|
|
362
|
+
def key(self):
|
|
363
|
+
sl = self.literal_value
|
|
364
|
+
return sl.start, sl.stop, sl.step
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
Literal.ctor_map[slice] = SliceLiteral
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class ClassInstanceType(Type):
|
|
371
|
+
"""
|
|
372
|
+
The type of a jitted class *instance*. It will be the return-type
|
|
373
|
+
of the constructor of the class.
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
mutable = True
|
|
377
|
+
name_prefix = "instance"
|
|
378
|
+
|
|
379
|
+
def __init__(self, class_type):
|
|
380
|
+
self.class_type = class_type
|
|
381
|
+
name = "{0}.{1}".format(self.name_prefix, self.class_type.name)
|
|
382
|
+
super(ClassInstanceType, self).__init__(name)
|
|
383
|
+
|
|
384
|
+
def get_data_type(self):
|
|
385
|
+
return ClassDataType(self)
|
|
386
|
+
|
|
387
|
+
def get_reference_type(self):
|
|
388
|
+
return self
|
|
389
|
+
|
|
390
|
+
@property
|
|
391
|
+
def key(self):
|
|
392
|
+
return self.class_type.key
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def classname(self):
|
|
396
|
+
return self.class_type.class_name
|
|
397
|
+
|
|
398
|
+
@property
|
|
399
|
+
def jit_props(self):
|
|
400
|
+
return self.class_type.jit_props
|
|
401
|
+
|
|
402
|
+
@property
|
|
403
|
+
def jit_static_methods(self):
|
|
404
|
+
return self.class_type.jit_static_methods
|
|
405
|
+
|
|
406
|
+
@property
|
|
407
|
+
def jit_methods(self):
|
|
408
|
+
return self.class_type.jit_methods
|
|
409
|
+
|
|
410
|
+
@property
|
|
411
|
+
def struct(self):
|
|
412
|
+
return self.class_type.struct
|
|
413
|
+
|
|
414
|
+
@property
|
|
415
|
+
def methods(self):
|
|
416
|
+
return self.class_type.methods
|
|
417
|
+
|
|
418
|
+
@property
|
|
419
|
+
def static_methods(self):
|
|
420
|
+
return self.class_type.static_methods
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
class ClassType(Callable, Opaque):
|
|
424
|
+
"""
|
|
425
|
+
The type of the jitted class (not instance). When the type of a class
|
|
426
|
+
is called, its constructor is invoked.
|
|
427
|
+
"""
|
|
428
|
+
|
|
429
|
+
mutable = True
|
|
430
|
+
name_prefix = "jitclass"
|
|
431
|
+
instance_type_class = ClassInstanceType
|
|
432
|
+
|
|
433
|
+
def __init__(
|
|
434
|
+
self,
|
|
435
|
+
class_def,
|
|
436
|
+
ctor_template_cls,
|
|
437
|
+
struct,
|
|
438
|
+
jit_methods,
|
|
439
|
+
jit_props,
|
|
440
|
+
jit_static_methods,
|
|
441
|
+
):
|
|
442
|
+
self.class_name = class_def.__name__
|
|
443
|
+
self.class_doc = class_def.__doc__
|
|
444
|
+
self._ctor_template_class = ctor_template_cls
|
|
445
|
+
self.jit_methods = jit_methods
|
|
446
|
+
self.jit_props = jit_props
|
|
447
|
+
self.jit_static_methods = jit_static_methods
|
|
448
|
+
self.struct = struct
|
|
449
|
+
fielddesc = ",".join("{0}:{1}".format(k, v) for k, v in struct.items())
|
|
450
|
+
name = "{0}.{1}#{2:x}<{3}>".format(
|
|
451
|
+
self.name_prefix, self.class_name, id(self), fielddesc
|
|
452
|
+
)
|
|
453
|
+
super(ClassType, self).__init__(name)
|
|
454
|
+
|
|
455
|
+
def get_call_type(self, context, args, kws):
|
|
456
|
+
return self.ctor_template(context).apply(args, kws)
|
|
457
|
+
|
|
458
|
+
def get_call_signatures(self):
|
|
459
|
+
return (), True
|
|
460
|
+
|
|
461
|
+
def get_impl_key(self, sig):
|
|
462
|
+
return type(self)
|
|
463
|
+
|
|
464
|
+
@property
|
|
465
|
+
def methods(self):
|
|
466
|
+
return {k: v.py_func for k, v in self.jit_methods.items()}
|
|
467
|
+
|
|
468
|
+
@property
|
|
469
|
+
def static_methods(self):
|
|
470
|
+
return {k: v.py_func for k, v in self.jit_static_methods.items()}
|
|
471
|
+
|
|
472
|
+
@property
|
|
473
|
+
def instance_type(self):
|
|
474
|
+
return ClassInstanceType(self)
|
|
475
|
+
|
|
476
|
+
@property
|
|
477
|
+
def ctor_template(self):
|
|
478
|
+
return self._specialize_template(self._ctor_template_class)
|
|
479
|
+
|
|
480
|
+
def _specialize_template(self, basecls):
|
|
481
|
+
return type(basecls.__name__, (basecls,), dict(key=self))
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
class DeferredType(Type):
|
|
485
|
+
"""
|
|
486
|
+
Represents a type that will be defined later. It must be defined
|
|
487
|
+
before it is materialized (used in the compiler). Once defined, it
|
|
488
|
+
behaves exactly as the type it is defining.
|
|
489
|
+
"""
|
|
490
|
+
|
|
491
|
+
def __init__(self):
|
|
492
|
+
self._define = None
|
|
493
|
+
name = "{0}#{1}".format(type(self).__name__, id(self))
|
|
494
|
+
super(DeferredType, self).__init__(name)
|
|
495
|
+
|
|
496
|
+
def get(self):
|
|
497
|
+
if self._define is None:
|
|
498
|
+
raise RuntimeError("deferred type not defined")
|
|
499
|
+
return self._define
|
|
500
|
+
|
|
501
|
+
def define(self, typ):
|
|
502
|
+
if self._define is not None:
|
|
503
|
+
raise TypeError("deferred type already defined")
|
|
504
|
+
if not isinstance(typ, Type):
|
|
505
|
+
raise TypeError("arg is not a Type; got: {0}".format(type(typ)))
|
|
506
|
+
self._define = typ
|
|
507
|
+
|
|
508
|
+
def unify(self, typingctx, other):
|
|
509
|
+
return typingctx.unify_pairs(self.get(), other)
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
class ClassDataType(Type):
|
|
513
|
+
"""
|
|
514
|
+
Internal only.
|
|
515
|
+
Represents the data of the instance. The representation of
|
|
516
|
+
ClassInstanceType contains a pointer to a ClassDataType which represents
|
|
517
|
+
a C structure that contains all the data fields of the class instance.
|
|
518
|
+
"""
|
|
519
|
+
|
|
520
|
+
def __init__(self, classtyp):
|
|
521
|
+
self.class_type = classtyp
|
|
522
|
+
name = "data.{0}".format(self.class_type.name)
|
|
523
|
+
super(ClassDataType, self).__init__(name)
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class ContextManager(Callable, Phantom):
|
|
527
|
+
"""
|
|
528
|
+
An overly-simple ContextManager type that cannot be materialized.
|
|
529
|
+
"""
|
|
530
|
+
|
|
531
|
+
def __init__(self, cm):
|
|
532
|
+
self.cm = cm
|
|
533
|
+
super(ContextManager, self).__init__("ContextManager({})".format(cm))
|
|
534
|
+
|
|
535
|
+
def get_call_signatures(self):
|
|
536
|
+
if not self.cm.is_callable:
|
|
537
|
+
msg = "contextmanager {} is not callable".format(self.cm)
|
|
538
|
+
raise TypingError(msg)
|
|
539
|
+
|
|
540
|
+
return (), False
|
|
541
|
+
|
|
542
|
+
def get_call_type(self, context, args, kws):
|
|
543
|
+
from numba.cuda import typing
|
|
544
|
+
|
|
545
|
+
if not self.cm.is_callable:
|
|
546
|
+
msg = "contextmanager {} is not callable".format(self.cm)
|
|
547
|
+
raise TypingError(msg)
|
|
548
|
+
|
|
549
|
+
posargs = list(args) + [v for k, v in sorted(kws.items())]
|
|
550
|
+
return typing.signature(self, *posargs)
|
|
551
|
+
|
|
552
|
+
def get_impl_key(self, sig):
|
|
553
|
+
return type(self)
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
class UnicodeType(IterableType, Hashable):
|
|
557
|
+
def __init__(self, name):
|
|
558
|
+
super(UnicodeType, self).__init__(name)
|
|
559
|
+
|
|
560
|
+
@property
|
|
561
|
+
def iterator_type(self):
|
|
562
|
+
return UnicodeIteratorType(self)
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class UnicodeIteratorType(SimpleIteratorType):
|
|
566
|
+
def __init__(self, dtype):
|
|
567
|
+
name = "iter_unicode"
|
|
568
|
+
self.data = dtype
|
|
569
|
+
super(UnicodeIteratorType, self).__init__(name, dtype)
|