Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/IntelPython/numba-dppy into…
Browse files Browse the repository at this point in the history
… move_skips
  • Loading branch information
elena.totmenina committed Dec 2, 2021
2 parents 17274d9 + 343901a commit 695e13a
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 17 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ jobs:
strategy:
matrix:
python: [3.8, 3.9]
numba: [0.54, "0.55.0dev0=*_469"]
numba: ["0.54"]
integration_channels: [""]
experimental: [true] # packages are not available on -c intel yet
experimental: [false]
artifact_name: [""]
dependencies: [""]
include:
Expand All @@ -134,6 +134,18 @@ jobs:
artifact_name: -c dppy_label_dev
experimental: false # current stable
dependencies: ""
- python: "3.8"
numba: "0.55.0dev0=*_782"
integration_channels:
artifact_name: ""
experimental: false # current stable
dependencies: ""
- python: "3.9"
numba: "0.55.0dev0=*_778"
integration_channels: ""
artifact_name: ""
experimental: false # current stable
dependencies: ""
continue-on-error: ${{ matrix.experimental }}
env:
# conda-forge: llvm-spirv 11 not on intel channel yet
Expand Down
1 change: 1 addition & 0 deletions numba_dppy/core/passes/dppy_lowerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,7 @@ def _lower(self, context, library, fndesc, func_ir, metadata):
module=lower.module,
filepath=func_ir.loc.filename,
linkage_name=mangled_qualname,
cgctx=context,
)

return lower
Expand Down
7 changes: 7 additions & 0 deletions numba_dppy/core/passes/dppy_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ def run_pass(self, state):
state.func_id.func_name,
)
with fallback_context(state, msg):
kwargs = {}

# for support numba 0.54 and <=0.55.0dev0=*_469
if hasattr(flags, "get_mangle_string"):
kwargs["abi_tags"] = flags.get_mangle_string()

# Lowering
fndesc = (
funcdesc.PythonFunctionDescriptor.from_specialized_function(
Expand All @@ -306,6 +312,7 @@ def run_pass(self, state):
mangler=targetctx.mangler,
inline=flags.forceinline,
noalias=flags.noalias,
**kwargs,
)
)

Expand Down
44 changes: 35 additions & 9 deletions numba_dppy/dppy_debuginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,48 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import numba as nb
from llvmlite import ir
from numba.core.debuginfo import DIBuilder

from numba_dppy.numba_support import numba_version


class DPPYDIBuilder(DIBuilder):
def __init__(self, module, filepath, linkage_name):
DIBuilder.__init__(self, module, filepath)
def __init__(self, module, filepath, linkage_name, cgctx):
args = []

if numba_version > (0, 54):
args.append(cgctx)

DIBuilder.__init__(self, module, filepath, *args)
self.linkage_name = linkage_name

def mark_subprogram(self, function, name, line):
di_subp = self._add_subprogram(
name=name, linkagename=self.linkage_name, line=line
)
function.set_metadata("dbg", di_subp)
# disable inlining for this function for easier debugging
function.attributes.add("noinline")
if numba_version > (0, 54):

def mark_subprogram(self, function, qualname, argnames, argtypes, line):
name = qualname
argmap = dict(zip(argnames, argtypes))
di_subp = self._add_subprogram(
name=name,
linkagename=self.linkage_name,
line=line,
function=function,
argmap=argmap,
)
function.set_metadata("dbg", di_subp)
# disable inlining for this function for easier debugging
function.attributes.add("noinline")

else:

def mark_subprogram(self, function, name, line):
di_subp = self._add_subprogram(
name=name, linkagename=self.linkage_name, line=line
)
function.set_metadata("dbg", di_subp)
# disable inlining for this function for easier debugging
function.attributes.add("noinline")

def _di_compile_unit(self):
di = super()._di_compile_unit()
Expand Down
12 changes: 9 additions & 3 deletions numba_dppy/extended_numba_itanium_mangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ def mangle_args(argtys):
return "".join([mangle_type_or_value(t) for t in argtys])


def mangle(ident, argtys):
def mangle(ident, argtys, *, abi_tags=()):
"""
Mangle identifier with Numba type objects and arbitrary values.
Mangle identifier with Numba type objects and abi-tags.
"""
kwargs = {}

# for support numba 0.54 and <=0.55.0dev0=*_469
if abi_tags:
kwargs["abi_tags"] = abi_tags

return (
itanium_mangler.PREFIX
+ itanium_mangler.mangle_identifier(ident)
+ itanium_mangler.mangle_identifier(ident, **kwargs)
+ mangle_args(argtys)
)
17 changes: 17 additions & 0 deletions numba_dppy/numba_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import numba as nb

numba_version = tuple(map(int, nb.__version__.split(".")[:2]))
10 changes: 8 additions & 2 deletions numba_dppy/retarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

import dpctl
from numba import njit
from numba.core.dispatcher import TargetConfig

try:
from numba.core.dispatcher import TargetConfigurationStack
except ImportError:
# for support numba 0.54 and <=0.55.0dev0=*_469
from numba.core.dispatcher import TargetConfig as TargetConfigurationStack

from numba.core.retarget import BasicRetarget

from numba_dppy.target import DPPY_TARGET_NAME
Expand Down Expand Up @@ -54,7 +60,7 @@ def _retarget(sycl_queue):
def _retarget_context_manager(sycl_queue):
"""Return context manager for retargeting njit offloading."""
retarget = _retarget(sycl_queue)
return TargetConfig.switch_target(retarget)
return TargetConfigurationStack.switch_target(retarget)


def _register_context_factory():
Expand Down
2 changes: 1 addition & 1 deletion numba_dppy/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def codegen(self):
def target_data(self):
return self._target_data

def mangler(self, name, argtypes):
def mangler(self, name, argtypes, abi_tags=()):
def repl(m):
ch = m.group(0)
return "_%X_" % ord(ch)
Expand Down

0 comments on commit 695e13a

Please sign in to comment.