-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for prange reduction loops to numba-dpex.
- Adds a template to generate a tree-reduction kernel for reduction loops that use the "+" or "*" operators. - Adds code generation for nd-range kernels in the parfor lowerer. - Refactoring of the parfor lowerer and kernel builder modules. - New unit test cases.
- Loading branch information
1 parent
65b06c9
commit c9f9bc7
Showing
11 changed files
with
1,783 additions
and
80 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
numba_dpex/core/utils/kernel_templates/kernel_template_iface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-FileCopyrightText: 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import abc | ||
|
||
|
||
class KernelTemplateInterface(metaclass=abc.ABCMeta): | ||
@classmethod | ||
def __subclasshook__(cls, subclass): | ||
return hasattr( | ||
callable(subclass._generate_kernel_stub_as_string) | ||
and callable(subclass._generate_kernel_ir) | ||
and callable(subclass.dump_kernel_string) | ||
and callable(subclass.dump_kernel_ir) | ||
and hasattr(subclass, "kernel_ir") | ||
and hasattr(subclass, "kernel_string") | ||
) | ||
|
||
@abc.abstractmethod | ||
def _generate_kernel_stub_as_string(self): | ||
"""Generates as a string a stub for a numba_dpex kernel function""" | ||
raise NotImplementedError | ||
|
||
@abc.abstractmethod | ||
def _generate_kernel_ir(self): | ||
raise NotImplementedError | ||
|
||
@abc.abstractmethod | ||
def dump_kernel_string(self): | ||
raise NotImplementedError | ||
|
||
@abc.abstractmethod | ||
def dump_kernel_ir(self): | ||
raise NotImplementedError | ||
|
||
@property | ||
@abc.abstractmethod | ||
def kernel_ir(self): | ||
raise NotImplementedError | ||
|
||
@property | ||
@abc.abstractmethod | ||
def kernel_string(self): | ||
raise NotImplementedError |
Oops, something went wrong.