This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Codegen generation for has_device_addr claues.
ClosedPublic

Authored by jyu2 on Sep 19 2022, 8:06 AM.

Details

Summary

This patch add codegen support for the has_device_addr clause. It use the same logic of is_device_ptr.

Diff Detail

Event Timeline

jyu2 created this revision.Sep 19 2022, 8:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 8:06 AM
jyu2 requested review of this revision.Sep 19 2022, 8:06 AM
jyu2 updated this revision to Diff 461340.Sep 19 2022, 1:43 PM

Fix format problem

This revision is now accepted and ready to land.Sep 19 2022, 1:48 PM
abhinavgaba added inline comments.
clang/test/OpenMP/target_has_device_addr_codegen.cpp
317

This looks the same as is_device_ptr(k). I don't think that's the correct thing to do for has_device_addr(k). For has_device_addr(k), the value being stored to %offload.baseptrs should be i32** [[K]], and not a load from it.

Similarly, the kernel argument should be [[K]] and not [[TMP2]] (which is a load from [[K]]).

openmp/libomptarget/test/mapping/has_device_addr.cpp
19

The clause used here should either be has_device_addr(data_device[0]) or is_device_ptr(data_device). data_device itself is an i32** which is allocated on the host (%data_device = alloca i32*). Its pointee has a device address (%data_device_0 = load i32*, i32** %data_device).

jyu2 added inline comments.Sep 20 2022, 1:50 AM
clang/test/OpenMP/target_has_device_addr_codegen.cpp
317

Good point. I mad change by passing &var to BP instead pointer.

openmp/libomptarget/test/mapping/has_device_addr.cpp
19

Changed. Thanks.