Skip to content

Commit

Permalink
Merge pull request #804 from IntelPython/refactor/kernel_interfaces
Browse files Browse the repository at this point in the history
Refactor/kernel interfaces 187782d
  • Loading branch information
github-actions[bot] committed Jan 18, 2023
1 parent f90c4cb commit db50327
Show file tree
Hide file tree
Showing 146 changed files with 4,380 additions and 1,130 deletions.
2 changes: 1 addition & 1 deletion dev/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 6d01fe611eca4871471a05274049ce84
config: e668f2947a425ed930d2934dd29ee719
tags: 645f666f9bcd5a90fca523b33c5a78b7
2 changes: 1 addition & 1 deletion dev/CoreFeatures.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Code-generation based on a device &mdash; numba-dpex 0.19.0+39.gada8f19b documentation</title>
<title>Code-generation based on a device &mdash; numba-dpex 0.19.0+91.g187782d2 documentation</title>



Expand Down
7 changes: 0 additions & 7 deletions dev/_sources/apidoc/numba_dpex.compiler.rst.txt

This file was deleted.

7 changes: 7 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.caching.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.caching module
===============================

.. automodule:: numba_dpex.core.caching
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.compiler.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.compiler module
================================

.. automodule:: numba_dpex.core.compiler
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.kernel\_interface.arg\_pack\_unpacker module
=============================================================

.. automodule:: numba_dpex.core.kernel_interface.arg_pack_unpacker
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.kernel\_interface.dispatcher module
====================================================

.. automodule:: numba_dpex.core.kernel_interface.dispatcher
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.kernel\_interface.func module
==============================================

.. automodule:: numba_dpex.core.kernel_interface.func
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.kernel\_interface.kernel\_base module
======================================================

.. automodule:: numba_dpex.core.kernel_interface.kernel_base
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.kernel_interface.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
numba\_dpex.core.kernel\_interface package
==========================================

Submodules
----------

.. toctree::
:maxdepth: 4

numba_dpex.core.kernel_interface.arg_pack_unpacker
numba_dpex.core.kernel_interface.dispatcher
numba_dpex.core.kernel_interface.func
numba_dpex.core.kernel_interface.kernel_base
numba_dpex.core.kernel_interface.spirv_kernel

Module contents
---------------

.. automodule:: numba_dpex.core.kernel_interface
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.kernel\_interface.spirv\_kernel module
=======================================================

.. automodule:: numba_dpex.core.kernel_interface.spirv_kernel
:members:
:undoc-members:
:show-inheritance:
5 changes: 5 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ Subpackages
:maxdepth: 4

numba_dpex.core.datamodel
numba_dpex.core.kernel_interface
numba_dpex.core.passes
numba_dpex.core.typeconv
numba_dpex.core.types
numba_dpex.core.typing
numba_dpex.core.utils

Submodules
----------

.. toctree::
:maxdepth: 4

numba_dpex.core.caching
numba_dpex.core.compiler
numba_dpex.core.descriptor
numba_dpex.core.exceptions
numba_dpex.core.itanium_mangler
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.typeconv.array\_conversion module
==================================================

.. automodule:: numba_dpex.core.typeconv.array_conversion
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.typeconv.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
numba\_dpex.core.typeconv package
=================================

Submodules
----------

.. toctree::
:maxdepth: 4

numba_dpex.core.typeconv.array_conversion

Module contents
---------------

.. automodule:: numba_dpex.core.typeconv
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.utils.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
numba\_dpex.core.utils package
==============================

Submodules
----------

.. toctree::
:maxdepth: 4

numba_dpex.core.utils.suai_helper

Module contents
---------------

.. automodule:: numba_dpex.core.utils
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions dev/_sources/apidoc/numba_dpex.core.utils.suai_helper.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numba\_dpex.core.utils.suai\_helper module
==========================================

.. automodule:: numba_dpex.core.utils.suai_helper
:members:
:undoc-members:
:show-inheritance:
7 changes: 0 additions & 7 deletions dev/_sources/apidoc/numba_dpex.passbuilder.rst.txt

This file was deleted.

2 changes: 0 additions & 2 deletions dev/_sources/apidoc/numba_dpex.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Submodules
:maxdepth: 4

numba_dpex.codegen
numba_dpex.compiler
numba_dpex.config
numba_dpex.debuginfo
numba_dpex.decorators
Expand All @@ -33,7 +32,6 @@ Submodules
numba_dpex.numpy_usm_shared
numba_dpex.offload_dispatcher
numba_dpex.parfor_diagnostics
numba_dpex.passbuilder
numba_dpex.printimpl
numba_dpex.retarget
numba_dpex.spirv_generator
Expand Down
24 changes: 24 additions & 0 deletions dev/_sources/developer_guides/caching.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. _caching:

Caching Mechanism in Numba-dpex
================================

Caching is done by saving the compiled kernel code, the ELF object of the executable code. By using the kernel code, cached kernels have minimal overhead because no compilation is needed.

Unlike Numba, we do not perform file-based caching, instead we use an Least Recently Used (LRU) caching mechanism. However when a kernel needs to be evicted, we utilize numba's file-based caching mechanism described `here <https://numba.pydata.org/numba-doc/latest/developer/caching.html>`_.

Algorithm
==========

