From 0201294ddd8db89cb448a6784aca4b7dc44c8d03 Mon Sep 17 00:00:00 2001 From: "Ramesh Errabolu (xN/A) TX" Date: Mon, 16 Mar 2015 16:43:47 -0500 Subject: [PATCH] ECR #333755 - Changes to Utils to build on Windows [git-p4: depot-paths = "//depot/stg/hsa/drivers/hsa/runtime/": change = 1131149] [ROCm/ROCR-Runtime commit: 2eab8a72d465af66bca70f59e31f7c98d254fea0] --- .../samples/common/common_utility.cpp | 2 +- .../samples/common/hsa_rsrc_factory.cpp | 15 ++++++++++----- .../samples/common/hsa_rsrc_factory.hpp | 13 ++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/projects/rocr-runtime/samples/common/common_utility.cpp b/projects/rocr-runtime/samples/common/common_utility.cpp index 939aedc854..9b1482be13 100644 --- a/projects/rocr-runtime/samples/common/common_utility.cpp +++ b/projects/rocr-runtime/samples/common/common_utility.cpp @@ -16,7 +16,7 @@ double CalcMedian(vector scores) double CalcMean(vector scores) { - double mean; + double mean = 0; size_t size = scores.size(); for (int i=0; i #include #include -#include #include #include @@ -81,6 +80,13 @@ uint32_t HsaRsrcFactory::num_workitems_; uint32_t HsaRsrcFactory::kernel_loop_count_; bool HsaRsrcFactory::print_debug_info_ = false; +char* HsaRsrcFactory::num_cus_key_ = "num_cus"; +char* HsaRsrcFactory::brig_path_key_ = "brig_path"; +char* HsaRsrcFactory::num_waves_key_ = "waves_per_cu"; +char* HsaRsrcFactory::num_workitems_key_ = "workitems_per_wave"; +char* HsaRsrcFactory::print_debug_key_ = "print_debug"; +char* HsaRsrcFactory::kernel_loop_count_key_ = "kernel_loop_count"; + // Constructor of the class HsaRsrcFactory::HsaRsrcFactory( ) { @@ -106,7 +112,7 @@ HsaRsrcFactory::~HsaRsrcFactory( ) { // @return uint32_t Number of Gpu agents on platform // uint32_t HsaRsrcFactory::GetCountOfGpuAgents( ) { - return gpu_list_.size(); + return uint32_t(gpu_list_.size()); } // Get the AgentInfo handle of a Gpu device @@ -120,7 +126,7 @@ uint32_t HsaRsrcFactory::GetCountOfGpuAgents( ) { bool HsaRsrcFactory::GetGpuAgentInfo(uint32_t idx, AgentInfo **agent_info) { // Determine if request is valid - uint32_t size = gpu_list_.size(); + uint32_t size = uint32_t(gpu_list_.size()); if (idx >= size) { return false; } @@ -238,7 +244,6 @@ bool HsaRsrcFactory::LoadAndFinalize(AgentInfo *agent_info, // Finalize hsail program. hsa_isa_t isa = {0}; status = hsa_agent_get_info(agent_info->dev_id, HSA_AGENT_INFO_ISA, &isa); - std::cout << "Value of device Isa Id: " << isa.handle << std::endl; check("Error in getting Id of Isa supported by agent", status); hsa_ext_control_directives_t control_directives; @@ -326,7 +331,7 @@ void HsaRsrcFactory::AddAgentInfo(AgentInfo *agent_info) { bool HsaRsrcFactory::PrintGpuAgents( ) { AgentInfo *agent_info; - int size = gpu_list_.size(); + int size = uint32_t(gpu_list_.size()); for (int idx = 0; idx < size; idx++) { agent_info = gpu_list_[idx]; std::cout << std::endl; diff --git a/projects/rocr-runtime/samples/common/hsa_rsrc_factory.hpp b/projects/rocr-runtime/samples/common/hsa_rsrc_factory.hpp index 6764f020ab..e685d4a4fc 100755 --- a/projects/rocr-runtime/samples/common/hsa_rsrc_factory.hpp +++ b/projects/rocr-runtime/samples/common/hsa_rsrc_factory.hpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -231,32 +230,32 @@ class HsaRsrcFactory { // Records the file path where Brig file is located. // Value is available only after an instance has been built. static char* brig_path_; - static constexpr char* brig_path_key_ = "brig_path"; + static char* brig_path_key_; // Records the number of Compute units present on system. // Value is available only after an instance has been built. static uint32_t num_cus_; - static constexpr char* num_cus_key_ = "num_cus"; + static char* num_cus_key_; // Records the number of waves that can be launched per Compute unit // Value is available only after an instance has been built. static uint32_t num_waves_; - static constexpr char* num_waves_key_ = "waves_per_cu"; + static char* num_waves_key_; // Records the number of work-items that can be packed into a wave // Value is available only after an instance has been built. static uint32_t num_workitems_; - static constexpr char* num_workitems_key_ = "workitems_per_wave"; + static char* num_workitems_key_; // Records the number of times kernel loop body should run. Value // is available only after an instance has been built. static uint32_t kernel_loop_count_; - static constexpr char* kernel_loop_count_key_ = "kernel_loop_count"; + static char* kernel_loop_count_key_; // Records the number of times kernel loop body should run. Value // is available only after an instance has been built. static bool print_debug_info_; - static constexpr char* print_debug_key_ = "print_debug"; + static char* print_debug_key_; // Print the various fields of Hsa Gpu Agents bool PrintGpuAgents( );