Add check/query for virtual memory API support

Checks whether version of libdrm library installed on current
system supports the amdgpu_device_get_fd API. This API is
required to support the virtual memory API functions. The
amdgpu_device_get_fd function was introduced in libdrm-2.4.109.
Using a runtime check test instead of static dependency to be
able to support previous APIs on older versions of libdrm.
Add query for virtual memory API support.

This is part of patch series for Virtual Memory API.

Change-Id: Iec831eb24b5d1689c392e50ae86f4d52d4870ac4
This commit is contained in:
David Yat Sin
2022-12-19 00:29:17 +00:00
parent 3ebe1fdff9
commit e65edb35fc
3 changed files with 50 additions and 1 deletions
+7
View File
@@ -415,6 +415,8 @@ class Runtime {
KfdVersion_t KfdVersion() const { return kfd_version; }
bool VirtualMemApiSupported() const { return virtual_mem_api_supported_; }
protected:
static void AsyncEventsLoop(void*);
@@ -662,6 +664,11 @@ class Runtime {
std::unique_ptr<AMD::SvmProfileControl> svm_profile_;
private:
void CheckVirtualMemApiSupport();
bool virtual_mem_api_supported_;
// Frees runtime memory when the runtime library is unloaded if safe to do so.
// Failure to release the runtime indicates an incorrect application but is
// common (example: calls library routines at process exit).