The caching mechanism for Numba-dpex works as follows: The cache is an LRU cache backed by an ordered dictionary mapped onto a doubly linked list. The tail of the list contains the most recently used (MRU) kernel and the head of the list contains the least recently used (LRU) kernel. The list has a fixed size. If a new kernel arrives to be cached and if the size is already on the maximum limit, the algorithm evicts the LRU kernel to make room for the MRU kernel. The evicted item will be serialized and pickled into a file using Numba's caching mechanism.

Everytime whenever a kernel needs to be retrieved from the cache, the mechanism will look for the kernel in the cache and will be loaded if it's already present. However, if the program is seeking for a kernel that has been evicted, the algorithm will load it from the file and enqueue in the cache.

Settings
========

Therefore, we employ similar environment variables as used in Numba, i.e. ``NUMBA_CACHE_DIR`` etc. However we add three more environment variables to control the caching mechanism.

- In order to specify cache capacity, one can use ``NUMBA_DPEX_CACHE_SIZE``. By default, it's set to 10.
- ``NUMBA_DPEX_ENABLE_CACHE`` can be used to enable/disable the caching mechanism. By default it's enabled, i.e. set to 1.
- In order to enable the debugging messages related to caching, one can set ``NUMBA_DPEX_DEBUG_CACHE`` to 1. All environment variables are defined in :file:`numba_dpex/config.py`.
2 changes: 1 addition & 1 deletion dev/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.19.0+39.gada8f19b',
VERSION: '0.19.0+91.g187782d2',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
22 changes: 1 addition & 21 deletions dev/apidoc/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>numba_dpex &mdash; numba-dpex 0.19.0+39.gada8f19b documentation</title>
<title>numba_dpex &mdash; numba-dpex 0.19.0+91.g187782d2 documentation</title>



Expand Down Expand Up @@ -214,28 +214,12 @@ <h1>numba_dpex<a class="headerlink" href="#numba-dpex" title="Permalink to this
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.codegen.html#numba_dpex.codegen.SPIRVCodeLibrary"><code class="docutils literal notranslate"><span class="pre">SPIRVCodeLibrary</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.compiler.html">numba_dpex.compiler module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.Compiler"><code class="docutils literal notranslate"><span class="pre">Compiler</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.DpexFunction"><code class="docutils literal notranslate"><span class="pre">DpexFunction</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.DpexFunctionTemplate"><code class="docutils literal notranslate"><span class="pre">DpexFunctionTemplate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.JitKernel"><code class="docutils literal notranslate"><span class="pre">JitKernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.Kernel"><code class="docutils literal notranslate"><span class="pre">Kernel</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.KernelBase"><code class="docutils literal notranslate"><span class="pre">KernelBase</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.compile_func"><code class="docutils literal notranslate"><span class="pre">compile_func()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.compile_func_template"><code class="docutils literal notranslate"><span class="pre">compile_func_template()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.compile_kernel"><code class="docutils literal notranslate"><span class="pre">compile_kernel()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.compile_kernel_parfor"><code class="docutils literal notranslate"><span class="pre">compile_kernel_parfor()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.compile_with_depx"><code class="docutils literal notranslate"><span class="pre">compile_with_depx()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.compiler.html#numba_dpex.compiler.get_ordered_arg_access_types"><code class="docutils literal notranslate"><span class="pre">get_ordered_arg_access_types()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.config.html">numba_dpex.config module</a></li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.debuginfo.html">numba_dpex.debuginfo module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.debuginfo.html#numba_dpex.debuginfo.DpexDIBuilder"><code class="docutils literal notranslate"><span class="pre">DpexDIBuilder</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.decorators.html">numba_dpex.decorators module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.decorators.html#numba_dpex.decorators.autojit"><code class="docutils literal notranslate"><span class="pre">autojit()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.decorators.html#numba_dpex.decorators.func"><code class="docutils literal notranslate"><span class="pre">func()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.decorators.html#numba_dpex.decorators.kernel"><code class="docutils literal notranslate"><span class="pre">kernel()</span></code></a></li>
</ul>
Expand Down Expand Up @@ -278,10 +262,6 @@ <h1>numba_dpex<a class="headerlink" href="#numba-dpex" title="Permalink to this
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.parfor_diagnostics.html#numba_dpex.parfor_diagnostics.ExtendedParforDiagnostics"><code class="docutils literal notranslate"><span class="pre">ExtendedParforDiagnostics</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.passbuilder.html">numba_dpex.passbuilder module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.passbuilder.html#numba_dpex.passbuilder.PassBuilder"><code class="docutils literal notranslate"><span class="pre">PassBuilder</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="numba_dpex.printimpl.html">numba_dpex.printimpl module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.printimpl.html#numba_dpex.printimpl.const_print_impl"><code class="docutils literal notranslate"><span class="pre">const_print_impl()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="numba_dpex.printimpl.html#numba_dpex.printimpl.declare_print"><code class="docutils literal notranslate"><span class="pre">declare_print()</span></code></a></li>
Expand Down
2 changes: 1 addition & 1 deletion dev/apidoc/numba_dpex.codegen.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>numba_dpex.codegen module &mdash; numba-dpex 0.19.0+39.gada8f19b documentation</title>
<title>numba_dpex.codegen module &mdash; numba-dpex 0.19.0+91.g187782d2 documentation</title>



Expand Down
Loading

0 comments on commit db50327

Please sign in to comment.