1 //===--- amdgpu/impl/utils.cpp ------------------------------------ C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #include "internal.h"
9 #include "rt.h"
10 
11 #include <stdio.h>
12 #include <string>
13 
14 const char *get_error_string(hsa_status_t err) {
15   const char *res;
16   hsa_status_t rc = hsa_status_string(err, &res);
17   return (rc == HSA_STATUS_SUCCESS) ? res : "HSA_STATUS UNKNOWN.";
18 }
19 
20 namespace core {
21 /*
22  * Environment variables
23  */
24 void Environment::GetEnvAll() {
25   std::string var = GetEnv("ATMI_HELP");
26   if (!var.empty()) {
27     printf("ATMI_MAX_HSA_QUEUE_SIZE : positive integer\n"
28            "ATMI_DEBUG : 1 for printing out trace/debug info\n");
29   }
30 
31   var = GetEnv("ATMI_MAX_HSA_QUEUE_SIZE");
32   if (!var.empty())
33     max_queue_size_ = std::stoi(var);
34 
35   var = GetEnv("ATMI_DEBUG");
36   if (!var.empty())
37     debug_mode_ = std::stoi(var);
38 }
39 } // namespace core
40