cmd/compile: -race does not obey go:nocheckptr #42880
Comments
Please show exactly what you saw. Thanks. Please also describe exactly how to reproduce the problem. Thanks. |
Updated with what exactly I did, and what I saw |
CC @mdempsky |
A bit more to add. If I understand the Go semantics correctly, the test, as written shouldn't fail the checkptr either. But I am willing to concede that there are parts which I do not know as well |
It's not safe to convert a As for why |
Yeah, this part I am aware of. The only time this is used is for CUDA code, really, which due to some complications, need
Can I put |
You can't. |
In your last message you wrote "A bit more to add. If I understand the Go semantics correctly, the test, as written shouldn't fail the checkptr either." I was explaining why the checkptr error is correct. Your earlier understanding was incorrect.
No. At the moment, You could use a helper function like:
But again, I'll emphasize your test case is in fact unsafe. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (even with
gotip
)What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran a test to test racy behaviours - This function had a checkptr error:
https://github.com/gorgonia/tensor/blob/9166554e0f40794485c199a8ecd4d692d24dbe73/consopt.go#L136-L171
The test is this: https://github.com/gorgonia/tensor/blob/9166554e0f40794485c199a8ecd4d692d24dbe73/consopt_test.go#L19-L33
Most notably, the function had a
//go:nocheckptr
directive attached to it. It's been there for the purpose of CUDA - since CUDA memory is not accessible by the Go runtime (technically it can, but it has to be run on the same thread as the CUDA runtime), I omitted thecheckptr
tests because they are likely to fail.In the past I had manually used
-d=checkptr
. That seems to obey thego:nocheckptr
directive.What I did:
What did you expect to see?
No checkptr errors.
What did you see instead?
The text was updated successfully, but these errors were encountered: