-
Notifications
You must be signed in to change notification settings - Fork 73
Add arch specific target support #549
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
Changes from 10 commits
fc81a8f
65bfd01
2fa5f7b
5479dd7
3ec37e3
01a378e
d5e0c3d
8e2c34b
0647852
a0d7b7b
29e04ea
02b815a
6fe89f9
2f14dbb
3e8440a
1da2e30
f91c22e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,7 +209,9 @@ def _ensure_cc(self, cc): | |
| return cc | ||
|
|
||
| device = devices.get_context().device | ||
| return device.compute_capability | ||
| cc = device.compute_capability | ||
| cc = (cc[0], cc[1], "a" if cc >= (9, 0) else "") | ||
| return cc | ||
|
Comment on lines
+212
to
+214
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change breaks backward compatibility by modifying
After line 213 executes, The modification should only happen locally within this method and not affect the device's
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The device's compute capability is not being affected. |
||
|
|
||
| def get_asm_str(self, cc=None): | ||
| return "\n".join(self.get_asm_strs(cc=cc)) | ||
|
|
@@ -347,7 +349,7 @@ def get_cufunc(self): | |
| cufunc = self._cufunc_cache.get(device.id, None) | ||
| if cufunc: | ||
| return cufunc | ||
| cubin = self.get_cubin(cc=device.compute_capability) | ||
| cubin = self.get_cubin() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of the explicit However, if the device's compute capability is cached elsewhere or accessed later, there's an inconsistency: the device object still reports a 2-tuple, but compilation uses a 3-tuple. Verify that cached cubins are properly keyed by the 3-tuple to avoid cache misses or incorrect binary selection.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Comment on lines
349
to
+352
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This call was changed from
This change is likely intentional to ensure arch-specific compilation, but it should be noted that this modifies the cache key used for cubin lookups when cc >= 9.0. Old cached cubins compiled before this PR won't be found (cache invalidation). |
||
| module = ctx.create_module_image( | ||
| cubin, self._setup_functions, self._teardown_functions | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2303,7 +2303,11 @@ def __init__( | |
| lto=None, | ||
| additional_flags=None, | ||
| ): | ||
| arch = f"sm_{cc[0]}{cc[1]}" | ||
| if len(cc) == 3: | ||
| arch = f"sm_{cc[0]}{cc[1]}{cc[2]}" | ||
| else: | ||
| arch = f"sm_{cc[0]}{cc[1]}" | ||
|
Comment on lines
+2306
to
+2309
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the nvrtc.py issue, there's no validation that if not isinstance(cc, tuple) or len(cc) not in (2, 3):
raise ValueError(f"cc must be a 2-tuple or 3-tuple, got {cc}")This will provide clearer error messages if invalid input is passed. |
||
|
|
||
| self.max_registers = max_registers if max_registers else None | ||
| self.lineinfo = lineinfo | ||
| self.cc = cc | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,44 @@ def _get_nvrtc_version(): | |||||||||||||||||||||||
| return (major, minor) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def _verify_cc_tuple(cc): | ||||||||||||||||||||||||
| version = _get_nvrtc_version() | ||||||||||||||||||||||||
| ver_str = lambda version: ".".join(str(v) for v in version) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if len(cc) == 3: | ||||||||||||||||||||||||
| cc, arch = (cc[0], cc[1]), cc[2] | ||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
| arch = "" | ||||||||||||||||||||||||
|
Comment on lines
+37
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable shadowing issue: Line 38 reassigns Additionally, this creates a potential bug on line 50 where Suggestion: Use distinct variable names: if len(cc) == 3:
cc_base = (cc[0], cc[1])
arch = cc[2]
else:
cc_base = cc
arch = ""
# Then use cc_base throughout for comparisons
found = max(filter(lambda v: v <= cc_base, [v for v in supported_ccs])) |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if arch not in ("", "a", "f"): | ||||||||||||||||||||||||
| raise ValueError( | ||||||||||||||||||||||||
| f"Invalid architecture suffix '{arch}' in compute capability " | ||||||||||||||||||||||||
| f"{ver_str(cc)}{arch}. Expected '', 'a', or 'f'." | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
Comment on lines
+33
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no validation that Consider adding validation at the start of the function: if not isinstance(cc, tuple) or len(cc) not in (2, 3):
raise ValueError(
f"Compute capability must be a 2-tuple (major, minor) or "
f"3-tuple (major, minor, arch), got {cc}"
) |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| supported_ccs = get_supported_ccs() | ||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| found = max(filter(lambda v: v <= cc, [v for v in supported_ccs])) | ||||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||||
| raise RuntimeError( | ||||||||||||||||||||||||
| f"Device compute capability {ver_str(cc)} is less than the " | ||||||||||||||||||||||||
| f"minimum supported by NVRTC {ver_str(version)}. Supported " | ||||||||||||||||||||||||
| "compute capabilities are " | ||||||||||||||||||||||||
| f"{', '.join([ver_str(v) for v in supported_ccs])}." | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if found != cc: | ||||||||||||||||||||||||
| found = (found[0], found[1], arch) | ||||||||||||||||||||||||
| warnings.warn( | ||||||||||||||||||||||||
| f"Device compute capability {ver_str(cc)} is not supported by " | ||||||||||||||||||||||||
| f"NVRTC {ver_str(version)}. Using {ver_str(found)} instead." | ||||||||||||||||||||||||
|
Comment on lines
+59
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Misleading warning message. When
For example, if a user requests CC 9.5 with "a" suffix on a toolkit that only supports up to 9.0, the code will return (9, 0, "a"). But the warning message is misleading about what's happening. Suggestion: Make the warning more accurate: warnings.warn(
f"Compute capability {ver_str(cc)}{arch} is not supported by "
f"NVRTC {ver_str(version)}. Downgrading to {ver_str(found)} "
f"(closest supported version) with arch suffix '{arch}'."
) |
||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
| found = (cc[0], cc[1], arch) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return found | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def compile(src, name, cc, ltoir=False, lineinfo=False, debug=False): | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| Compile a CUDA C/C++ source to PTX or LTOIR for a given compute capability. | ||||||||||||||||||||||||
|
|
@@ -38,7 +76,8 @@ def compile(src, name, cc, ltoir=False, lineinfo=False, debug=False): | |||||||||||||||||||||||
| :type src: str | ||||||||||||||||||||||||
| :param name: The filename of the source (for information only) | ||||||||||||||||||||||||
| :type name: str | ||||||||||||||||||||||||
| :param cc: A tuple ``(major, minor)`` of the compute capability | ||||||||||||||||||||||||
| :param cc: A tuple ``(major, minor)`` or ``(major, minor, arch)`` of the | ||||||||||||||||||||||||
| compute capability | ||||||||||||||||||||||||
| :type cc: tuple | ||||||||||||||||||||||||
| :param ltoir: Compile into LTOIR if True, otherwise into PTX | ||||||||||||||||||||||||
| :type ltoir: bool | ||||||||||||||||||||||||
|
|
@@ -49,34 +88,18 @@ def compile(src, name, cc, ltoir=False, lineinfo=False, debug=False): | |||||||||||||||||||||||
| :return: The compiled PTX or LTOIR and compilation log | ||||||||||||||||||||||||
| :rtype: tuple | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| found = _verify_cc_tuple(cc) | ||||||||||||||||||||||||
| version = _get_nvrtc_version() | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ver_str = lambda version: ".".join(str(v) for v in version) | ||||||||||||||||||||||||
| supported_ccs = get_supported_ccs() | ||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| found = max(filter(lambda v: v <= cc, [v for v in supported_ccs])) | ||||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||||
| raise RuntimeError( | ||||||||||||||||||||||||
| f"Device compute capability {ver_str(cc)} is less than the " | ||||||||||||||||||||||||
| f"minimum supported by NVRTC {ver_str(version)}. Supported " | ||||||||||||||||||||||||
| "compute capabilities are " | ||||||||||||||||||||||||
| f"{', '.join([ver_str(v) for v in supported_ccs])}." | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if found != cc: | ||||||||||||||||||||||||
| warnings.warn( | ||||||||||||||||||||||||
| f"Device compute capability {ver_str(cc)} is not supported by " | ||||||||||||||||||||||||
| f"NVRTC {ver_str(version)}. Using {ver_str(found)} instead." | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Compilation options: | ||||||||||||||||||||||||
| # - Compile for the current device's compute capability. | ||||||||||||||||||||||||
| # - The CUDA include path is added. | ||||||||||||||||||||||||
| # - Relocatable Device Code (rdc) is needed to prevent device functions | ||||||||||||||||||||||||
| # being optimized away. | ||||||||||||||||||||||||
| major, minor = found | ||||||||||||||||||||||||
| major, minor = found[0], found[1] | ||||||||||||||||||||||||
| cc_arch = found[2] if len(found) == 3 else "" | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check
Suggested change
This makes the code clearer and avoids the unnecessary conditional. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Comment on lines
+99
to
+100
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary defensive check: If you want to keep it for safety, consider simplifying to just Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| arch = f"sm_{major}{minor}" | ||||||||||||||||||||||||
| arch = f"sm_{major}{minor}{cc_arch}" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| cuda_include_dir = get_cuda_paths()["include_dir"].info | ||||||||||||||||||||||||
| cuda_includes = [f"{cuda_include_dir}"] | ||||||||||||||||||||||||
|
|
@@ -156,7 +179,7 @@ def write(self, msg): | |||||||||||||||||||||||
| return result, log | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def find_closest_arch(mycc): | ||||||||||||||||||||||||
| def find_closest_arch(cc): | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| Given a compute capability, return the closest compute capability supported | ||||||||||||||||||||||||
| by the CUDA toolkit. | ||||||||||||||||||||||||
|
|
@@ -166,17 +189,17 @@ def find_closest_arch(mycc): | |||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| supported_ccs = get_supported_ccs() | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for i, cc in enumerate(supported_ccs): | ||||||||||||||||||||||||
| if cc == mycc: | ||||||||||||||||||||||||
| for i, supported_cc in enumerate(supported_ccs): | ||||||||||||||||||||||||
| if supported_cc == cc: | ||||||||||||||||||||||||
| # Matches | ||||||||||||||||||||||||
| return cc | ||||||||||||||||||||||||
| elif cc > mycc: | ||||||||||||||||||||||||
| return supported_cc | ||||||||||||||||||||||||
| elif supported_cc > cc: | ||||||||||||||||||||||||
| # Exceeded | ||||||||||||||||||||||||
| if i == 0: | ||||||||||||||||||||||||
| # CC lower than supported | ||||||||||||||||||||||||
| msg = ( | ||||||||||||||||||||||||
| "GPU compute capability %d.%d is not supported" | ||||||||||||||||||||||||
| "(requires >=%d.%d)" % (mycc + cc) | ||||||||||||||||||||||||
| "(requires >=%d.%d)" % (cc + supported_cc) | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
Comment on lines
200
to
203
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tuple concatenation syntax error will cause runtime crash. The expression This should be:
Suggested change
Note: This bug exists in both the original and modified code at this location. The refactoring changed the parameter name from
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is correct, but fixing it is low-priority and should be done outside this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upon re-reading the comment, I think it is bogus. |
||||||||||||||||||||||||
| raise CCSupportError(msg) | ||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
|
|
@@ -187,13 +210,13 @@ def find_closest_arch(mycc): | |||||||||||||||||||||||
| return supported_ccs[-1] # Choose the highest | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def get_arch_option(major, minor): | ||||||||||||||||||||||||
| def get_arch_option(major, minor, arch=""): | ||||||||||||||||||||||||
| """Matches with the closest architecture option""" | ||||||||||||||||||||||||
| if config.FORCE_CUDA_CC: | ||||||||||||||||||||||||
| arch = config.FORCE_CUDA_CC | ||||||||||||||||||||||||
| major, minor = config.FORCE_CUDA_CC | ||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
| arch = find_closest_arch((major, minor)) | ||||||||||||||||||||||||
| return "compute_%d%d" % arch | ||||||||||||||||||||||||
| major, minor = find_closest_arch((major, minor)) | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When Consider preserving the arch suffix:
Suggested change
This ensures that if someone calls
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think arch should be discarded when |
||||||||||||||||||||||||
| return f"compute_{major}{minor}{arch}" | ||||||||||||||||||||||||
|
Comment on lines
+213
to
+235
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic inconsistency: When Example problematic scenario: # User calls: get_arch_option(9, 0, "f")
# With FORCE_CUDA_CC = (9, 0, "a")
# Result: returns "compute_90a" (ignoring the "f" that was passed in)The function signature suggests Recommendation: Either:
Based on the test at line 443-446 which expects the FORCE_CUDA_CC arch to be used, option 1 seems intended, so add documentation. |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def get_lowest_supported_cc(): | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |||||||||||||||||||||
| # SPDX-License-Identifier: BSD-2-Clause | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| from ctypes import c_int, sizeof | ||||||||||||||||||||||
| import cffi | ||||||||||||||||||||||
| import numpy as np | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| from numba.cuda.cudadrv.driver import host_to_device, device_to_host, driver | ||||||||||||||||||||||
| from numba.cuda._compat import ( | ||||||||||||||||||||||
|
|
@@ -13,10 +15,12 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| from numba import cuda | ||||||||||||||||||||||
| from numba.cuda.cudadrv import devices | ||||||||||||||||||||||
| from numba.cuda.testing import unittest, CUDATestCase | ||||||||||||||||||||||
| from numba.cuda.testing import unittest, CUDATestCase, skip_unless_cc_90 | ||||||||||||||||||||||
| from numba.cuda.testing import skip_on_cudasim | ||||||||||||||||||||||
| from numba.core import types | ||||||||||||||||||||||
| import contextlib | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ptx1 = """ | ||||||||||||||||||||||
| .version 1.4 | ||||||||||||||||||||||
| .target sm_10, map_f64_to_f32 | ||||||||||||||||||||||
|
|
@@ -390,5 +394,46 @@ def test_device_get_uuid(self): | |||||||||||||||||||||
| self.assertRegex(dev.uuid, uuid_format) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @skip_unless_cc_90 | ||||||||||||||||||||||
| @skip_on_cudasim("CUDA asm unsupported in the simulator") | ||||||||||||||||||||||
| class TestAcceleratedArchitecture(CUDATestCase): | ||||||||||||||||||||||
| def test_device_arch_specific(self): | ||||||||||||||||||||||
| set_desc = cuda.CUSource(""" | ||||||||||||||||||||||
| #include <cuda_fp16.h> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| extern "C" __device__ | ||||||||||||||||||||||
| int set_descriptor(int *out, int* smem) { | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The C function signature has 2 parameters ( The first parameter
Suggested change
This makes the C signature match the Python declaration which expects a single pointer parameter. |
||||||||||||||||||||||
| unsigned usmem = __cvta_generic_to_shared(smem); | ||||||||||||||||||||||
| asm volatile("tensormap.replace.tile.rank.shared::cta.b1024.b32 [%0], 2;" :: "r"(usmem)); | ||||||||||||||||||||||
| return 0; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| """) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| set_descriptor = cuda.declare_device( | ||||||||||||||||||||||
| "set_descriptor", | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not an error, the Numba calling convention specifies that the return value is stored into the value pointed to by the first argument. |
||||||||||||||||||||||
| types.int32(types.CPointer(types.int32)), | ||||||||||||||||||||||
| link=[set_desc], | ||||||||||||||||||||||
|
Comment on lines
+413
to
+416
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The If this is intentional for testing that the architecture-specific instruction compiles and runs, consider renaming the function to reflect what it actually does, or remove the unused parameter.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's intentional for testing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, this is updating a TMA descriptor, so the name seems appropriate.
Comment on lines
+413
to
+416
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P0] Function signature mismatch causes runtime error. The C function
Comment on lines
+405
to
+416
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The C function Looking at the C implementation, the extern "C" __device__
int set_descriptor(int* smem) {
// ... rest of implementation
}Or if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because of the Numba ABI. |
||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
+413
to
+417
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function signature is incorrect. The The signature should be:
Suggested change
Or if two parameters are needed, the C code should be updated to actually use both parameters. |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ffi = cffi.FFI() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @cuda.jit | ||||||||||||||||||||||
| def kernel(a): | ||||||||||||||||||||||
| sm = cuda.shared.array(1, dtype=np.int32) | ||||||||||||||||||||||
| data_ptr = ffi.from_buffer(sm) | ||||||||||||||||||||||
| set_descriptor(data_ptr) | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P0] Function call missing required parameter. |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # just to prevent optimization: | ||||||||||||||||||||||
| sm[0] = 2 | ||||||||||||||||||||||
| cuda.syncthreads() | ||||||||||||||||||||||
| a[0] = sm[0] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| a = np.ones(1, dtype=np.int32) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| kernel[1, 1](a) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| assert a[0] == 2 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||
| unittest.main() | ||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded logic for automatic arch suffix assignment: The code automatically assigns "a" suffix for all cc >= 9.0. However:
Consider either: