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
Fixes for lineinfo emission #7196
Fixes for lineinfo emission #7196
Conversation
I can confirm that the decref is no longer jumping back to the line of object creation. I used the following code to test the decref DWARF info: @njit(debug=True)
def foo(n):
#gdb()
ar = np.arange(n)
if ar.sum() == 0: # lifetime of ar ends after this line
ret = 2
else:
ret = 3
return ret |
@sklam thanks for checking. I've patched the disassembly support here: stuartarchibald@ee91dd8 to include DWARF info in the disassembly CFG. |
078c95d
to
5c3d7ae
Compare
Cool, i'll try it now |
numba/tests/test_debuginfo.py
Outdated
themod = self.__module__ | ||
thecls = type(self).__name__ | ||
injected_method = f'{themod}.{thecls}.{test_name}' | ||
cmd = [sys.executable, '-m', 'numba.runtests', injected_method] | ||
env_copy = os.environ.copy() | ||
env_copy['SUBPROC_TEST'] = '1' | ||
env_copy['NUMBA_OPT'] = '0' | ||
status = subprocess.run(cmd, stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, timeout=60, | ||
env=env_copy, universal_newlines=True) | ||
self.assertEqual(status.returncode, 0) | ||
self.assertIn('OK', status.stderr) | ||
self.assertTrue('FAIL' not in status.stderr) | ||
self.assertTrue('ERROR' not in status.stderr) |
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.
a duplication of
numba/numba/tests/test_parfors.py
Lines 73 to 86 in 0c499bf
def runner(self): | |
themod = self.__module__ | |
test_clazz_name = self.id().split('.')[-1].split('_')[-1] | |
the_test = f'{themod}.{test_clazz_name}' | |
cmd = [sys.executable, '-m', 'numba.runtests', the_test] | |
env_copy = os.environ.copy() | |
env_copy['SUBPROC_TEST'] = '1' | |
status = subprocess.run(cmd, stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE, timeout=self._TIMEOUT, | |
env=env_copy, universal_newlines=True) | |
self.assertEqual(status.returncode, 0, msg=status.stderr) | |
self.assertIn('OK', status.stderr) | |
self.assertTrue('FAIL' not in status.stderr) | |
self.assertTrue('ERROR' not in status.stderr) |
we should dedup here or in a immediate follow up PR
_exec_cond = os.environ.get('SUBPROC_TEST', None) == '1' | ||
needs_subprocess = unittest.skipUnless(_exec_cond, "needs subprocess harness") |
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.
There's still a copy of this in test_parfors.py
numba/numba/tests/test_parfors.py
Lines 56 to 57 in 2eacea6
_exec_cond = os.environ.get('SUBPROC_TEST', None) == '1' | |
needs_subprocess = unittest.skipUnless(_exec_cond, "needs subprocess harness") |
numba/tests/support.py
Outdated
f'captured stderr: {status.stderr}') | ||
self.assertEqual(status.returncode, 0, streams) | ||
self.assertIn('OK', status.stderr) | ||
self.assertTrue('FAIL' not in status.stderr) |
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.
self.assertTrue('FAIL' not in status.stderr) | |
self.assertNotIn('FAIL', status.stderr) |
numba/tests/support.py
Outdated
self.assertEqual(status.returncode, 0, streams) | ||
self.assertIn('OK', status.stderr) | ||
self.assertTrue('FAIL' not in status.stderr) | ||
self.assertTrue('ERROR' not in status.stderr) |
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.
self.assertTrue('ERROR' not in status.stderr) | |
self.assertNotIn('ERROR', status.stderr) |
numba/tests/test_debuginfo.py
Outdated
if line_stripped.startswith('call void @NRT_decref'): | ||
self.assertRegex(line, r'.*meminfo\.[0-9]+\)$') | ||
count += 1 | ||
self.assertTrue(count > 0) # make sure there were some decrefs! |
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.
self.assertTrue(count > 0) # make sure there were some decrefs! | |
self.assertGreater(count, 0) # make sure there were some decrefs! |
numba/tests/test_debuginfo.py
Outdated
sig = (types.float64[::1],) | ||
full_ir = self._get_llvmir(foo, sig=sig) | ||
|
||
# make sure decref lines end with `meminfo.<number>)`. |
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.
# make sure decref lines end with `meminfo.<number>)`. | |
# make sure decref lines end with `meminfo.<number>)` without dbg info. |
I wonder if we should leave a note about how the tests are sensitive to SSA and lowering behavior such that they may become outdated when those are changed. |
As title.
Good point, I've added one as part of 8f1c198. All other comments should be addressed in there too. Thanks for the review. |
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.
Thanks for the patch!
…_refcounted Fixes for lineinfo emission
As title.
Includes: 2d63784 from #7177 as 3631bdb