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

Set the max spirv version to 1.1 #885

Merged
merged 1 commit into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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