[llvm] [Offload] Add device UID (PR #164391)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 10:22:22 PDT 2025


================
@@ -1524,11 +1527,18 @@ Error GenericDeviceTy::enqueueHostCall(void (*Callback)(void *), void *UserData,
   return Err;
 }
 
+Expected<InfoTreeNode> GenericDeviceTy::obtainInfo() {
+  Expected<InfoTreeNode> Info = obtainInfoImpl();
+  if (Info)
+    Info->add("UID", DeviceUid, "", DeviceInfo::UID);
+  return Info;
+}
+
 Error GenericDeviceTy::printInfo() {
-  auto Info = obtainInfoImpl();
+  Expected<InfoTreeNode> Info = obtainInfo();
 
   // Get the vendor-specific info entries describing the device properties.
-  if (auto Err = Info.takeError())
+  if (Error Err = Info.takeError())
----------------
shiltian wrote:

This isn't something significant, so I won't insist. This case is more about personal preference. You can find both styles used quite a bit in the LLVM codebase. In the AMDGPU backend code review, we usually "kill" all use of `auto` (the only two exceptions are iterator and cast), but since this isn't AMDGPU backend code, I'll leave it to you folks.

https://github.com/llvm/llvm-project/pull/164391


More information about the llvm-commits mailing list