2022-02-25 11:22:25 -08:00
|
|
|
/* Copyright (c) 2018 - 2022 Advanced Micro Devices, Inc.
|
2020-02-04 08:45:01 -08:00
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
THE SOFTWARE. */
|
2018-02-27 18:38:56 -05:00
|
|
|
|
|
|
|
|
#include <hip/hip_runtime.h>
|
2023-11-29 15:50:10 -05:00
|
|
|
#include <hip/hip_deprecated.h>
|
2018-02-27 18:38:56 -05:00
|
|
|
|
|
|
|
|
#include "hip_internal.hpp"
|
2022-03-28 12:30:04 -04:00
|
|
|
#include "hip_mempool_impl.hpp"
|
2023-12-15 18:19:58 -05:00
|
|
|
#include "hip_platform.hpp"
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
#undef hipGetDeviceProperties
|
|
|
|
|
#undef hipDeviceProp_t
|
|
|
|
|
|
2020-04-09 12:44:21 -07:00
|
|
|
namespace hip {
|
|
|
|
|
|
2020-05-01 09:22:31 -04:00
|
|
|
// ================================================================================================
|
2024-01-08 17:42:55 +00:00
|
|
|
hip::Stream* Device::NullStream(bool wait) {
|
2024-02-06 08:09:21 +00:00
|
|
|
if (null_stream_ == nullptr) {
|
|
|
|
|
amd::ScopedLock lock(lock_);
|
|
|
|
|
if (null_stream_ == nullptr) {
|
|
|
|
|
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
|
|
|
|
|
}
|
2023-02-08 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
if (null_stream_ == nullptr) {
|
2020-04-23 16:54:48 -04:00
|
|
|
return nullptr;
|
2020-04-09 12:44:21 -07:00
|
|
|
}
|
2024-01-08 17:42:55 +00:00
|
|
|
if (wait == true) {
|
|
|
|
|
// Wait for all active streams before executing commands on the default
|
|
|
|
|
iHipWaitActiveStreams(null_stream_);
|
|
|
|
|
}
|
2023-02-08 20:18:11 +00:00
|
|
|
return null_stream_;
|
2020-04-09 12:44:21 -07:00
|
|
|
}
|
|
|
|
|
|
2022-03-28 12:30:04 -04:00
|
|
|
// ================================================================================================
|
|
|
|
|
bool Device::Create() {
|
|
|
|
|
// Create default memory pool
|
|
|
|
|
default_mem_pool_ = new MemoryPool(this);
|
|
|
|
|
if (default_mem_pool_ == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-02-23 11:27:47 -05:00
|
|
|
|
|
|
|
|
// Create graph memory pool
|
|
|
|
|
graph_mem_pool_ = new MemoryPool(this);
|
|
|
|
|
if (graph_mem_pool_ == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-04 14:54:19 -04:00
|
|
|
if (!HIP_MEM_POOL_USE_VM) {
|
|
|
|
|
uint64_t max_size = std::numeric_limits<uint64_t>::max();
|
|
|
|
|
// Use maximum value to hold memory, because current implementation doesn't support VM
|
|
|
|
|
// Note: the call for the threshold is always successful
|
|
|
|
|
auto error = graph_mem_pool_->SetAttribute(hipMemPoolAttrReleaseThreshold, &max_size);
|
|
|
|
|
}
|
2023-02-23 11:27:47 -05:00
|
|
|
|
2022-03-28 12:30:04 -04:00
|
|
|
// Current is default pool after device creation
|
|
|
|
|
current_mem_pool_ = default_mem_pool_;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================================================================================================
|
|
|
|
|
void Device::AddMemoryPool(MemoryPool* pool) {
|
2022-04-14 19:04:01 -04:00
|
|
|
amd::ScopedLock lock(lock_);
|
2022-03-28 12:30:04 -04:00
|
|
|
if (auto it = mem_pools_.find(pool); it == mem_pools_.end()) {
|
|
|
|
|
mem_pools_.insert(pool);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================================================================================================
|
|
|
|
|
void Device::RemoveMemoryPool(MemoryPool* pool) {
|
2022-04-14 19:04:01 -04:00
|
|
|
amd::ScopedLock lock(lock_);
|
2022-03-28 12:30:04 -04:00
|
|
|
if (auto it = mem_pools_.find(pool); it != mem_pools_.end()) {
|
|
|
|
|
mem_pools_.erase(it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================================================================================================
|
|
|
|
|
bool Device::FreeMemory(amd::Memory* memory, Stream* stream) {
|
2022-04-14 19:04:01 -04:00
|
|
|
amd::ScopedLock lock(lock_);
|
2022-03-28 12:30:04 -04:00
|
|
|
// Search for memory in the entire list of pools
|
2023-02-23 11:27:47 -05:00
|
|
|
for (auto it : mem_pools_) {
|
2022-03-28 12:30:04 -04:00
|
|
|
if (it->FreeMemory(memory, stream)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================================================================================================
|
2023-12-19 11:54:29 -05:00
|
|
|
void Device::ReleaseFreedMemory() {
|
2022-04-14 19:04:01 -04:00
|
|
|
amd::ScopedLock lock(lock_);
|
2022-03-28 12:30:04 -04:00
|
|
|
// Search for memory in the entire list of pools
|
2023-02-23 11:27:47 -05:00
|
|
|
for (auto it : mem_pools_) {
|
2023-12-19 11:54:29 -05:00
|
|
|
it->ReleaseFreedMemory();
|
2022-03-28 12:30:04 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-14 19:04:01 -04:00
|
|
|
// ================================================================================================
|
|
|
|
|
void Device::RemoveStreamFromPools(Stream* stream) {
|
|
|
|
|
amd::ScopedLock lock(lock_);
|
|
|
|
|
// Update all pools with the destroyed stream
|
2023-02-23 11:27:47 -05:00
|
|
|
for (auto it : mem_pools_) {
|
2022-04-14 19:04:01 -04:00
|
|
|
it->RemoveStream(stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 00:02:20 -04:00
|
|
|
// ================================================================================================
|
|
|
|
|
void Device::Reset() {
|
2023-01-23 18:06:18 -05:00
|
|
|
{
|
|
|
|
|
amd::ScopedLock lock(lock_);
|
|
|
|
|
auto it = mem_pools_.begin();
|
|
|
|
|
while (it != mem_pools_.end()) {
|
|
|
|
|
auto current = it++;
|
|
|
|
|
(*current)->ReleaseAllMemory();
|
|
|
|
|
delete *current;
|
|
|
|
|
}
|
|
|
|
|
mem_pools_.clear();
|
2022-09-29 00:02:20 -04:00
|
|
|
}
|
|
|
|
|
flags_ = hipDeviceScheduleSpin;
|
|
|
|
|
hip::Stream::destroyAllStreams(deviceId_);
|
|
|
|
|
amd::MemObjMap::Purge(devices()[0]);
|
|
|
|
|
Create();
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 12:30:04 -04:00
|
|
|
// ================================================================================================
|
|
|
|
|
Device::~Device() {
|
|
|
|
|
if (default_mem_pool_ != nullptr) {
|
|
|
|
|
default_mem_pool_->release();
|
|
|
|
|
}
|
2023-02-08 20:18:11 +00:00
|
|
|
|
2023-02-23 11:27:47 -05:00
|
|
|
if (graph_mem_pool_ != nullptr) {
|
|
|
|
|
graph_mem_pool_->release();
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
if (null_stream_ != nullptr) {
|
2023-03-22 19:14:15 -04:00
|
|
|
hip::Stream::Destroy(null_stream_);
|
2023-02-08 20:18:11 +00:00
|
|
|
}
|
2022-03-28 12:30:04 -04:00
|
|
|
}
|
|
|
|
|
|
2022-04-05 17:26:42 -07:00
|
|
|
void ihipDestroyDevice() {
|
2022-02-25 11:22:25 -08:00
|
|
|
for (auto deviceHandle : g_devices) {
|
|
|
|
|
delete deviceHandle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-10 11:48:00 -08:00
|
|
|
hipError_t ihipDeviceGet(hipDevice_t* device, int deviceId) {
|
2022-06-23 15:33:22 -04:00
|
|
|
if (device == nullptr) {
|
|
|
|
|
return hipErrorInvalidValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (deviceId < 0 || static_cast<size_t>(deviceId) >= g_devices.size()) {
|
2021-12-10 11:48:00 -08:00
|
|
|
return hipErrorInvalidDevice;
|
2018-02-27 18:38:56 -05:00
|
|
|
}
|
2022-06-23 15:33:22 -04:00
|
|
|
|
2021-02-05 05:40:41 -05:00
|
|
|
*device = deviceId;
|
2021-12-10 11:48:00 -08:00
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t hipDeviceGet(hipDevice_t* device, int deviceId) {
|
|
|
|
|
HIP_INIT_API(hipDeviceGet, device, deviceId);
|
|
|
|
|
|
|
|
|
|
HIP_RETURN(ihipDeviceGet(device, deviceId));
|
|
|
|
|
}
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
hipError_t hipDeviceTotalMem(size_t* bytes, hipDevice_t device) {
|
2019-10-07 11:55:30 -04:00
|
|
|
HIP_INIT_API(hipDeviceTotalMem, bytes, device);
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
if (device < 0 || static_cast<size_t>(device) >= g_devices.size()) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidDevice);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bytes == nullptr) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
2018-03-03 21:02:59 -05:00
|
|
|
const auto& info = deviceHandle->info();
|
|
|
|
|
|
|
|
|
|
*bytes = info.globalMemSize_;
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipSuccess);
|
2018-02-27 18:38:56 -05:00
|
|
|
}
|
|
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
hipError_t hipDeviceComputeCapability(int* major, int* minor, hipDevice_t device) {
|
2019-10-07 11:55:30 -04:00
|
|
|
HIP_INIT_API(hipDeviceComputeCapability, major, minor, device);
|
2018-03-01 22:57:20 -05:00
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
if (device < 0 || static_cast<size_t>(device) >= g_devices.size()) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidDevice);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (major == nullptr || minor == nullptr) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
2021-01-19 03:36:22 +00:00
|
|
|
const auto& isa = deviceHandle->isa();
|
|
|
|
|
*major = isa.versionMajor();
|
|
|
|
|
*minor = isa.versionMinor();
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipSuccess);
|
2018-02-27 18:38:56 -05:00
|
|
|
}
|
|
|
|
|
|
2018-03-14 19:05:10 -04:00
|
|
|
hipError_t hipDeviceGetCount(int* count) {
|
2020-05-14 03:50:34 -05:00
|
|
|
HIP_INIT_API(hipDeviceGetCount, count);
|
2018-03-14 19:05:10 -04:00
|
|
|
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(ihipDeviceGetCount(count));
|
2018-03-23 00:19:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hipError_t ihipDeviceGetCount(int* count) {
|
2018-03-14 19:05:10 -04:00
|
|
|
if (count == nullptr) {
|
|
|
|
|
return hipErrorInvalidValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get all available devices
|
2018-08-20 18:48:00 -04:00
|
|
|
*count = g_devices.size();
|
2018-03-14 19:05:10 -04:00
|
|
|
|
2019-08-07 11:44:31 -04:00
|
|
|
if (*count < 1) {
|
|
|
|
|
return hipErrorNoDevice;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-14 19:05:10 -04:00
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
hipError_t hipDeviceGetName(char* name, int len, hipDevice_t device) {
|
2019-10-07 11:55:30 -04:00
|
|
|
HIP_INIT_API(hipDeviceGetName, (void*)name, len, device);
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
if (device < 0 || static_cast<size_t>(device) >= g_devices.size()) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidDevice);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
2019-04-19 09:49:37 -04:00
|
|
|
if (name == nullptr || len <= 0) {
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
2018-03-03 21:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
2018-03-03 21:02:59 -05:00
|
|
|
const auto& info = deviceHandle->info();
|
2019-04-19 09:49:37 -04:00
|
|
|
const auto nameLen = ::strlen(info.boardName_);
|
2018-03-03 21:02:59 -05:00
|
|
|
|
2022-11-11 11:55:31 +00:00
|
|
|
// Only copy partial name if size of `dest` is smaller than size of `src` including
|
2019-04-21 21:50:04 -04:00
|
|
|
// trailing zero byte
|
2022-11-11 11:55:31 +00:00
|
|
|
auto memcpySize = (len <= (nameLen + 1) ? (len - 1) : nameLen);
|
|
|
|
|
::memcpy(name, info.boardName_, memcpySize);
|
|
|
|
|
name[memcpySize] = '\0';
|
2018-02-27 18:38:56 -05:00
|
|
|
|
2018-08-14 18:54:13 -04:00
|
|
|
HIP_RETURN(hipSuccess);
|
2018-02-27 18:38:56 -05:00
|
|
|
}
|
2018-03-14 19:05:10 -04:00
|
|
|
|
2022-01-13 14:06:44 +00:00
|
|
|
hipError_t hipDeviceGetUuid(hipUUID* uuid, hipDevice_t device) {
|
|
|
|
|
HIP_INIT_API(hipDeviceGetUuid, reinterpret_cast<void*>(uuid), device);
|
|
|
|
|
|
|
|
|
|
if (device < 0 || static_cast<size_t>(device) >= g_devices.size()) {
|
|
|
|
|
HIP_RETURN(hipErrorInvalidDevice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (uuid == nullptr) {
|
|
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
|
|
|
|
const auto& info = deviceHandle->info();
|
2023-03-22 15:05:42 -04:00
|
|
|
memcpy(uuid->bytes, info.uuid_, sizeof(info.uuid_));
|
2022-01-13 14:06:44 +00:00
|
|
|
|
|
|
|
|
HIP_RETURN(hipSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, int device) {
|
2018-03-14 19:05:10 -04:00
|
|
|
if (props == nullptr) {
|
2021-12-10 11:48:00 -08:00
|
|
|
return hipErrorInvalidValue;
|
2018-03-14 19:05:10 -04:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 13:52:17 -04:00
|
|
|
if (unsigned(device) >= g_devices.size()) {
|
2021-12-10 11:48:00 -08:00
|
|
|
return hipErrorInvalidDevice;
|
2018-03-14 19:05:10 -04:00
|
|
|
}
|
2018-03-19 13:52:17 -04:00
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
2018-03-14 19:05:10 -04:00
|
|
|
|
2022-03-16 14:26:36 -07:00
|
|
|
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
|
2023-08-02 13:34:19 +01:00
|
|
|
constexpr auto uint16_max = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max()) + 1;
|
|
|
|
|
hipDeviceProp_tR0600 deviceProps = {0};
|
|
|
|
|
|
|
|
|
|
const auto& info = deviceHandle->info();
|
|
|
|
|
const auto& isa = deviceHandle->isa();
|
|
|
|
|
::strncpy(deviceProps.name, info.boardName_, sizeof(info.boardName_));
|
2023-12-12 00:06:38 +00:00
|
|
|
memcpy(deviceProps.uuid.bytes, info.uuid_, sizeof(info.uuid_));
|
2023-08-02 13:34:19 +01:00
|
|
|
deviceProps.totalGlobalMem = info.globalMemSize_;
|
|
|
|
|
deviceProps.sharedMemPerBlock = info.localMemSizePerCU_;
|
|
|
|
|
deviceProps.sharedMemPerMultiprocessor = info.localMemSizePerCU_ * info.numRTCUs_;
|
|
|
|
|
deviceProps.regsPerBlock = info.availableRegistersPerCU_;
|
|
|
|
|
deviceProps.warpSize = info.wavefrontWidth_;
|
|
|
|
|
deviceProps.maxThreadsPerBlock = info.maxWorkGroupSize_;
|
|
|
|
|
deviceProps.maxThreadsDim[0] = info.maxWorkItemSizes_[0];
|
|
|
|
|
deviceProps.maxThreadsDim[1] = info.maxWorkItemSizes_[1];
|
|
|
|
|
deviceProps.maxThreadsDim[2] = info.maxWorkItemSizes_[2];
|
|
|
|
|
deviceProps.maxGridSize[0] = int32_max;
|
|
|
|
|
deviceProps.maxGridSize[1] = uint16_max;
|
|
|
|
|
deviceProps.maxGridSize[2] = uint16_max;
|
|
|
|
|
deviceProps.clockRate = info.maxEngineClockFrequency_ * 1000;
|
|
|
|
|
deviceProps.memoryClockRate = info.maxMemoryClockFrequency_ * 1000;
|
|
|
|
|
deviceProps.memoryBusWidth = info.globalMemChannels_;
|
|
|
|
|
deviceProps.totalConstMem = std::min(info.maxConstantBufferSize_, int32_max);
|
|
|
|
|
deviceProps.major = isa.versionMajor();
|
|
|
|
|
deviceProps.minor = isa.versionMinor();
|
|
|
|
|
deviceProps.multiProcessorCount = info.maxComputeUnits_;
|
|
|
|
|
deviceProps.l2CacheSize = info.l2CacheSize_;
|
|
|
|
|
deviceProps.maxThreadsPerMultiProcessor = info.maxThreadsPerCU_;
|
|
|
|
|
deviceProps.maxBlocksPerMultiProcessor = int(info.maxThreadsPerCU_ / info.maxWorkGroupSize_);
|
|
|
|
|
deviceProps.computeMode = 0;
|
|
|
|
|
deviceProps.clockInstructionRate = info.timeStampFrequency_;
|
|
|
|
|
deviceProps.arch.hasGlobalInt32Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasGlobalFloatAtomicExch = 1;
|
|
|
|
|
deviceProps.arch.hasSharedInt32Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasSharedFloatAtomicExch = 1;
|
|
|
|
|
deviceProps.arch.hasFloatAtomicAdd = 1;
|
|
|
|
|
deviceProps.arch.hasGlobalInt64Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasSharedInt64Atomics = 1;
|
|
|
|
|
deviceProps.hostNativeAtomicSupported = info.pcie_atomics_ ? 1 : 0;
|
|
|
|
|
deviceProps.arch.hasDoubles = 1;
|
|
|
|
|
deviceProps.arch.hasWarpVote = 1;
|
|
|
|
|
deviceProps.arch.hasWarpBallot = 1;
|
|
|
|
|
deviceProps.arch.hasWarpShuffle = 1;
|
|
|
|
|
deviceProps.arch.hasFunnelShift = 0;
|
|
|
|
|
deviceProps.arch.hasThreadFenceSystem = 1;
|
|
|
|
|
deviceProps.arch.hasSyncThreadsExt = 0;
|
|
|
|
|
deviceProps.arch.hasSurfaceFuncs = 0;
|
|
|
|
|
deviceProps.arch.has3dGrid = 1;
|
|
|
|
|
deviceProps.arch.hasDynamicParallelism = 0;
|
|
|
|
|
deviceProps.concurrentKernels = 1;
|
|
|
|
|
deviceProps.pciDomainID = info.pciDomainID;
|
|
|
|
|
deviceProps.pciBusID = info.deviceTopology_.pcie.bus;
|
|
|
|
|
deviceProps.pciDeviceID = info.deviceTopology_.pcie.device;
|
|
|
|
|
deviceProps.maxSharedMemoryPerMultiProcessor = info.localMemSizePerCU_;
|
|
|
|
|
deviceProps.canMapHostMemory = 1;
|
|
|
|
|
deviceProps.regsPerMultiprocessor = info.availableRegistersPerCU_;
|
|
|
|
|
sprintf(deviceProps.gcnArchName, "%s", isa.targetId());
|
|
|
|
|
deviceProps.cooperativeLaunch = info.cooperativeGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceLaunch = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedFunc = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedGridDim = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedBlockDim = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedSharedMem = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
|
|
|
|
|
deviceProps.maxTexture1DLinear =
|
|
|
|
|
std::min(16 * info.imageMaxBufferSize_, int32_max); // Max pixel size is 16 bytes
|
|
|
|
|
deviceProps.maxTexture1DMipmap = std::min(16 * info.imageMaxBufferSize_, int32_max);
|
|
|
|
|
deviceProps.maxTexture1D = deviceProps.maxSurface1D = std::min(info.image1DMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture2D[0] = deviceProps.maxSurface2D[0] =
|
|
|
|
|
std::min(info.image2DMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture2D[1] = deviceProps.maxSurface2D[1] =
|
|
|
|
|
std::min(info.image2DMaxHeight_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[0] = deviceProps.maxSurface3D[0] =
|
|
|
|
|
std::min(info.image3DMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[1] = deviceProps.maxSurface3D[1] =
|
|
|
|
|
std::min(info.image3DMaxHeight_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[2] = deviceProps.maxSurface3D[2] =
|
|
|
|
|
std::min(info.image3DMaxDepth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture1DLayered[0] = deviceProps.maxSurface1DLayered[0] =
|
|
|
|
|
std::min(info.image1DAMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture1DLayered[1] = deviceProps.maxSurface1DLayered[1] =
|
|
|
|
|
std::min(info.imageMaxArraySize_, int32_max);
|
|
|
|
|
deviceProps.maxTexture2DLayered[0] = deviceProps.maxSurface2DLayered[0] =
|
|
|
|
|
std::min(info.image2DAMaxWidth_[0], int32_max);
|
|
|
|
|
deviceProps.maxTexture2DLayered[1] = deviceProps.maxSurface2DLayered[1] =
|
|
|
|
|
std::min(info.image2DAMaxWidth_[1], int32_max);
|
|
|
|
|
deviceProps.maxTexture2DLayered[2] = deviceProps.maxSurface2DLayered[2] =
|
|
|
|
|
std::min(info.imageMaxArraySize_, int32_max);
|
|
|
|
|
deviceProps.hdpMemFlushCntl = info.hdpMemFlushCntl;
|
|
|
|
|
deviceProps.hdpRegFlushCntl = info.hdpRegFlushCntl;
|
|
|
|
|
|
|
|
|
|
deviceProps.memPitch = std::min(info.maxMemAllocSize_, int32_max);
|
|
|
|
|
deviceProps.textureAlignment = deviceProps.surfaceAlignment = info.imageBaseAddressAlignment_;
|
|
|
|
|
deviceProps.texturePitchAlignment = info.imagePitchAlignment_;
|
|
|
|
|
deviceProps.kernelExecTimeoutEnabled = 0;
|
|
|
|
|
deviceProps.ECCEnabled = info.errorCorrectionSupport_ ? 1 : 0;
|
|
|
|
|
deviceProps.isLargeBar = info.largeBar_ ? 1 : 0;
|
|
|
|
|
deviceProps.asicRevision = info.asicRevision_;
|
|
|
|
|
deviceProps.ipcEventSupported = 1;
|
|
|
|
|
deviceProps.streamPrioritiesSupported = 1;
|
|
|
|
|
deviceProps.multiGpuBoardGroupID = info.deviceTopology_.pcie.device;
|
|
|
|
|
|
|
|
|
|
// HMM capabilities
|
|
|
|
|
deviceProps.asyncEngineCount = info.numAsyncQueues_;
|
|
|
|
|
deviceProps.deviceOverlap = (info.numAsyncQueues_ > 0) ? 1 : 0;
|
|
|
|
|
deviceProps.unifiedAddressing = info.hmmDirectHostAccess_;
|
|
|
|
|
deviceProps.managedMemory = info.hmmSupported_;
|
|
|
|
|
deviceProps.concurrentManagedAccess = info.hmmSupported_;
|
|
|
|
|
deviceProps.directManagedMemAccessFromHost = info.hmmDirectHostAccess_;
|
|
|
|
|
deviceProps.canUseHostPointerForRegisteredMem = info.hostUnifiedMemory_;
|
|
|
|
|
deviceProps.pageableMemoryAccess = info.hmmCpuMemoryAccessible_;
|
2024-01-25 18:25:36 -05:00
|
|
|
deviceProps.hostRegisterSupported = true;
|
|
|
|
|
deviceProps.pageableMemoryAccessUsesHostPageTables = info.iommuv2_;
|
2023-08-02 13:34:19 +01:00
|
|
|
|
|
|
|
|
// Mem pool
|
|
|
|
|
deviceProps.memoryPoolsSupported = HIP_MEM_POOL_SUPPORT;
|
2023-11-27 15:01:57 +00:00
|
|
|
unsigned int memPoolHandleType = 0;
|
|
|
|
|
if (HIP_MEM_POOL_SUPPORT) {
|
|
|
|
|
#if defined(__linux__)
|
|
|
|
|
memPoolHandleType |= hipMemHandleTypePosixFileDescriptor;
|
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
|
memPoolHandleType |= hipMemHandleTypeWin32;
|
|
|
|
|
memPoolHandleType |= hipMemHandleTypeWin32Kmt;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
deviceProps.memoryPoolSupportedHandleTypes = memPoolHandleType;
|
2023-08-02 13:34:19 +01:00
|
|
|
|
|
|
|
|
// Caching behavior
|
|
|
|
|
deviceProps.globalL1CacheSupported = 1;
|
|
|
|
|
deviceProps.localL1CacheSupported = 1;
|
|
|
|
|
deviceProps.persistingL2CacheMaxSize = info.l2CacheSize_;
|
|
|
|
|
deviceProps.reservedSharedMemPerBlock = 0;
|
|
|
|
|
deviceProps.sharedMemPerBlockOptin = 0;
|
|
|
|
|
|
|
|
|
|
// Unsupported features
|
|
|
|
|
// Single to double precision perf ratio
|
|
|
|
|
deviceProps.singleToDoublePrecisionPerfRatio = 0;
|
|
|
|
|
// Flag hipHostRegisterReadOnly
|
|
|
|
|
deviceProps.hostRegisterReadOnlySupported = 0;
|
|
|
|
|
// Compute preemption
|
|
|
|
|
deviceProps.computePreemptionSupported = 0;
|
|
|
|
|
// Cubemaps
|
|
|
|
|
deviceProps.maxTextureCubemap = 0;
|
|
|
|
|
deviceProps.maxTextureCubemapLayered[0] = 0;
|
|
|
|
|
deviceProps.maxTextureCubemapLayered[1] = 0;
|
|
|
|
|
deviceProps.maxSurfaceCubemap = 0;
|
|
|
|
|
deviceProps.maxSurfaceCubemapLayered[0] = 0;
|
|
|
|
|
deviceProps.maxSurfaceCubemapLayered[1] = 0;
|
|
|
|
|
// Texture gather ops
|
|
|
|
|
deviceProps.maxTexture2DGather[0] = 0;
|
|
|
|
|
deviceProps.maxTexture2DGather[1] = 0;
|
|
|
|
|
// Textures bound to pitch memory
|
|
|
|
|
deviceProps.maxTexture2DLinear[0] = 0;
|
|
|
|
|
deviceProps.maxTexture2DLinear[1] = 0;
|
|
|
|
|
deviceProps.maxTexture2DLinear[2] = 0;
|
|
|
|
|
// Alternate 3D texture
|
|
|
|
|
deviceProps.maxTexture3DAlt[0] = 0;
|
|
|
|
|
deviceProps.maxTexture3DAlt[1] = 0;
|
|
|
|
|
deviceProps.maxTexture3DAlt[2] = 0;
|
|
|
|
|
// access policy
|
|
|
|
|
deviceProps.accessPolicyMaxWindowSize = 0;
|
|
|
|
|
// cluster launch
|
|
|
|
|
deviceProps.clusterLaunch = 0;
|
|
|
|
|
// Mapping HIP array
|
|
|
|
|
deviceProps.deferredMappingHipArraySupported = 0;
|
|
|
|
|
// RDMA options
|
|
|
|
|
deviceProps.gpuDirectRDMASupported = 0;
|
|
|
|
|
deviceProps.gpuDirectRDMAFlushWritesOptions = 0;
|
|
|
|
|
deviceProps.gpuDirectRDMAWritesOrdering = 0;
|
2023-10-17 19:10:54 -04:00
|
|
|
*reinterpret_cast<uint32_t*>(&deviceProps.luid[0]) = info.luidLowPart_;
|
|
|
|
|
*reinterpret_cast<uint32_t*>(&deviceProps.luid[sizeof(uint32_t)]) = info.luidHighPart_;
|
|
|
|
|
deviceProps.luidDeviceNodeMask = info.luidDeviceNodeMask_;
|
|
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
deviceProps.sparseHipArraySupported = 0;
|
|
|
|
|
deviceProps.timelineSemaphoreInteropSupported = 0;
|
|
|
|
|
deviceProps.unifiedFunctionPointers = 0;
|
|
|
|
|
|
2024-01-25 18:25:36 -05:00
|
|
|
deviceProps.integrated = info.hostUnifiedMemory_;
|
2023-12-15 10:40:18 -05:00
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
*props = deviceProps;
|
|
|
|
|
return hipSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
hipError_t hipGetDevicePropertiesR0600(hipDeviceProp_tR0600* prop, int device) {
|
|
|
|
|
HIP_INIT_API(hipGetDevicePropertiesR0600, prop, device);
|
2023-08-02 13:34:19 +01:00
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
HIP_RETURN(ihipGetDeviceProperties(prop, device));
|
2023-08-02 13:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
hipError_t hipGetDevicePropertiesR0000(hipDeviceProp_tR0000* prop, int device) {
|
|
|
|
|
HIP_INIT_API(hipGetDevicePropertiesR0000, prop, device);
|
2023-08-02 13:34:19 +01:00
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
if (prop == nullptr) {
|
|
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
2023-08-02 13:34:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (unsigned(device) >= g_devices.size()) {
|
2023-11-29 15:50:10 -05:00
|
|
|
HIP_RETURN(hipErrorInvalidDevice);
|
2023-08-02 13:34:19 +01:00
|
|
|
}
|
|
|
|
|
auto* deviceHandle = g_devices[device]->devices()[0];
|
|
|
|
|
|
|
|
|
|
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
|
|
|
|
|
constexpr auto uint16_max = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max()) + 1;
|
2023-11-29 15:50:10 -05:00
|
|
|
hipDeviceProp_tR0000 deviceProps = {0};
|
2018-03-14 19:05:10 -04:00
|
|
|
|
|
|
|
|
const auto& info = deviceHandle->info();
|
2021-01-18 16:27:24 +00:00
|
|
|
const auto& isa = deviceHandle->isa();
|
2018-03-14 19:05:10 -04:00
|
|
|
::strncpy(deviceProps.name, info.boardName_, 128);
|
|
|
|
|
deviceProps.totalGlobalMem = info.globalMemSize_;
|
|
|
|
|
deviceProps.sharedMemPerBlock = info.localMemSizePerCU_;
|
2020-10-05 13:20:58 -04:00
|
|
|
deviceProps.regsPerBlock = info.availableRegistersPerCU_;
|
2018-03-14 19:05:10 -04:00
|
|
|
deviceProps.warpSize = info.wavefrontWidth_;
|
|
|
|
|
deviceProps.maxThreadsPerBlock = info.maxWorkGroupSize_;
|
|
|
|
|
deviceProps.maxThreadsDim[0] = info.maxWorkItemSizes_[0];
|
|
|
|
|
deviceProps.maxThreadsDim[1] = info.maxWorkItemSizes_[1];
|
|
|
|
|
deviceProps.maxThreadsDim[2] = info.maxWorkItemSizes_[2];
|
2022-03-16 14:26:36 -07:00
|
|
|
deviceProps.maxGridSize[0] = int32_max;
|
2023-04-24 21:38:53 -04:00
|
|
|
deviceProps.maxGridSize[1] = uint16_max;
|
|
|
|
|
deviceProps.maxGridSize[2] = uint16_max;
|
2018-08-10 14:04:43 -04:00
|
|
|
deviceProps.clockRate = info.maxEngineClockFrequency_ * 1000;
|
2018-08-10 14:09:04 -04:00
|
|
|
deviceProps.memoryClockRate = info.maxMemoryClockFrequency_ * 1000;
|
2020-08-06 08:46:07 -04:00
|
|
|
deviceProps.memoryBusWidth = info.globalMemChannels_;
|
2022-03-16 14:26:36 -07:00
|
|
|
deviceProps.totalConstMem = std::min(info.maxConstantBufferSize_, int32_max);
|
2021-01-18 16:27:24 +00:00
|
|
|
deviceProps.major = isa.versionMajor();
|
|
|
|
|
deviceProps.minor = isa.versionMinor();
|
2018-03-14 19:05:10 -04:00
|
|
|
deviceProps.multiProcessorCount = info.maxComputeUnits_;
|
|
|
|
|
deviceProps.l2CacheSize = info.l2CacheSize_;
|
2019-01-29 17:33:39 -05:00
|
|
|
deviceProps.maxThreadsPerMultiProcessor = info.maxThreadsPerCU_;
|
2018-03-14 19:05:10 -04:00
|
|
|
deviceProps.computeMode = 0;
|
|
|
|
|
deviceProps.clockInstructionRate = info.timeStampFrequency_;
|
2021-12-10 11:48:00 -08:00
|
|
|
deviceProps.arch.hasGlobalInt32Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasGlobalFloatAtomicExch = 1;
|
|
|
|
|
deviceProps.arch.hasSharedInt32Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasSharedFloatAtomicExch = 1;
|
|
|
|
|
deviceProps.arch.hasFloatAtomicAdd = 1;
|
|
|
|
|
deviceProps.arch.hasGlobalInt64Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasSharedInt64Atomics = 1;
|
|
|
|
|
deviceProps.arch.hasDoubles = 1;
|
|
|
|
|
deviceProps.arch.hasWarpVote = 1;
|
|
|
|
|
deviceProps.arch.hasWarpBallot = 1;
|
|
|
|
|
deviceProps.arch.hasWarpShuffle = 1;
|
|
|
|
|
deviceProps.arch.hasFunnelShift = 0;
|
|
|
|
|
deviceProps.arch.hasThreadFenceSystem = 1;
|
|
|
|
|
deviceProps.arch.hasSyncThreadsExt = 0;
|
|
|
|
|
deviceProps.arch.hasSurfaceFuncs = 0;
|
|
|
|
|
deviceProps.arch.has3dGrid = 1;
|
|
|
|
|
deviceProps.arch.hasDynamicParallelism = 0;
|
2018-03-14 19:05:10 -04:00
|
|
|
deviceProps.concurrentKernels = 1;
|
2020-10-14 18:57:04 +00:00
|
|
|
deviceProps.pciDomainID = info.pciDomainID;
|
2018-03-14 19:05:10 -04:00
|
|
|
deviceProps.pciBusID = info.deviceTopology_.pcie.bus;
|
|
|
|
|
deviceProps.pciDeviceID = info.deviceTopology_.pcie.device;
|
|
|
|
|
deviceProps.maxSharedMemoryPerMultiProcessor = info.localMemSizePerCU_;
|
|
|
|
|
deviceProps.canMapHostMemory = 1;
|
2023-07-31 08:53:58 -04:00
|
|
|
// FIXME: This should be removed, targets can have character names as well.
|
|
|
|
|
deviceProps.gcnArch = isa.versionMajor() * 100 + isa.versionMinor() * 10 + isa.versionStepping();
|
2021-01-18 16:27:24 +00:00
|
|
|
sprintf(deviceProps.gcnArchName, "%s", isa.targetId());
|
2019-06-12 10:00:38 -04:00
|
|
|
deviceProps.cooperativeLaunch = info.cooperativeGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceLaunch = info.cooperativeMultiDeviceGroups_;
|
2018-03-14 19:05:10 -04:00
|
|
|
|
2020-04-06 13:54:03 -04:00
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedFunc = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedGridDim = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedBlockDim = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
deviceProps.cooperativeMultiDeviceUnmatchedSharedMem = info.cooperativeMultiDeviceGroups_;
|
|
|
|
|
|
2023-08-02 13:34:19 +01:00
|
|
|
deviceProps.maxTexture1DLinear =
|
|
|
|
|
std::min(16 * info.imageMaxBufferSize_, int32_max); // Max pixel size is 16 bytes
|
|
|
|
|
deviceProps.maxTexture1D = std::min(info.image1DMaxWidth_, int32_max);
|
2022-03-16 14:26:36 -07:00
|
|
|
deviceProps.maxTexture2D[0] = std::min(info.image2DMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture2D[1] = std::min(info.image2DMaxHeight_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[0] = std::min(info.image3DMaxWidth_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[1] = std::min(info.image3DMaxHeight_, int32_max);
|
|
|
|
|
deviceProps.maxTexture3D[2] = std::min(info.image3DMaxDepth_, int32_max);
|
2021-02-04 19:58:43 +00:00
|
|
|
deviceProps.hdpMemFlushCntl = info.hdpMemFlushCntl;
|
|
|
|
|
deviceProps.hdpRegFlushCntl = info.hdpRegFlushCntl;
|
2019-08-07 11:30:59 -04:00
|
|
|
|
2022-03-16 14:26:36 -07:00
|
|
|
deviceProps.memPitch = std::min(info.maxMemAllocSize_, int32_max);
|
2020-02-20 18:56:33 -05:00
|
|
|
deviceProps.textureAlignment = info.imageBaseAddressAlignment_;
|
|
|
|
|
deviceProps.texturePitchAlignment = info.imagePitchAlignment_;
|
2019-09-16 17:58:06 -04:00
|
|
|
deviceProps.kernelExecTimeoutEnabled = 0;
|
2021-12-10 11:48:00 -08:00
|
|
|
deviceProps.ECCEnabled = info.errorCorrectionSupport_ ? 1 : 0;
|
2020-04-30 22:19:15 -04:00
|
|
|
deviceProps.isLargeBar = info.largeBar_ ? 1 : 0;
|
2020-06-12 17:05:16 -04:00
|
|
|
deviceProps.asicRevision = info.asicRevision_;
|
2019-09-16 17:58:06 -04:00
|
|
|
|
2020-10-09 18:25:29 -04:00
|
|
|
// HMM capabilities
|
|
|
|
|
deviceProps.managedMemory = info.hmmSupported_;
|
2021-12-10 11:48:00 -08:00
|
|
|
deviceProps.concurrentManagedAccess = info.hmmSupported_;
|
2020-10-09 18:25:29 -04:00
|
|
|
deviceProps.directManagedMemAccessFromHost = info.hmmDirectHostAccess_;
|
|
|
|
|
deviceProps.pageableMemoryAccess = info.hmmCpuMemoryAccessible_;
|
|
|
|
|
deviceProps.pageableMemoryAccessUsesHostPageTables = info.hostUnifiedMemory_;
|
|
|
|
|
|
2023-11-29 15:50:10 -05:00
|
|
|
*prop = deviceProps;
|
|
|
|
|
HIP_RETURN(hipSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-15 18:19:58 -05:00
|
|
|
hipError_t hipGetProcAddress(const char* symbol, void** pfn, int hipVersion, uint64_t flags,
|
|
|
|
|
hipDriverProcAddressQueryResult* symbolStatus = nullptr) {
|
|
|
|
|
HIP_INIT_API(hipGetProcAddress, symbol, pfn, hipVersion, flags, symbolStatus);
|
|
|
|
|
|
|
|
|
|
std::string symbolString = symbol;
|
|
|
|
|
if(symbol == nullptr || symbolString == "" || *pfn == nullptr){
|
|
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (symbolString == "hipGetDeviceProperties"){
|
|
|
|
|
if (hipVersion >= 600){
|
|
|
|
|
symbolString = "hipGetDevicePropertiesR0600";
|
|
|
|
|
}
|
|
|
|
|
} else if (symbolString == "hipChooseDevice") {
|
|
|
|
|
if (hipVersion >= 600){
|
|
|
|
|
symbolString = "hipChooseDeviceR0600";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void* handle = hip::PlatformState::instance().getDynamicLibraryHandle();
|
|
|
|
|
if (handle == nullptr){
|
|
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*pfn = amd::Os::getSymbol(handle, symbolString.c_str());
|
|
|
|
|
if (!(*pfn)) {
|
|
|
|
|
if (symbolStatus != nullptr) {
|
|
|
|
|
*symbolStatus = HIP_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
HIP_RETURN(hipErrorInvalidValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (symbolStatus != nullptr) {
|
|
|
|
|
*symbolStatus = HIP_GET_PROC_ADDRESS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
HIP_RETURN(hipSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-21 10:46:05 +00:00
|
|
|
} // namespace hip
|
2023-11-29 15:50:10 -05:00
|
|
|
|
2023-12-11 12:47:41 +00:00
|
|
|
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device) {
|
|
|
|
|
return hip::hipGetDevicePropertiesR0000(props, device);
|
|
|
|
|
}
|