JIT: illegal Python function (with undefined variable) gives correct kernel by accident
See original GitHub issueOn the current master, the following code compiles and runs:
import cupy as cp
from cupyx import jit
@jit.rawkernel()
def f(b):
laneId = jit.threadIdx.x & 0x1f
if laneId == 0:
value = cp.int64(100)
b[laneId] = value
b = cp.empty((32,), dtype=cp.int64)
f[1, 32](b)
print(b)
print(f.cached_code)
However, a compilation error (better be NameError
or UnboundLocalError
) should be raised by the JIT compiler, because the variable value
is not well defined for all code paths.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Troubleshooting and tips — Numba 0.50.1 documentation
The most common reason for slowness of a compiled JIT function is that compiling in nopython mode has failed and the Numba compiler...
Read more >python - numba nopython mode "Undefined variable '$313.3'"
I tend to profile in a Jupyter notebook using the %timeit magic. When profiling Numba code especially you need to throw out the...
Read more >Release Notes - Numba documentation - Read the Docs
Version 0.52.0 (30 November, 2020)¶. This release focuses on performance improvements, but also adds some new features and contains numerous bug fixes and ......
Read more >Intel®oneAPI ProgrammingGuide
Intel oneAPI Math Kernel Library (oneMKL) . ... Undefined (the SETVARS_CONFIG environment variable does not exist).
Read more >Tree - rpms/kernel - CentOS Git server
This macro does requires, provides, conflicts, obsoletes for a kernel package. ... x86/crash: Correct the address boundary of function parameters (Lianbo ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, @asi1024!
Sorry for my slow action…(still on vacation) I just opened an issue to track this feature request (#5417).
Sounds cool! Not that I am a big fan of such simulators, but I am definitely interested in learning how it’s implemented.
@leofang Sorry for my late response.
Current CuPy JIT already supports
y = numpy.float32(12.)
to specify the dtype of a local variable. We can support more additional styles likey = x.dtype.type(1.)
ory: numpy.float32 = 1
.This feature is still in the planning stage, but it will probably not rely on any CUDA context.