Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace outdated check for std::unordered_map #39

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/cuda-sim/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@

#include "../abstract_hardware_model.h"

#include "../tr1_hash_map.h"
#define mem_map tr1_hash_map
#if tr1_hash_map_ismap == 1
#define MEM_MAP_RESIZE(hash_size)
#else
#include <unordered_map>
#define mem_map std::unordered_map
#define MEM_MAP_RESIZE(hash_size) (m_data.rehash(hash_size))
#endif

#include <assert.h>
#include <stdio.h>
Expand Down
9 changes: 2 additions & 7 deletions src/cuda-sim/ptx-stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "ptx-stats.h"
#include <stdio.h>
#include <map>
#include <unordered_map>
#include "../../libcuda/gpgpu_context.h"
#include "../option_parser.h"
#include "../tr1_hash_map.h"
#include "ptx_ir.h"
#include "ptx_sim.h"

Expand Down Expand Up @@ -107,19 +107,14 @@ class ptx_file_line_stats {
warp_divergence; // number of warp divergence occured at this instruction
};

#if (tr1_hash_map_ismap == 1)
typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats>
ptx_file_line_stats_map_t;
#else
struct hash_ptx_file_line {
std::size_t operator()(const ptx_file_line &pfline) const {
std::hash<unsigned> hash_line;
return hash_line(pfline.line);
}
};
typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats, hash_ptx_file_line>
typedef std::unordered_map<ptx_file_line, ptx_file_line_stats, hash_ptx_file_line>
ptx_file_line_stats_map_t;
#endif

static ptx_file_line_stats_map_t ptx_file_line_stats_tracker;

Expand Down
4 changes: 2 additions & 2 deletions src/cuda-sim/ptx_sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <stdlib.h>
#include "../abstract_hardware_model.h"
#include "../tr1_hash_map.h"
#include <unordered_map>
#include "half.h"

