This is an archive of the discontinued LLVM Phabricator instance.

[clang] Allow pointers from any address space to gfx90a builtins
AbandonedPublic

Authored by gandhi21299 on Sep 29 2021, 1:21 PM.

Details

Reviewers
yaxunl
rampitec
Summary

Explicitly address space cast the pointer if its address space differs
from the address space of the parameter.

Diff Detail

Event Timeline

gandhi21299 requested review of this revision.Sep 29 2021, 1:21 PM
gandhi21299 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2021, 1:21 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
yaxunl added inline comments.Sep 29 2021, 3:17 PM
clang/test/CodeGenHIP/unsafe-atomic-ops-gfx90a.hip
14

I think we want to check the pointer argument passed to the atomic intrinsics to make sure they have addr space cast if needed. That's what your patch changes.

gandhi21299 marked an inline comment as done.
  • corrected test, address space cast should go under unsafeAtomicAdd(...) codegen
yaxunl added inline comments.Sep 29 2021, 8:53 PM
clang/lib/CodeGen/CGBuiltin.cpp
15764

In https://reviews.llvm.org/D102405 you already inserted an addr space cast in AST when you pass a pointer to default addr space to a builtin expecting a pointer to non-default addr space. This addr space cast in AST will be emitted as addr space cast in IR. Why do you still need to insert addr space cast here?

gandhi21299 abandoned this revision.Sep 30 2021, 10:01 AM