[PATCH] D106960: [OffloadArch] Library to query properties of current offload archicture

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 14:23:44 PDT 2021


yaxunl added a comment.

This only works on Linux. So either to make it work on both Linux and Windows, or restrict it to Linux in CMakeLists.txt, otherwise it breaks LLVM build on Windows.



================
Comment at: llvm/lib/OffloadArch/OffloadArch.cpp:17
+#include "llvm/Support/WithColor.h"
+#include <dirent.h>
+#include <fstream>
----------------
better to use LLVM or standard C++ functions for directory operations since dirent.h is not available in MSVC. Even though this utility only works on Linux for now, it is better to be platform-neutral to be ported to Windows.


================
Comment at: llvm/lib/OffloadArch/amdgpu/vendor_specific_capabilities.cpp:25
+//
+#include "hsa-subset.h"
+#include <dlfcn.h>
----------------
It would be much simpler to use HIP API to get device name and capabilities e.g. gfx906:xnack+:sramecc-

https://github.com/ROCm-Developer-Tools/HIP/blob/rocm-4.2.x/samples/1_Utils/hipInfo/hipInfo.cpp

It will work on both Linux and Windows. On Linux the availability of HIP runtime is the same as HSA runtime. On Windows HIP runtime is shipped with display driver, whereas HSA runtime is not available.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106960/new/

https://reviews.llvm.org/D106960



More information about the llvm-commits mailing list