Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@func decorator qualname ambiguation fix #905

Merged
merged 3 commits into from
Feb 12, 2023

Conversation

chudur-budur
Copy link
Contributor

@chudur-budur chudur-budur commented Feb 7, 2023

Fixes #898.

Please refer to the issue for more details.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

@chudur-budur
Copy link
Contributor Author

This WIP has an issue. The unit test is here.

If we run directly, it passes.

 python numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py
/localdisk/work/akmkhale/opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/__init__.py:3: UserWarning: The module `llvmlite.llvmpy` is deprecated and will be removed in the future.
  warnings.warn(
/localdisk/work/akmkhale/opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/core.py:8: UserWarning: The module `llvmlite.llvmpy.core` is deprecated and will be removed in the future. Equivalent functionality is provided by `llvmlite.ir`.
  warnings.warn(
[[1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]]
[[1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]]

If we run it as an idenpendent unit test, it passes:

pytest numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py
===================================== test session starts =====================================
platform linux -- Python 3.9.16, pytest-7.1.2, pluggy-1.0.0
rootdir: /localdisk/work/akmkhale/numba-dpex, configfile: setup.cfg
plugins: xdist-3.2.0, cov-4.0.0
collected 1 item

numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py .                    [100%]

====================================== warnings summary =======================================
../opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/__init__.py:3
  /localdisk/work/akmkhale/opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/__init__.py:3: UserWarning: The module `llvmlite.llvmpy` is deprecated and will be removed in the future.
    warnings.warn(

../opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/core.py:8
  /localdisk/work/akmkhale/opt/anaconda3/envs/ndpx-main/lib/python3.9/site-packages/llvmlite/llvmpy/core.py:8: UserWarning: The module `llvmlite.llvmpy.core` is deprecated and will be removed in the future. Equivalent functionality is provided by `llvmlite.ir`.
    warnings.warn(

numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py::test_qualname_basic
  /localdisk/work/akmkhale/numba-dpex/numba_dpex/decorators.py:43: DeprecationWarning: Access specifiers apply only to NumPy ndarrays. Support for NumPy ndarray objects as kernel arguments and access specifiers flags is deprecated. Use dpctl.tensor.usm_ndarray based arrays instead.
    return JitKernel(

numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py::test_qualname_basic
  /localdisk/work/akmkhale/numba-dpex/numba_dpex/ocl/atomics/atomic_helper.py:31: DeprecationWarning: private variables, such as '_sycl_memory_order__consume_unsupported', will be normal attributes in 3.10
    __consume_unsupported = auto()

numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py::test_qualname_basic
  /localdisk/work/akmkhale/numba-dpex/numba_dpex/core/kernel_interface/dispatcher.py:272: DeprecationWarning: dpctl.SyclDevice.max_work_item_sizes is deprecated, use dpctl.SyclDevice.max_work_item_sizes3d instead
    self._check_size(i, local_range[i], device.max_work_item_sizes[i])

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.9.16-final-0 -----------
Name                                                    Stmts   Miss Branch BrPart   Cover
------------------------------------------------------------------------------------------
numba_dpex/__init__.py                                     15      1      2      1  88.24%
numba_dpex/config.py                                       44     11      4      2  72.92%
numba_dpex/core/__init__.py                                 4      0      0      0 100.00%
numba_dpex/core/caching.py                                186     91     70      9  44.53%
numba_dpex/core/codegen.py                                 43      2      6      1  93.88%
numba_dpex/core/compiler.py                                30      5      8      3  73.68%
numba_dpex/core/datamodel/__init__.py                       0      0      0      0 100.00%
numba_dpex/core/datamodel/models.py                        26      0      0      0 100.00%
numba_dpex/core/descriptor.py                              35      4      0      0  88.57%
numba_dpex/core/dpjit_dispatcher.py                         9      9      0      0   0.00%
numba_dpex/core/dpnp_ndarray/__init__.py                    0      0      0      0 100.00%
numba_dpex/core/dpnp_ndarray/dpnp_empty.py                112     94     20      0  13.64%
numba_dpex/core/exceptions.py                              98     58     16      0  35.09%
numba_dpex/core/itanium_mangler.py                         86     61     34      0  20.83%
numba_dpex/core/kernel_interface/__init__.py                1      0      0      0 100.00%
numba_dpex/core/kernel_interface/arg_pack_unpacker.py     104     51     46      3  41.33%
numba_dpex/core/kernel_interface/dispatcher.py            196     78    101     25  53.20%
numba_dpex/core/kernel_interface/func.py                   76     27     18      3  59.57%
numba_dpex/core/kernel_interface/kernel_base.py            19      1      0      0  94.74%
numba_dpex/core/kernel_interface/spirv_kernel.py           58     13     14      4  68.06%
numba_dpex/core/kernel_interface/utils.py                  91     65     24      5  26.96%
numba_dpex/core/offload_dispatcher.py                      17      8      2      0  47.37%
numba_dpex/core/passes/__init__.py                          0      0      0      0 100.00%
numba_dpex/core/passes/dufunc_inliner.py                   66     60     30      0   6.25%
numba_dpex/core/passes/lowerer.py                         686    626    278      0   6.22%
numba_dpex/core/passes/passes.py                          192    101     72      4  45.08%
numba_dpex/core/passes/rename_numpy_functions_pass.py     142    106     34      0  22.73%
numba_dpex/core/pipelines/__init__.py                       0      0      0      0 100.00%
numba_dpex/core/pipelines/kernel_compiler.py               71      1     14      7  90.59%
numba_dpex/core/pipelines/offload_compiler.py              80     61     14      0  20.21%
numba_dpex/core/targets/__init__.py                         0      0      0      0 100.00%
numba_dpex/core/targets/dpjit_target.py                    10      1      0      0  90.00%
numba_dpex/core/targets/kernel_target.py                  211     20     30      3  89.63%
numba_dpex/core/typeconv/__init__.py                        2      0      0      0 100.00%
numba_dpex/core/typeconv/array_conversion.py               11      6      0      0  45.45%
numba_dpex/core/types/__init__.py                           6      0      0      0 100.00%
numba_dpex/core/types/array_type.py                        28     16     10      0  31.58%
numba_dpex/core/types/dpnp_ndarray_type.py                  3      0      0      0 100.00%
numba_dpex/core/types/numba_types_short_names.py           19      0      0      0 100.00%
numba_dpex/core/types/usm_ndarray_type.py                  62     30     32      4  38.30%
numba_dpex/core/typing/__init__.py                          1      0      0      0 100.00%
numba_dpex/core/typing/typeof.py                           35     11      0      0  68.57%
numba_dpex/core/utils/__init__.py                           2      0      0      0 100.00%
numba_dpex/core/utils/suai_helper.py                       73      8      4      1  88.31%
numba_dpex/debuginfo.py                                    29     29      4      0   0.00%
numba_dpex/decorators.py                                   58     31     28      5  37.21%
numba_dpex/device_init.py                                   8      0      0      0 100.00%
numba_dpex/dpctl_iface/__init__.py                         12      0      0      0 100.00%
numba_dpex/dpctl_iface/_helpers.py                         20     18     14      0   5.88%
numba_dpex/dpctl_iface/dpctl_capi_fn_builder.py            48     23      0      0  52.08%
numba_dpex/dpctl_iface/dpctl_function_types.py             31      0      0      0 100.00%
numba_dpex/dpctl_iface/kernel_launch_ops.py               119    105     20      0  10.07%
numba_dpex/dpctl_support.py                                 2      0      0      0 100.00%
numba_dpex/dpnp_iface/__init__.py                          15      7      2      1  52.94%
numba_dpex/dpnp_iface/dpnp_array_creations_impl.py         66     47      4      0  27.14%
numba_dpex/dpnp_iface/dpnp_array_ops_impl.py               60     41      2      0  30.65%
numba_dpex/dpnp_iface/dpnp_indexing.py                     21     11      2      0  43.48%
numba_dpex/dpnp_iface/dpnp_linalgimpl.py                  157    128     50      0  14.01%
numba_dpex/dpnp_iface/dpnp_logic.py                        17      7      0      0  58.82%
numba_dpex/dpnp_iface/dpnp_manipulation.py                 17      7      0      0  58.82%
numba_dpex/dpnp_iface/dpnp_randomimpl.py                  373    310     84      0  13.79%
numba_dpex/dpnp_iface/dpnp_sort_search_countimpl.py        48     31      0      0  35.42%
numba_dpex/dpnp_iface/dpnp_statisticsimpl.py               66     46      6      0  27.78%
numba_dpex/dpnp_iface/dpnp_transcendentalsimpl.py          39     22      0      0  43.59%
numba_dpex/dpnp_iface/dpnpdecl.py                          22      5      6      0  82.14%
numba_dpex/dpnp_iface/dpnpimpl.py                          32     15      0      0  53.12%
numba_dpex/dpnp_iface/stubs.py                            137      0      0      0 100.00%
numba_dpex/initialize.py                                   18      3      4      2  77.27%
numba_dpex/numba_support.py                                 2      2      0      0   0.00%
numba_dpex/numpy_usm_shared.py                            512    273    184     10  44.40%
numba_dpex/ocl/__init__.py                                  1      0      0      0 100.00%
numba_dpex/ocl/atomics/__init__.py                         17     12      6      0  21.74%
numba_dpex/ocl/atomics/atomic_helper.py                    60     26     22      0  41.46%
numba_dpex/ocl/mathdecl.py                                192     36      2      0  81.44%
numba_dpex/ocl/mathimpl.py                                 51      7      6      1  85.96%
numba_dpex/ocl/ocldecl.py                                 153     55     66      0  61.19%
numba_dpex/ocl/oclimpl.py                                 287    219     78      0  18.63%
numba_dpex/ocl/stubs.py                                    39     11      0      0  71.79%
numba_dpex/parfor_diagnostics.py                           93     88     40      0   3.76%
numba_dpex/printimpl.py                                    57     38      8      0  29.23%
numba_dpex/retarget.py                                     34     15      2      0  52.78%
numba_dpex/spirv_generator.py                             128     53     30     10  55.06%
numba_dpex/utils/__init__.py                                6      0      0      0 100.00%
numba_dpex/utils/array_utils.py                            68     58     39      0   9.35%
numba_dpex/utils/constants.py                              12      0      0      0 100.00%
numba_dpex/utils/llvm_codegen_helpers.py                   24      7      0      0  70.83%
numba_dpex/utils/type_conversion_fns.py                     8      2      0      0  75.00%
numba_dpex/vectorizers.py                                 106     76     22      0  23.44%
------------------------------------------------------------------------------------------
TOTAL                                                    6215   3490   1614    104  38.70%

================================ 1 passed, 5 warnings in 1.40s ================================

But when it is run in part of a folder, the unit test fails:

pytest numba_dpex/tests/kernel_tests -s
===================================== test session starts =====================================
platform linux -- Python 3.9.16, pytest-7.1.2, pluggy-1.0.0
rootdir: /localdisk/work/akmkhale/numba-dpex, configfile: setup.cfg
plugins: xdist-3.2.0, cov-4.0.0
collected 283 items

numba_dpex/tests/kernel_tests/test_arg_accessor.py ............
numba_dpex/tests/kernel_tests/test_arg_types.py ...............
numba_dpex/tests/kernel_tests/test_atomic_op.py ........................................................................................................................s.s.s.s.s.s.s.s.
numba_dpex/tests/kernel_tests/test_barrier.py .........
numba_dpex/tests/kernel_tests/test_caching.py ...
numba_dpex/tests/kernel_tests/test_compute_follows_data.py ..........................
numba_dpex/tests/kernel_tests/test_func_qualname_disambiguation.py [[1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]
 [1 1 1 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0]]
[[ 1  1  1  3  4  5  6  7  8  9]
 [ 1 11 12 13 14 15 16 17 18 19]
 [ 1  1  1 23 24 25 26 27 28 29]
 [ 1 31 32 33 34 35 36 37 38 39]
 [ 1  1  1 43 44 45 46 47 48 49]
 [ 1 51 52 53 54 55 56 57 58 59]
 [ 1  1  1 63 64 65 66 67 68 69]
 [ 1 71 72 73 74 75 76 77 78 79]
 [ 1  1  1 83 84 85 86 87 88 89]
 [ 1 91 92 93 94 95 96 97 98 99]]
F

@chudur-budur chudur-budur force-pushed the github-898 branch 2 times, most recently from bd9a38b to a767e36 Compare February 10, 2023 07:23
@chudur-budur chudur-budur marked this pull request as ready for review February 10, 2023 07:26
@chudur-budur chudur-budur self-assigned this Feb 10, 2023
@diptorupd
Copy link
Contributor

LGTM! @fcharras can you confirm that it fixes your issue?

@diptorupd
Copy link
Contributor

@chudur-budur please squash all commits into one.

@diptorupd diptorupd merged commit 3961684 into IntelPython:main Feb 12, 2023
@diptorupd diptorupd deleted the github-898 branch February 12, 2023 19:50
github-actions bot added a commit that referenced this pull request Feb 12, 2023
* @func decorator qualname disambiguation fix
* Added a unit test case 3961684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimal reproducer for regression in #804
2 participants