This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Revert 'Don’t marke the .note section as ALLOC'
ClosedPublic

Authored by msearles on Feb 21 2020, 3:47 PM.

Details

Summary

Revert "[AMDGPU] Don’t marke the .note section as ALLOC"

This reverts commit 977cd661cf019039dec7ffdd15bf0ac500828c87.

It breaks OpenCL testing. OpenCL Runtime is using PT_LOAD information
to calculate memory for global variables. This commit should be relanded once
the OpenCL runtime stops relying on PT_LOAD information for calculating global
variable memory size.

Diff Detail

Event Timeline

msearles created this revision.Feb 21 2020, 3:47 PM
This revision is now accepted and ready to land.Feb 21 2020, 3:59 PM
This revision was automatically updated to reflect the committed changes.

Hi Mark, do you have more background on this? Is the OpenCL runtime relying on reading something out of the .note section?

TBH, these were Konstantin's findings; he knows the details.

Mark

t-tye added a comment.Mar 17 2020, 3:00 PM

The NOTE section is currently being used to hold the high level runtime metadata, and that is only being read by the language runtimes and so does not need to be part of the loaded code object. So I do not think this note section should ever be marked as ALLOC.

I suspect the VDI runtime may be trying to determine how much device memory is available by subtracting the size of the code objects it will load. But it seems it would be better to get the information directly from the runtime memory allocator rather than trying to deduce it indirectly. I think part of the reason it does that may be because currently it is deferring loading code objects until they are first used. I do not think that is the right thing to do either as it means asking for a symbol address of a code object that the application thinks is loaded may fail due to the deferred load failing. It would be better for applications not to load vast numbers of code objects that it will never use (which is why deferred loading was implemented).