This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Check output of malloc in the device for debug
ClosedPublic

Authored by jhuber6 on Oct 18 2021, 8:43 AM.

Details

Summary

A common problem is the device running out of global heap memory and
crashing due to a nullptr dereference when using the data sharing stack.
This explicitly checks that a nullptr was not returned by malloc when
debugging field 1 is enabled.

Diff Detail

Event Timeline

jhuber6 created this revision.Oct 18 2021, 8:43 AM
jhuber6 requested review of this revision.Oct 18 2021, 8:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2021, 8:43 AM

We should not make it an assert, or not one that uses the first bit of the debug field. We should add a new bit because this can be valid and properly handled by the user. That said, in the device runtime we could add ASSERT for this in various places that don't handle it otherwise.

We should not make it an assert, or not one that uses the first bit of the debug field. We should add a new bit because this can be valid and properly handled by the user. That said, in the device runtime we could add ASSERT for this in various places that don't handle it otherwise.

I guess this bit could be for extra runtime checks? Not sure what else we could put under that umbrella.

make it a "common issues" bit and we put things in there as we go. Things that are not necessarily wrong or problematic but most often indicate a problem.

jhuber6 updated this revision to Diff 380454.Oct 18 2021, 10:04 AM

Making suggested changes.

This revision is now accepted and ready to land.Oct 29 2021, 9:47 AM
jhuber6 updated this revision to Diff 383411.Oct 29 2021, 10:06 AM

Updating with ASSERT for the runtime usage.

This revision was automatically updated to reflect the committed changes.