mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Rework printing tensor aliases in CSAN error message (#85008)
Small rework of how the error message is formatted, introduces a distinction between the arguments and the output of kernels. Verified manually on multiple examples that the message is printed as expected. Pull Request resolved: https://github.com/pytorch/pytorch/pull/85008 Approved by: https://github.com/lw
This commit is contained in:
committed by
PyTorch MergeBot
parent
3eb27229dd
commit
b70c254ebb
@ -117,13 +117,14 @@ class TestArgumentHandler(TestCase):
|
||||
argument_handler.parse_outputs(out)
|
||||
|
||||
self.assertEqual(
|
||||
argument_handler.tensor_names,
|
||||
argument_handler.tensor_aliases,
|
||||
{
|
||||
M.data_ptr(): ["self"],
|
||||
vec.data_ptr(): ["vec1", "vec2"],
|
||||
out.data_ptr(): ["output"],
|
||||
out.data_ptr(): [],
|
||||
},
|
||||
)
|
||||
self.assertEqual({out.data_ptr()}, argument_handler.outputs)
|
||||
|
||||
|
||||
def tensor_id(i: int) -> DataPtr:
|
||||
@ -156,6 +157,7 @@ class TestEventHandler(TestCase):
|
||||
stream,
|
||||
read_only,
|
||||
read_write,
|
||||
{},
|
||||
"",
|
||||
{k: [""] for k in read_only + read_write},
|
||||
)
|
||||
@ -446,7 +448,8 @@ class TestMessages(TestCase):
|
||||
seq_num=1,
|
||||
stream=stream_id(1),
|
||||
operator="schema",
|
||||
names=["b"],
|
||||
aliases=["b"],
|
||||
is_output=True,
|
||||
stack_trace=traceback.StackSummary.from_list(
|
||||
[("file", 0, "name", "trace a")]
|
||||
),
|
||||
@ -456,7 +459,8 @@ class TestMessages(TestCase):
|
||||
seq_num=2,
|
||||
stream=stream_id(0),
|
||||
operator="schema",
|
||||
names=["a"],
|
||||
aliases=["a"],
|
||||
is_output=False,
|
||||
stack_trace=traceback.StackSummary.from_list(
|
||||
[("file", 0, "name", "trace b")]
|
||||
),
|
||||
@ -477,14 +481,14 @@ class TestMessages(TestCase):
|
||||
CSAN detected a possible data race on tensor with data pointer 1
|
||||
Access by stream 1001 during kernel:
|
||||
schema
|
||||
writing to argument: b
|
||||
writing to argument(s) b, and to the output
|
||||
With stack trace:
|
||||
File "file", line 0, in name
|
||||
trace a
|
||||
|
||||
Previous access by stream 1000 during kernel:
|
||||
schema
|
||||
reading from argument: a
|
||||
reading from argument(s) a
|
||||
With stack trace:
|
||||
File "file", line 0, in name
|
||||
trace b
|
||||
|
Reference in New Issue
Block a user