[PATCH] D30669: [NVPTX] Add an "image" attribute and simplify the NVPTX rdoimage, wroimage, and rdrwimage attributes.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 18:35:09 PST 2017


jlebar added subscribers: tra, arsenm.
jlebar added inline comments.


================
Comment at: include/llvm/IR/Attributes.td:48
 
+/// Argument is an image.
+def Image : EnumAttr<"image">;
----------------
@tra @arsenm, Do you think we should call this "texref", "textureref" or something?  AFAICT what nvptx calls an "image" really means "a texture or surface ref", where the difference between texture and surface refs is that surface refs are writable.


================
Comment at: lib/Target/NVPTX/NVPTXUtilities.cpp:1
+
 //===- NVPTXUtilities.cpp - Utility Functions -----------------------------===//
----------------
Probably didn't mean to make this change?


================
Comment at: lib/Target/NVPTX/NVPTXUtilities.cpp:178
+  if (const Argument *Arg = dyn_cast<Argument>(&val))
+    return Arg->hasAttribute(Attribute::ReadOnly);
   return false;
----------------
Need to check that it's also an image?


================
Comment at: test/CodeGen/NVPTX/surf-read.ll:20
 !1 = !{void (i64, float*, i32)* @foo, !"kernel", i32 1}
-!2 = !{void (i64, float*, i32)* @foo, !"rdwrimage", i32 0}
----------------
(Just as an example of how messed up this old metadata format is: Apparently "i32 0" here means that this *is* an image?  Like, it looks like it's saying "false"!)


https://reviews.llvm.org/D30669





More information about the llvm-commits mailing list