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,454 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
"""
|
|
4
|
+
Tests for SSA reconstruction
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import copy
|
|
9
|
+
import logging
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
|
|
13
|
+
from numba.cuda import types
|
|
14
|
+
from numba import cuda
|
|
15
|
+
from numba.cuda import jit
|
|
16
|
+
from numba.cuda.core import errors
|
|
17
|
+
|
|
18
|
+
from numba.cuda.extending import overload
|
|
19
|
+
from numba.cuda.tests.support import override_config
|
|
20
|
+
from numba.cuda.testing import CUDATestCase, skip_on_cudasim
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
_DEBUG = False
|
|
24
|
+
|
|
25
|
+
if _DEBUG:
|
|
26
|
+
# Enable debug logger on SSA reconstruction
|
|
27
|
+
ssa_logger = logging.getLogger("numba.cuda.core.ssa")
|
|
28
|
+
ssa_logger.setLevel(level=logging.DEBUG)
|
|
29
|
+
ssa_logger.addHandler(logging.StreamHandler(sys.stderr))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class SSABaseTest(CUDATestCase):
|
|
33
|
+
"""
|
|
34
|
+
This class comes from numba tests, but has been modified to work with CUDA kernels.
|
|
35
|
+
Return values were replaced by output arrays, and tuple returns assign to elements of the output array.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def check_func(self, func, result_array, *args):
|
|
39
|
+
# For CUDA kernels, we need to create output arrays and call with [1,1] launch config
|
|
40
|
+
# Create GPU array with same shape as expected result array
|
|
41
|
+
gpu_result_array = cuda.to_device(np.zeros_like(result_array))
|
|
42
|
+
|
|
43
|
+
# Call the CUDA kernel
|
|
44
|
+
func[1, 1](gpu_result_array, *copy.deepcopy(args))
|
|
45
|
+
gpu_result = gpu_result_array.copy_to_host()
|
|
46
|
+
|
|
47
|
+
# Call the original Python function for expected result
|
|
48
|
+
cpu_result = np.zeros_like(result_array)
|
|
49
|
+
func.py_func(cpu_result, *copy.deepcopy(args))
|
|
50
|
+
|
|
51
|
+
# Compare all results
|
|
52
|
+
np.testing.assert_array_equal(gpu_result, cpu_result)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class TestSSA(SSABaseTest):
|
|
56
|
+
"""
|
|
57
|
+
Contains tests to help isolate problems in SSA
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
def test_argument_name_reused(self):
|
|
61
|
+
@jit
|
|
62
|
+
def foo(result, x):
|
|
63
|
+
x += 1
|
|
64
|
+
result[0] = x
|
|
65
|
+
|
|
66
|
+
self.check_func(foo, np.array([124.0]), 123)
|
|
67
|
+
|
|
68
|
+
def test_if_else_redefine(self):
|
|
69
|
+
@jit
|
|
70
|
+
def foo(result, x, y):
|
|
71
|
+
z = x * y
|
|
72
|
+
if x < y:
|
|
73
|
+
z = x
|
|
74
|
+
else:
|
|
75
|
+
z = y
|
|
76
|
+
result[0] = z
|
|
77
|
+
|
|
78
|
+
self.check_func(foo, np.array([2.0]), 3, 2)
|
|
79
|
+
self.check_func(foo, np.array([2.0]), 2, 3)
|
|
80
|
+
|
|
81
|
+
def test_sum_loop(self):
|
|
82
|
+
@jit
|
|
83
|
+
def foo(result, n):
|
|
84
|
+
c = 0
|
|
85
|
+
for i in range(n):
|
|
86
|
+
c += i
|
|
87
|
+
result[0] = c
|
|
88
|
+
|
|
89
|
+
self.check_func(foo, np.array([0.0]), 0)
|
|
90
|
+
self.check_func(foo, np.array([45.0]), 10)
|
|
91
|
+
|
|
92
|
+
def test_sum_loop_2vars(self):
|
|
93
|
+
@jit
|
|
94
|
+
def foo(result, n):
|
|
95
|
+
c = 0
|
|
96
|
+
d = n
|
|
97
|
+
for i in range(n):
|
|
98
|
+
c += i
|
|
99
|
+
d += n
|
|
100
|
+
result[0] = c
|
|
101
|
+
result[1] = d
|
|
102
|
+
|
|
103
|
+
self.check_func(foo, np.array([0.0, 0.0]), 0)
|
|
104
|
+
self.check_func(foo, np.array([45.0, 110.0]), 10)
|
|
105
|
+
|
|
106
|
+
def test_sum_2d_loop(self):
|
|
107
|
+
@jit
|
|
108
|
+
def foo(result, n):
|
|
109
|
+
c = 0
|
|
110
|
+
for i in range(n):
|
|
111
|
+
for j in range(n):
|
|
112
|
+
c += j
|
|
113
|
+
c += i
|
|
114
|
+
result[0] = c
|
|
115
|
+
|
|
116
|
+
self.check_func(foo, np.array([0.0]), 0)
|
|
117
|
+
self.check_func(foo, np.array([495.0]), 10)
|
|
118
|
+
|
|
119
|
+
def check_undefined_var(self, should_warn):
|
|
120
|
+
@jit
|
|
121
|
+
def foo(result, n):
|
|
122
|
+
if n:
|
|
123
|
+
if n > 0:
|
|
124
|
+
c = 0
|
|
125
|
+
result[0] = c
|
|
126
|
+
else:
|
|
127
|
+
# variable c is not defined in this branch
|
|
128
|
+
c += 1
|
|
129
|
+
result[0] = c
|
|
130
|
+
|
|
131
|
+
if should_warn:
|
|
132
|
+
with self.assertWarns(errors.NumbaWarning) as warns:
|
|
133
|
+
# n=1 so we won't actually run the branch with the uninitialized
|
|
134
|
+
self.check_func(foo, np.array([0]), 1)
|
|
135
|
+
self.assertIn(
|
|
136
|
+
"Detected uninitialized variable c", str(warns.warning)
|
|
137
|
+
)
|
|
138
|
+
else:
|
|
139
|
+
self.check_func(foo, np.array([0]), 1)
|
|
140
|
+
|
|
141
|
+
with self.assertRaises(UnboundLocalError):
|
|
142
|
+
result = np.array([0])
|
|
143
|
+
foo.py_func(result, 0)
|
|
144
|
+
|
|
145
|
+
@skip_on_cudasim(
|
|
146
|
+
"Numba variable warnings are not supported in the simulator"
|
|
147
|
+
)
|
|
148
|
+
def test_undefined_var(self):
|
|
149
|
+
with override_config("ALWAYS_WARN_UNINIT_VAR", 0):
|
|
150
|
+
self.check_undefined_var(should_warn=False)
|
|
151
|
+
with override_config("ALWAYS_WARN_UNINIT_VAR", 1):
|
|
152
|
+
self.check_undefined_var(should_warn=True)
|
|
153
|
+
|
|
154
|
+
def test_phi_propagation(self):
|
|
155
|
+
@jit
|
|
156
|
+
def foo(result, actions):
|
|
157
|
+
n = 1
|
|
158
|
+
|
|
159
|
+
i = 0
|
|
160
|
+
ct = 0
|
|
161
|
+
while n > 0 and i < len(actions):
|
|
162
|
+
n -= 1
|
|
163
|
+
|
|
164
|
+
while actions[i]:
|
|
165
|
+
if actions[i]:
|
|
166
|
+
if actions[i]:
|
|
167
|
+
n += 10
|
|
168
|
+
actions[i] -= 1
|
|
169
|
+
else:
|
|
170
|
+
if actions[i]:
|
|
171
|
+
n += 20
|
|
172
|
+
actions[i] += 1
|
|
173
|
+
|
|
174
|
+
ct += n
|
|
175
|
+
ct += n
|
|
176
|
+
result[0] = ct
|
|
177
|
+
result[1] = n
|
|
178
|
+
|
|
179
|
+
self.check_func(foo, np.array([1, 2]), np.array([1, 2]))
|
|
180
|
+
|
|
181
|
+
def test_unhandled_undefined(self):
|
|
182
|
+
@cuda.jit
|
|
183
|
+
def function1(arg1, arg2, arg3, arg4, arg5):
|
|
184
|
+
# This function is auto-generated.
|
|
185
|
+
if arg1:
|
|
186
|
+
var1 = arg2
|
|
187
|
+
var2 = arg3
|
|
188
|
+
var3 = var2
|
|
189
|
+
var4 = arg1
|
|
190
|
+
return
|
|
191
|
+
else:
|
|
192
|
+
if arg2:
|
|
193
|
+
if arg4:
|
|
194
|
+
var5 = arg4 # noqa: F841
|
|
195
|
+
return
|
|
196
|
+
else:
|
|
197
|
+
var6 = var4
|
|
198
|
+
return
|
|
199
|
+
return var6
|
|
200
|
+
else:
|
|
201
|
+
if arg5:
|
|
202
|
+
if var1:
|
|
203
|
+
if arg5:
|
|
204
|
+
var1 = var6
|
|
205
|
+
return
|
|
206
|
+
else:
|
|
207
|
+
var7 = arg2 # noqa: F841
|
|
208
|
+
return arg2
|
|
209
|
+
return
|
|
210
|
+
else:
|
|
211
|
+
if var2:
|
|
212
|
+
arg5 = arg2
|
|
213
|
+
return arg1
|
|
214
|
+
else:
|
|
215
|
+
var6 = var3
|
|
216
|
+
return var4
|
|
217
|
+
return
|
|
218
|
+
return
|
|
219
|
+
else:
|
|
220
|
+
var8 = var1
|
|
221
|
+
return
|
|
222
|
+
return var8
|
|
223
|
+
var9 = var3 # noqa: F841
|
|
224
|
+
var10 = arg5 # noqa: F841
|
|
225
|
+
return var1
|
|
226
|
+
|
|
227
|
+
NONE_SENTINEL = 99
|
|
228
|
+
|
|
229
|
+
@cuda.jit
|
|
230
|
+
def function1_caller(result, arg1, arg2, arg3, arg4, arg5):
|
|
231
|
+
retval = function1(arg1, arg2, arg3, arg4, arg5)
|
|
232
|
+
if retval is None:
|
|
233
|
+
result[0] = NONE_SENTINEL
|
|
234
|
+
else:
|
|
235
|
+
result[0] = retval
|
|
236
|
+
|
|
237
|
+
# The argument values is not critical for re-creating the bug
|
|
238
|
+
# because the bug is in compile-time.
|
|
239
|
+
|
|
240
|
+
expect = function1.py_func(2, 3, 6, 0, 7)
|
|
241
|
+
if expect is None:
|
|
242
|
+
expect = NONE_SENTINEL
|
|
243
|
+
result = np.zeros(1, dtype=np.int64)
|
|
244
|
+
function1_caller[1, 1](result, 2, 3, 6, 0, 7)
|
|
245
|
+
got = result[0]
|
|
246
|
+
self.assertEqual(expect, got)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class TestReportedSSAIssues(SSABaseTest):
|
|
250
|
+
# Tests from issues
|
|
251
|
+
# https://github.com/numba/numba/issues?q=is%3Aopen+is%3Aissue+label%3ASSA
|
|
252
|
+
|
|
253
|
+
def test_issue2194(self):
|
|
254
|
+
@jit
|
|
255
|
+
def foo(result, V):
|
|
256
|
+
s = np.uint32(1)
|
|
257
|
+
|
|
258
|
+
for i in range(s):
|
|
259
|
+
V[i] = 1
|
|
260
|
+
for i in range(s, 1):
|
|
261
|
+
pass
|
|
262
|
+
result[0] = V[0]
|
|
263
|
+
|
|
264
|
+
V = np.empty(1)
|
|
265
|
+
self.check_func(foo, np.array([1.0]), V)
|
|
266
|
+
|
|
267
|
+
def test_issue3094(self):
|
|
268
|
+
@jit
|
|
269
|
+
def foo(result, pred):
|
|
270
|
+
if pred:
|
|
271
|
+
x = 1
|
|
272
|
+
else:
|
|
273
|
+
x = 0
|
|
274
|
+
result[0] = x
|
|
275
|
+
|
|
276
|
+
self.check_func(foo, np.array([0]), False)
|
|
277
|
+
|
|
278
|
+
def test_issue3931(self):
|
|
279
|
+
@jit
|
|
280
|
+
def foo(result, arr):
|
|
281
|
+
for i in range(1):
|
|
282
|
+
arr = arr.reshape(3 * 2)
|
|
283
|
+
arr = arr.reshape(3, 2)
|
|
284
|
+
# Copy result array elements
|
|
285
|
+
for i in range(arr.shape[0]):
|
|
286
|
+
for j in range(arr.shape[1]):
|
|
287
|
+
result[i, j] = arr[i, j]
|
|
288
|
+
|
|
289
|
+
result_gpu = np.zeros((3, 2))
|
|
290
|
+
self.check_func(foo, result_gpu, np.zeros((3, 2)))
|
|
291
|
+
|
|
292
|
+
def test_issue3976(self):
|
|
293
|
+
def overload_this(a):
|
|
294
|
+
return 42
|
|
295
|
+
|
|
296
|
+
@jit
|
|
297
|
+
def foo(result, a):
|
|
298
|
+
if a:
|
|
299
|
+
s = 5
|
|
300
|
+
s = overload_this(s)
|
|
301
|
+
else:
|
|
302
|
+
s = 99
|
|
303
|
+
|
|
304
|
+
result[0] = s
|
|
305
|
+
|
|
306
|
+
@overload(overload_this)
|
|
307
|
+
def ol(a):
|
|
308
|
+
return overload_this
|
|
309
|
+
|
|
310
|
+
self.check_func(foo, np.array([42]), True)
|
|
311
|
+
|
|
312
|
+
def test_issue3979(self):
|
|
313
|
+
@jit
|
|
314
|
+
def foo(result, A, B):
|
|
315
|
+
x = A[0]
|
|
316
|
+
y = B[0]
|
|
317
|
+
for i in A:
|
|
318
|
+
x = i
|
|
319
|
+
for i in B:
|
|
320
|
+
y = i
|
|
321
|
+
result[0] = x
|
|
322
|
+
result[1] = y
|
|
323
|
+
|
|
324
|
+
self.check_func(
|
|
325
|
+
foo, np.array([2, 4]), np.array([1, 2]), np.array([3, 4])
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
def test_issue5219(self):
|
|
329
|
+
def overload_this(a, b=None):
|
|
330
|
+
if isinstance(b, tuple):
|
|
331
|
+
b = b[0]
|
|
332
|
+
return b
|
|
333
|
+
|
|
334
|
+
@overload(overload_this)
|
|
335
|
+
def ol(a, b=None):
|
|
336
|
+
b_is_tuple = isinstance(b, (types.Tuple, types.UniTuple))
|
|
337
|
+
|
|
338
|
+
def impl(a, b=None):
|
|
339
|
+
if b_is_tuple is True:
|
|
340
|
+
b = b[0]
|
|
341
|
+
return b
|
|
342
|
+
|
|
343
|
+
return impl
|
|
344
|
+
|
|
345
|
+
@jit
|
|
346
|
+
def test_tuple(result, a, b):
|
|
347
|
+
result[0] = overload_this(a, b)
|
|
348
|
+
|
|
349
|
+
self.check_func(test_tuple, np.array([2]), 1, (2,))
|
|
350
|
+
|
|
351
|
+
def test_issue5223(self):
|
|
352
|
+
@jit
|
|
353
|
+
def bar(result, x):
|
|
354
|
+
if len(x) == 5:
|
|
355
|
+
for i in range(len(x)):
|
|
356
|
+
result[i] = x[i]
|
|
357
|
+
else:
|
|
358
|
+
# Manual copy since .copy() not available in CUDA
|
|
359
|
+
for i in range(len(x)):
|
|
360
|
+
result[i] = x[i] + 1
|
|
361
|
+
|
|
362
|
+
a = np.ones(5)
|
|
363
|
+
a.flags.writeable = False
|
|
364
|
+
expected = np.ones(5) # Since len(a) == 5, it should return unchanged
|
|
365
|
+
self.check_func(bar, expected, a)
|
|
366
|
+
|
|
367
|
+
def test_issue5243(self):
|
|
368
|
+
@jit
|
|
369
|
+
def foo(result, q, lin):
|
|
370
|
+
stencil_val = 0.0 # noqa: F841
|
|
371
|
+
stencil_val = q[0, 0] # noqa: F841
|
|
372
|
+
result[0] = lin[0]
|
|
373
|
+
|
|
374
|
+
lin = np.array([0.1, 0.6, 0.3])
|
|
375
|
+
self.check_func(foo, np.array([0.1]), np.zeros((2, 2)), lin)
|
|
376
|
+
|
|
377
|
+
def test_issue5482_missing_variable_init(self):
|
|
378
|
+
# Test error that lowering fails because variable is missing
|
|
379
|
+
# a definition before use.
|
|
380
|
+
@jit
|
|
381
|
+
def foo(result, x, v, n):
|
|
382
|
+
for i in range(n):
|
|
383
|
+
if i == 0:
|
|
384
|
+
if i == x:
|
|
385
|
+
pass
|
|
386
|
+
else:
|
|
387
|
+
problematic = v
|
|
388
|
+
else:
|
|
389
|
+
if i == x:
|
|
390
|
+
pass
|
|
391
|
+
else:
|
|
392
|
+
problematic = problematic + v
|
|
393
|
+
result[0] = problematic
|
|
394
|
+
|
|
395
|
+
self.check_func(foo, np.array([10]), 1, 5, 3)
|
|
396
|
+
|
|
397
|
+
def test_issue5493_unneeded_phi(self):
|
|
398
|
+
# Test error that unneeded phi is inserted because variable does not
|
|
399
|
+
# have a dominance definition.
|
|
400
|
+
data = (np.ones(2), np.ones(2))
|
|
401
|
+
A = np.ones(1)
|
|
402
|
+
B = np.ones(1)
|
|
403
|
+
|
|
404
|
+
@jit
|
|
405
|
+
def foo(res, m, n, data):
|
|
406
|
+
if len(data) == 1:
|
|
407
|
+
v0 = data[0]
|
|
408
|
+
else:
|
|
409
|
+
v0 = data[0]
|
|
410
|
+
# Unneeded PHI node for `problematic` would be placed here
|
|
411
|
+
for _ in range(1, len(data)):
|
|
412
|
+
v0[0] += A[0]
|
|
413
|
+
|
|
414
|
+
for t in range(1, m):
|
|
415
|
+
for idx in range(n):
|
|
416
|
+
t = B
|
|
417
|
+
|
|
418
|
+
if idx == 0:
|
|
419
|
+
if idx == n - 1:
|
|
420
|
+
pass
|
|
421
|
+
else:
|
|
422
|
+
res[0] = t[0]
|
|
423
|
+
else:
|
|
424
|
+
if idx == n - 1:
|
|
425
|
+
pass
|
|
426
|
+
else:
|
|
427
|
+
res[0] += t[0]
|
|
428
|
+
|
|
429
|
+
self.check_func(foo, np.array([10]), 10, 10, data)
|
|
430
|
+
|
|
431
|
+
def test_issue5623_equal_statements_in_same_bb(self):
|
|
432
|
+
def foo(pred, stack):
|
|
433
|
+
i = 0
|
|
434
|
+
c = 1
|
|
435
|
+
|
|
436
|
+
if pred is True:
|
|
437
|
+
stack[i] = c
|
|
438
|
+
i += 1
|
|
439
|
+
stack[i] = c
|
|
440
|
+
i += 1
|
|
441
|
+
|
|
442
|
+
python = np.array([0, 666])
|
|
443
|
+
foo(True, python)
|
|
444
|
+
|
|
445
|
+
nb = np.array([0, 666])
|
|
446
|
+
|
|
447
|
+
# Convert to CUDA kernel
|
|
448
|
+
foo_cuda = jit(foo)
|
|
449
|
+
foo_cuda[1, 1](True, nb)
|
|
450
|
+
|
|
451
|
+
expect = np.array([1, 1])
|
|
452
|
+
|
|
453
|
+
np.testing.assert_array_equal(python, expect)
|
|
454
|
+
np.testing.assert_array_equal(nb, expect)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from numba.cuda.testing import (
|
|
5
|
+
skip_on_cudasim,
|
|
6
|
+
skip_unless_cudasim,
|
|
7
|
+
unittest,
|
|
8
|
+
CUDATestCase,
|
|
9
|
+
)
|
|
10
|
+
from numba import cuda
|
|
11
|
+
|
|
12
|
+
# Basic tests that stream APIs execute on the hardware and in the simulator.
|
|
13
|
+
#
|
|
14
|
+
# Correctness of semantics is exercised elsewhere in the test suite (though we
|
|
15
|
+
# could improve the comprehensiveness of testing by adding more correctness
|
|
16
|
+
# tests here in future).
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TestStreamAPI(CUDATestCase):
|
|
20
|
+
def test_stream_create_and_sync(self):
|
|
21
|
+
s = cuda.stream()
|
|
22
|
+
s.synchronize()
|
|
23
|
+
|
|
24
|
+
def test_default_stream_create_and_sync(self):
|
|
25
|
+
s = cuda.default_stream()
|
|
26
|
+
s.synchronize()
|
|
27
|
+
|
|
28
|
+
def test_legacy_default_stream_create_and_sync(self):
|
|
29
|
+
s = cuda.legacy_default_stream()
|
|
30
|
+
s.synchronize()
|
|
31
|
+
|
|
32
|
+
def test_ptd_stream_create_and_sync(self):
|
|
33
|
+
s = cuda.per_thread_default_stream()
|
|
34
|
+
s.synchronize()
|
|
35
|
+
|
|
36
|
+
@skip_on_cudasim("External streams are unsupported on the simulator")
|
|
37
|
+
def test_external_stream_create(self):
|
|
38
|
+
# A dummy pointer value
|
|
39
|
+
ptr = 0x12345678
|
|
40
|
+
s = cuda.external_stream(ptr)
|
|
41
|
+
# We don't test synchronization on the stream because it's not a real
|
|
42
|
+
# stream - we used a dummy pointer for testing the API, so we just
|
|
43
|
+
# ensure that the stream handle matches the external stream pointer.
|
|
44
|
+
value = s.handle.value
|
|
45
|
+
self.assertEqual(ptr, value)
|
|
46
|
+
|
|
47
|
+
@skip_unless_cudasim("External streams are usable with hardware")
|
|
48
|
+
def test_external_stream_simulator_unavailable(self):
|
|
49
|
+
ptr = 0x12345678
|
|
50
|
+
msg = "External streams are unsupported in the simulator"
|
|
51
|
+
with self.assertRaisesRegex(RuntimeError, msg):
|
|
52
|
+
cuda.external_stream(ptr)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
unittest.main()
|