summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpgpu-sim/shader.h24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h
index 2d2f051..4c6de06 100644
--- a/src/gpgpu-sim/shader.h
+++ b/src/gpgpu-sim/shader.h
@@ -1498,25 +1498,11 @@ class shader_core_config : public core_config {
// parse gpgpu_shmem_option for adpative cache config
if (adaptive_cache_config) {
- for (unsigned i = 0; i < strlen(gpgpu_shmem_option); i++) {
- char option[4];
- int j = 0;
- while (gpgpu_shmem_option[i] != ',' && i < strlen(gpgpu_shmem_option)) {
- if (gpgpu_shmem_option[i] == ' ') {
- // skip spaces
- i++;
- } else {
- if (!isdigit(gpgpu_shmem_option[i])) {
- // check for non digits, which should not be here
- assert(0 && "invalid config: -gpgpu_shmem_option");
- }
- option[j] = gpgpu_shmem_option[i];
- j++;
- i++;
- }
- }
- // convert KB -> B
- shmem_opt_list.push_back((unsigned)atoi(option) * 1024);
+ std::stringstream ss(gpgpu_shmem_option);
+ while (ss.good()) {
+ std::string option;
+ std::getline(ss, option, ',');
+ shmem_opt_list.push_back((unsigned)std::stoi(option) * 1024);
}
std::sort(shmem_opt_list.begin(), shmem_opt_list.end());
}