This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][NFCI] Embed the source location string size in the ident_t
ClosedPublic

Authored by jdoerfert on Nov 3 2021, 10:29 AM.

Details

Summary

One of the unused ident_t fields now holds the size of the string
(=const char *) field so we have an easier time dealing with those
in the future.

Diff Detail

Event Timeline

jdoerfert created this revision.Nov 3 2021, 10:29 AM
jdoerfert requested review of this revision.Nov 3 2021, 10:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2021, 10:29 AM
jdoerfert updated this revision to Diff 384513.Nov 3 2021, 10:31 AM

Include OpenMP-Opt changes

jdoerfert updated this revision to Diff 384554.Nov 3 2021, 12:12 PM

Include the clang changes

Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2021, 12:12 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

update tests

I'm not convinced. std::strlen can do the job. Can you explain more why need it?

I'm not convinced. std::strlen can do the job. Can you explain more why need it?

Because the ident_t is on the device and you want to grab it from the host.

I'm not convinced. std::strlen can do the job. Can you explain more why need it?

Because the ident_t is on the device and you want to grab it from the host.

So you mean strlen is not available on device?

I'm not convinced. std::strlen can do the job. Can you explain more why need it?

Because the ident_t is on the device and you want to grab it from the host.

So you mean strlen is not available on device?

We have a device pointer to an ident_t object. We don't know the corresponding host address and we are on the host. We can copy over the ident_t with a single d2h but for the string we now need to either launch a kernel that computes strlen on the device or copy it byte-by-byte, neither are good options. Instead, we can simply embed the string length in the otherwise unused ident_t field and copy it over with a second d2h memcpy.

tianshilei1992 accepted this revision.Dec 28 2021, 9:17 PM

I'm not convinced. std::strlen can do the job. Can you explain more why need it?

Because the ident_t is on the device and you want to grab it from the host.

So you mean strlen is not available on device?

We have a device pointer to an ident_t object. We don't know the corresponding host address and we are on the host. We can copy over the ident_t with a single d2h but for the string we now need to either launch a kernel that computes strlen on the device or copy it byte-by-byte, neither are good options. Instead, we can simply embed the string length in the otherwise unused ident_t field and copy it over with a second d2h memcpy.

I see. Yeah, we don't have the map. Then that makes sense.

This revision is now accepted and ready to land.Dec 28 2021, 9:17 PM
This revision was landed with ongoing or failed builds.Dec 28 2021, 9:54 PM
This revision was automatically updated to reflect the committed changes.