示例#1
0
        public void insert_entry(ulong input_pc, StrideEntry input_stride_entry)
        {
            for (int i = table_size - 1; i > 0; i--)
            {
                valid[i]          = valid[i - 1];
                pc[i]             = pc[i - 1];
                stride_entries[i] = stride_entries[i - 1];
            }

            valid[0]          = true;
            pc[0]             = input_pc;
            stride_entries[0] = input_stride_entry;
        }
示例#2
0
        public void insert_entry(ulong input_pc, StrideEntry input_stride_entry)
        {
            for (int i = table_size-1; i > 0; i --)
            {
                valid[i] = valid[i-1];
                pc[i] = pc[i-1];
                stride_entries[i] = stride_entries[i-1];
            }

            valid[0] = true;
            pc[0] = input_pc;
            stride_entries[0] = input_stride_entry;
        }
示例#3
0
        public void reorder_entries(int hit_position)
        {
            StrideEntry hit_position_entry = stride_entries[hit_position];
            bool        hit_position_valid = valid[hit_position];
            ulong       hit_position_pc    = pc[hit_position];

            for (int i = hit_position; i > 0; i--)
            {
                valid[i]          = valid[i - 1];
                pc[i]             = pc[i - 1];
                stride_entries[i] = stride_entries[i - 1];
            }

            valid[0]          = hit_position_valid;
            pc[0]             = hit_position_pc;
            stride_entries[0] = hit_position_entry;
        }
示例#4
0
        public void process_request(int pid, ulong block_addr, ulong input_pc)
        {
            if (!pc_present(input_pc))
            {
                StrideEntry new_stride_entry = new StrideEntry();
                new_stride_entry.block_addr = block_addr;
                new_stride_entry.trained    = false;
                new_stride_entry.stride     = 0;
                new_stride_entry.train_hits = 0;

                insert_entry(input_pc, new_stride_entry);
                return;
            }
            int hit_position   = entry_position(input_pc);
            int current_stride = (int)(block_addr - stride_entries[hit_position].block_addr);

            if (current_stride != stride_entries[hit_position].stride)
            {
                stride_entries[hit_position].stride     = current_stride;
                stride_entries[hit_position].trained    = false;
                stride_entries[hit_position].train_hits = 0;
            }

            stride_entries[hit_position].block_addr = block_addr;

            if (!stride_entries[hit_position].trained)
            {
                stride_entries[hit_position].train_hits++;
                stride_entries[hit_position].prefetch_block_addr = block_addr;
            }


            if (stride_entries[hit_position].train_hits >= num_trains)
            {
                stride_entries[hit_position].trained = true;
            }

            if (stride_entries[hit_position].stride == 0)
            {
                return;
            }

            if (stride_entries[hit_position].trained == true)
            {
                ulong max_block_address = stride_entries[hit_position].block_addr + (ulong)((distance + 1) * stride_entries[hit_position].stride);
                int   max_prefetches    = (int)(((int)max_block_address - (int)stride_entries[hit_position].prefetch_block_addr) / stride_entries[hit_position].stride);
                int   num_prefetches    = (max_prefetches > degree) ? degree : max_prefetches;


                for (int i = 0; i < num_prefetches; i++)
                {
                    stride_entries[hit_position].prefetch_block_addr += (ulong)stride_entries[hit_position].stride;
                    Req new_prefetch = create_new_prefetch_req(pid, stride_entries[hit_position].prefetch_block_addr);

                    bool mctrl_ok = insert_mctrl(new_prefetch);
                    if (!mctrl_ok)
                    {
                        RequestPool.enpool(new_prefetch);
                    }
                    else
                    {
                        Stat.procs[new_prefetch.pid].num_prefetches.Collect();
                    };
                }
            }

            return;
        }
示例#5
0
        public void process_request(int pid, ulong block_addr, ulong input_pc)
        {
            if (!pc_present(input_pc)) {
                StrideEntry new_stride_entry = new StrideEntry();
                new_stride_entry.block_addr = block_addr;
                new_stride_entry.trained = false;
                new_stride_entry.stride = 0;
                new_stride_entry.train_hits = 0;

                insert_entry(input_pc,new_stride_entry);
                return;
            }
            int hit_position = entry_position(input_pc);
            int current_stride = (int)(block_addr - stride_entries[hit_position].block_addr);

            if (current_stride != stride_entries[hit_position].stride)
            {
                stride_entries[hit_position].stride = current_stride;
                stride_entries[hit_position].trained = false;
                stride_entries[hit_position].train_hits = 0;
            }

            stride_entries[hit_position].block_addr = block_addr;

            if (!stride_entries[hit_position].trained) {
                stride_entries[hit_position].train_hits ++;
                stride_entries[hit_position].prefetch_block_addr = block_addr;
            }

            if (stride_entries[hit_position].train_hits >= num_trains) stride_entries[hit_position].trained = true;

            if (stride_entries[hit_position].stride == 0) return;

            if (stride_entries[hit_position].trained == true)
            {
                ulong max_block_address = stride_entries[hit_position].block_addr + (ulong)((distance + 1) * stride_entries[hit_position].stride);
                int max_prefetches = (int)(((int)max_block_address - (int)stride_entries[hit_position].prefetch_block_addr)/stride_entries[hit_position].stride);
                int num_prefetches = (max_prefetches > degree) ? degree : max_prefetches;

                for (int i = 0; i < num_prefetches; i ++)
                {
                    stride_entries[hit_position].prefetch_block_addr += (ulong)stride_entries[hit_position].stride;
                    Req new_prefetch = create_new_prefetch_req(pid, stride_entries[hit_position].prefetch_block_addr);

                    bool mctrl_ok = insert_mctrl(new_prefetch);
                    if (!mctrl_ok) RequestPool.enpool(new_prefetch);
                    else Stat.procs[new_prefetch.pid].num_prefetches.Collect();;
                }
            }

            return;
        }