Skip to content

Commit

Permalink
Merge pull request #885 from IntelPython/pin_spirv_max_version
Browse files Browse the repository at this point in the history
Set the max spirv version to 1.1
  • Loading branch information
Diptorup Deb authored Jan 22, 2023
2 parents 9809c95 + 82ed599 commit acacdbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion numba_dpex/spirv_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def generate(self, llvm_spirv_args, ipath, opath):
if config.DEBUG:
llvm_spirv_flags.append("--spirv-debug-info-version=ocl-100")

if not config.NATIVE_FP_ATOMICS:
llvm_spirv_args = ["--spirv-max-version", "1.1"] + llvm_spirv_args
llvm_spirv_tool = self._llvm_spirv()

if config.DEBUG:
Expand All @@ -94,7 +96,7 @@ def _llvm_spirv():
# use llvm-spirv from dpcpp package.
# assume dpcpp from .../bin folder.
# assume llvm-spirv from .../bin-llvm folder.
dpcpp_path = shutil.which("dpcpp")
dpcpp_path = shutil.which("icx")
if dpcpp_path is not None:
bin_llvm = os.path.dirname(dpcpp_path) + "/../bin-llvm/"
bin_llvm = os.path.normpath(bin_llvm)
Expand Down
21 changes: 11 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ def spirv_compile():
]
spirv_args = [
_llvm_spirv(),
"--spirv-max-version",
"1.1",
"numba_dpex/ocl/atomics/atomic_ops.bc",
"-o",
"numba_dpex/ocl/atomics/atomic_ops.spir",
"numba_dpex/ocl/atomics/atomic_ops.bc",
]
subprocess.check_call(
clang_args,
Expand All @@ -140,15 +142,14 @@ def _llvm_spirv():

result = None

if result is None:
# use llvm-spirv from dpcpp package.
# assume dpcpp from .../bin folder.
# assume llvm-spirv from .../bin-llvm folder.
dpcpp_path = shutil.which("dpcpp")
if dpcpp_path is not None:
bin_llvm = os.path.dirname(dpcpp_path) + "/../bin-llvm/"
bin_llvm = os.path.normpath(bin_llvm)
result = shutil.which("llvm-spirv", path=bin_llvm)
# use llvm-spirv from dpcpp package.
# assume dpcpp from .../bin folder.
# assume llvm-spirv from .../bin-llvm folder.
dpcpp_path = shutil.which("icx")
if dpcpp_path is not None:
bin_llvm = os.path.dirname(dpcpp_path) + "/../bin-llvm/"
bin_llvm = os.path.normpath(bin_llvm)
result = shutil.which("llvm-spirv", path=bin_llvm)

if result is None:
result = "llvm-spirv"
Expand Down

0 comments on commit acacdbe

Please sign in to comment.