#include <assert.h>
Expand Down Expand Up @@ -506,7 +506,7 @@ class ptx_thread_info {
std::list<stack_entry> m_callstack;
unsigned m_local_mem_stack_pointer;

typedef tr1_hash_map<const symbol *, ptx_reg_t> reg_map_t;
typedef std::unordered_map<const symbol *, ptx_reg_t> reg_map_t;
std::list<reg_map_t> m_regs;
std::list<reg_map_t> m_debug_trace_regs_modified;
std::list<reg_map_t> m_debug_trace_regs_read;
Expand Down
11 changes: 3 additions & 8 deletions src/gpgpu-sim/addrdec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include <unordered_map>
#include "addrdec.h"
#include <string.h>
#include "../option_parser.h"
Expand Down Expand Up @@ -189,7 +190,7 @@ void linear_to_raw_address_translation::addrdec_tlx(new_addr_type addr,
// we generate a random set for each memory address and save the value in
// a big hashtable for future reuse
new_addr_type chip_address = (addr >> ADDR_CHIP_S);
tr1_hash_map<new_addr_type, unsigned>::const_iterator got =
std::unordered_map<new_addr_type, unsigned>::const_iterator got =
address_random_interleaving.find(chip_address);
if (got == address_random_interleaving.end()) {
unsigned new_chip_id =
Expand Down Expand Up @@ -486,8 +487,6 @@ void linear_to_raw_address_translation::init(
if (memory_partition_indexing == RANDOM) srand(1);
}

#include "../tr1_hash_map.h"

bool operator==(const addrdec_t &x, const addrdec_t &y) {
return (memcmp(&x, &y, sizeof(addrdec_t)) == 0);
}
Expand Down Expand Up @@ -519,11 +518,7 @@ class hash_addrdec_t {
void linear_to_raw_address_translation::sweep_test() const {
new_addr_type sweep_range = 16 * 1024 * 1024;

#if tr1_hash_map_ismap == 1
typedef tr1_hash_map<addrdec_t, new_addr_type> history_map_t;
#else
typedef tr1_hash_map<addrdec_t, new_addr_type, hash_addrdec_t> history_map_t;
#endif
typedef std::unordered_map<addrdec_t, new_addr_type, hash_addrdec_t> history_map_t;
history_map_t history_map;

for (new_addr_type raw_addr = 4; raw_addr < sweep_range; raw_addr += 4) {
Expand Down
17 changes: 6 additions & 11 deletions src/gpgpu-sim/gpu-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include "../abstract_hardware_model.h"
#include "../tr1_hash_map.h"
#include "gpu-misc.h"
#include "mem_fetch.h"

Expand Down Expand Up @@ -879,21 +879,16 @@ class tag_array {

bool is_used; // a flag if the whole cache has ever been accessed before

typedef tr1_hash_map<new_addr_type, unsigned> line_table;
typedef std::unordered_map<new_addr_type, unsigned> line_table;
line_table pending_lines;
};

class mshr_table {
public:
mshr_table(unsigned num_entries, unsigned max_merged)
: m_num_entries(num_entries),
m_max_merged(max_merged)
#if (tr1_hash_map_ismap == 0)
,
m_data(2 * num_entries)
#endif
{
}
m_max_merged(max_merged),
m_data(2 * num_entries) {}

/// Checks if there is a pending request to the lower memory level already
bool probe(new_addr_type block_addr) const;
Expand Down Expand Up @@ -931,8 +926,8 @@ class mshr_table {
bool m_has_atomic;
mshr_entry() : m_has_atomic(false) {}
};
typedef tr1_hash_map<new_addr_type, mshr_entry> table;
typedef tr1_hash_map<new_addr_type, mshr_entry> line_table;
typedef std::unordered_map<new_addr_type, mshr_entry> table;
typedef std::unordered_map<new_addr_type, mshr_entry> line_table;
table m_data;
line_table pending_lines;

Expand Down
2 changes: 1 addition & 1 deletion src/gpgpu-sim/gpu-sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class gpgpu_sim_wrapper {};

bool g_interactive_debugger_enabled = false;

tr1_hash_map<new_addr_type, unsigned> address_random_interleaving;
std::unordered_map<new_addr_type, unsigned> address_random_interleaving;

/* Clock Domains */

Expand Down
3 changes: 2 additions & 1 deletion src/gpgpu-sim/gpu-sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <fstream>
#include <iostream>
#include <list>
#include <unordered_map>
#include "../abstract_hardware_model.h"
#include "../option_parser.h"
#include "../trace.h"
Expand Down Expand Up @@ -64,7 +65,7 @@

class gpgpu_context;

extern tr1_hash_map<new_addr_type, unsigned> address_random_interleaving;
extern std::unordered_map<new_addr_type, unsigned> address_random_interleaving;

enum dram_ctrl_t { DRAM_FIFO = 0, DRAM_FRFCFS = 1 };

Expand Down
8 changes: 1 addition & 7 deletions src/gpgpu-sim/stat-tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,7 @@ void shader_CTA_count_visualizer_gzprint(gzFile fout) {
////////////////////////////////////////////////////////////////////////////////

thread_insn_span::thread_insn_span(unsigned long long cycle, gpgpu_context *ctx)
: m_cycle(cycle),
#if (tr1_hash_map_ismap == 1)
m_insn_span_count()
#else
m_insn_span_count(32 * 1024)
#endif
{
: m_cycle(cycle), m_insn_span_count(32 * 1024) {
gpgpu_ctx = ctx;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gpgpu-sim/stat-tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#ifndef STAT_TOOL_H
#define STAT_TOOL_H

#include <unordered_map>
#include "../abstract_hardware_model.h"
#include "../tr1_hash_map.h"
#include "histogram.h"

#include <stdio.h>
Expand Down Expand Up @@ -102,7 +102,7 @@ class thread_insn_span {

private:
gpgpu_context *gpgpu_ctx;
typedef tr1_hash_map<address_type, int> span_count_map;
typedef std::unordered_map<address_type, int> span_count_map;
unsigned long long m_cycle;
span_count_map m_insn_span_count;
};
Expand Down
52 changes: 0 additions & 52 deletions src/tr1_hash_map.h

This file was deleted.