-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
532282d
commit a620537
Showing
67 changed files
with
1,102 additions
and
564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Radeon Compute Profiler Release Notes | ||
--- | ||
|
||
## Version 5.1 (6/28/17) | ||
* Adds support for additional GPUs, including Vega series GPUs | ||
* ROCm/HSA: Support for ROCm 1.6 | ||
* Improves display of pointer parameters for some HSA APIs in the ATP file | ||
* Fixes an issue with parsing an ATP file which has non-ascii characters (affected Summary page generation and display within CodeXL) | ||
|
||
## Version 5.0 (in comparison to CodeXL 2.2) (6/2/17) | ||
* Adds support for additional GPUs and APUs. | ||
* ROCm/HSA: Support for ROCm 1.5 | ||
* Support for demangling names of HIP and HCC kernels. Requires c++filt to be installed on the system. c++filt can be installed using *sudo apt-get install binutils* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
//============================================================================== | ||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. | ||
/// \author AMD Developer Tools Team | ||
/// \file | ||
/// \brief This file contains implementation to CLDevice Replacer class | ||
//============================================================================== | ||
|
||
#include "CLDeviceReplacer.h" | ||
#include "CLFunctionDefs.h" | ||
|
||
cl_int CLDeviceReplacer::ReplaceDeviceIds(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* device_list, cl_uint* num_devices, unsigned int gpuIndex, cl_uint originalRetCode) | ||
{ | ||
cl_int ret = originalRetCode; | ||
|
||
if (!m_bIsGPUIterated) | ||
{ | ||
m_bIsGPUIterated = true; | ||
cl_uint deviceCount; | ||
bool success = CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceIDs(nullptr, CL_DEVICE_TYPE_GPU, 0u, nullptr, &deviceCount)); | ||
|
||
if (!success) | ||
{ | ||
cl_uint platformCount; | ||
success = CL_SUCCESS == (ret = g_realDispatchTable.GetPlatformIDs(0u, nullptr, &platformCount)); | ||
success = CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceIDs(nullptr, CL_DEVICE_TYPE_GPU, 0u, nullptr, &deviceCount)); | ||
} | ||
|
||
if (success && 0u < deviceCount) | ||
{ | ||
cl_device_id* deviceIds = new(std::nothrow) cl_device_id[deviceCount]; | ||
m_CLGPUDeviceIdsList.push_back(deviceIds); | ||
|
||
if (nullptr != deviceIds) | ||
{ | ||
success = CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceIDs(nullptr, CL_DEVICE_TYPE_GPU, deviceCount, deviceIds, nullptr)); | ||
|
||
if (success) | ||
{ | ||
for (unsigned int deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) | ||
{ | ||
cl_platform_id devicePlatform = nullptr; | ||
success = CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceInfo(deviceIds[deviceIndex], CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &devicePlatform, nullptr)); | ||
|
||
if (success && nullptr != devicePlatform) | ||
{ | ||
if (m_clPlatformDeviceIdsMap.find(devicePlatform) == m_clPlatformDeviceIdsMap.end()) | ||
{ | ||
std::vector<cl_device_id> deviceIdList; | ||
m_clPlatformDeviceIdsMap.insert(std::pair<cl_platform_id, std::vector<cl_device_id>>(devicePlatform, deviceIdList)); | ||
} | ||
|
||
m_clPlatformDeviceIdsMap[devicePlatform].push_back(deviceIds[deviceIndex]); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (0u <= gpuIndex) | ||
{ | ||
if (CL_DEVICE_TYPE_GPU == (CL_DEVICE_TYPE_GPU & device_type)) | ||
{ | ||
// Check is there any cldevice exist apart from GPUs for specified deviceType | ||
cl_uint nonGPUDeviceCount = 0u; | ||
bool success = CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceIDs(platform, (device_type ^ CL_DEVICE_TYPE_GPU), 0u, nullptr, &nonGPUDeviceCount)); | ||
|
||
// In case of querying only device Count | ||
if (nullptr == device_list && nullptr != num_devices) | ||
{ | ||
cl_uint gpuDeviceCountForThePlatform = static_cast<uint32_t>(m_clPlatformDeviceIdsMap[platform].size()); | ||
|
||
if (0u < *num_devices) | ||
{ | ||
if (*num_devices >= gpuDeviceCountForThePlatform) | ||
{ | ||
// This contains only GPU devices or GPU Devices along with other devices | ||
if (gpuIndex < gpuDeviceCountForThePlatform) | ||
{ | ||
// Only sigle gpu available | ||
*num_devices = (*num_devices - gpuDeviceCountForThePlatform) + 1; | ||
} | ||
else | ||
{ | ||
// Index is greater than the GPU devices - No GPU | ||
*num_devices = *num_devices - gpuDeviceCountForThePlatform; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// If we reached here it means either this function gets called before the actual call or there is no device exist with specified deviceType | ||
|
||
if (success) | ||
{ | ||
if (0u < m_clPlatformDeviceIdsMap[platform].size() && gpuIndex < static_cast<unsigned int>(m_clPlatformDeviceIdsMap[platform].size())) | ||
{ | ||
// Handle in case Function is called before actual call to the function | ||
*num_devices = nonGPUDeviceCount + 1; | ||
} | ||
else | ||
{ | ||
// No GPU device available - return non GPU device Count | ||
*num_devices = nonGPUDeviceCount; | ||
} | ||
} | ||
} | ||
|
||
ret = 0 == *num_devices ? CL_DEVICE_NOT_FOUND : CL_SUCCESS; | ||
} | ||
else if (nullptr != device_list) | ||
{ | ||
// Case: when querying for device list (not the count) | ||
bool isGPUExistForTheSpecifiedPlatformAndIndex = static_cast<uint32_t>(m_clPlatformDeviceIdsMap[platform].size()) > static_cast<uint32_t>(gpuIndex); | ||
|
||
if (isGPUExistForTheSpecifiedPlatformAndIndex) | ||
{ | ||
if (nullptr != num_devices) | ||
{ | ||
*num_devices = 1; // Only one GPU is available | ||
} | ||
|
||
if (num_entries > 0u) | ||
{ | ||
for (unsigned int i = 0; i < num_entries; i++) | ||
{ | ||
cl_device_type clCurrentDeviceType; | ||
|
||
if (CL_SUCCESS == (ret = g_realDispatchTable.GetDeviceInfo(device_list[i], CL_DEVICE_TYPE, sizeof(cl_device_type), &clCurrentDeviceType, nullptr))) | ||
{ | ||
if (CL_DEVICE_TYPE_GPU == clCurrentDeviceType) | ||
{ | ||
if (!isGPUExistForTheSpecifiedPlatformAndIndex || device_list[i] != m_clPlatformDeviceIdsMap[platform][gpuIndex]) | ||
{ | ||
device_list[i] = nullptr; | ||
} | ||
} | ||
} | ||
} | ||
|
||
ret = CL_SUCCESS; | ||
} | ||
else | ||
{ | ||
ret = originalRetCode; | ||
} | ||
} | ||
else | ||
{ | ||
ret = CL_DEVICE_NOT_FOUND; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// Not querying for GPU device - Don't do anything | ||
ret = originalRetCode; | ||
} | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
CLDeviceReplacer::~CLDeviceReplacer() | ||
{ | ||
for (std::vector<cl_device_id*>::iterator it = m_CLGPUDeviceIdsList.begin(); it != m_CLGPUDeviceIdsList.end(); ++it) | ||
{ | ||
delete[](*it); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//============================================================================== | ||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. | ||
/// \author AMD Developer Tools Team | ||
/// \file | ||
/// \brief This file contains a class to replace a device id | ||
//============================================================================== | ||
|
||
#ifndef _CL_DEVICE_REPLACER_ | ||
#define _CL_DEVICE_REPLACER_ | ||
|
||
#include <CL/opencl.h> | ||
#include <TSingleton.h> | ||
#include <vector> | ||
#include <map> | ||
|
||
/// Class for replacing the cl device ids | ||
class CLDeviceReplacer : public TSingleton<CLDeviceReplacer> | ||
{ | ||
friend class TSingleton<CLDeviceReplacer>; | ||
|
||
public: | ||
|
||
/// Replaces the CL device ids for the GPU device and specified GPU index | ||
/// \param[in] platform platform id | ||
/// \param[in] device_type type of the device | ||
/// \param[in] num_entries number of entries for the devices to be updated | ||
/// \param[out] device_list list of the device | ||
/// \param[out] num_devices number of devices of specified device type | ||
/// \param[in] gpuIndex index of the GPU | ||
cl_int ReplaceDeviceIds( | ||
cl_platform_id platform, | ||
cl_device_type device_type, | ||
cl_uint num_entries, | ||
cl_device_id* device_list, | ||
cl_uint* num_devices, | ||
unsigned int gpuIndex, | ||
cl_uint originalRetCode); | ||
|
||
/// Destructor | ||
~CLDeviceReplacer(); | ||
|
||
private: | ||
/// Constructor | ||
CLDeviceReplacer(): m_bIsGPUIterated(false) | ||
{} | ||
|
||
std::map<cl_platform_id, std::vector<cl_device_id>> m_clPlatformDeviceIdsMap; ///< list of the device ids for each platform | ||
std::vector<cl_device_id*> m_CLGPUDeviceIdsList; ///< list of the device ids for housekeeping | ||
bool m_bIsGPUIterated; ///< flag indicating the all the platform and devices has been iterated | ||
}; | ||
|
||
#endif // _CL_DEVICE_REPLACER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.