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

Bug fixes for 1) over-counting instructions 2) broken functional sim #142

Open
wants to merge 2 commits 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
15 changes: 6 additions & 9 deletions src/cuda-sim/cuda-sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2180,27 +2180,24 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL )

//we excute the kernel one CTA (Block) at the time, as synchronization functions work block wise
while(!kernel.no_more_ctas_to_run()){
unsigned temp=kernel.get_next_cta_id_single();
unsigned cta_id=kernel.get_next_cta_id_single();


if(cp_op==0 || (cp_op==1 && cta_launched<cp_cta_resume && kernel.get_uid()==cp_kernel) || kernel.get_uid()< cp_kernel) // just fro testing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, Serina - do you know what this if is testing for?
I know this is not your code - but your change effect code flows when this thing is true and I cannot tell from quick inspection what it is for.

Also, thanks for the fixes! :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the if-statement guards whether to perform functional simulation for each CTA. It is evaluated to true when any of the following is true: 1) not doing checkpoint cp_op==0 2) checkpoint is on and we have reached the checkpoint kernel boundary, but we have not reached the CTA boundary cp_op==1 && cta_launched<cp_cta_resume && kernel.get_uid()==cp_kernel 3) we have not reached the checkpoint kernel boundary kernel.get_uid() < cp_kernel. We need to call kernel.increment_cta_id() so that the functional simulation can progress with an updated cta id (returned by kernel.get_next_cta_id_single()).

If this if-statement is off, we have reached the checkpoint boundary and we should halt functional simulation and transition into performance simulation. However, we still need to break the while loop by incrementing the kernel cta id (kernel.increment_cta_id()).

That being said, I am actually not sure how this code EVER worked with checkpointing...

{
functionalCoreSim cta(
&kernel,
g_the_gpu,
g_the_gpu->getShaderCoreConfig()->warp_size
);
cta.execute(cp_count,temp);
cta.execute(cp_count,cta_id);

#if (CUDART_VERSION >= 5000)
launch_all_device_kernels();
#endif
}
else
{
kernel.increment_cta_id();
}
cta_launched++;
}

kernel.increment_cta_id();
cta_launched++;
}


Expand Down
6 changes: 5 additions & 1 deletion src/gpgpu-sim/shader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,7 @@ void ldst_unit::L1_latency_queue_cycle()
assert( !read_sent );
l1_latency_queue[0] = NULL;
if ( mf_next->get_inst().is_load() ) {
bool insn_completed = false;
for ( unsigned r=0; r < MAX_OUTPUT_VALUES; r++)
if (mf_next->get_inst().out[r] > 0)
{
Expand All @@ -1705,9 +1706,12 @@ void ldst_unit::L1_latency_queue_cycle()
{
m_pending_writes[mf_next->get_inst().warp_id()].erase(mf_next->get_inst().out[r]);
m_scoreboard->releaseRegister(mf_next->get_inst().warp_id(),mf_next->get_inst().out[r]);
m_core->warp_inst_complete(mf_next->get_inst());
insn_completed = true;
}
}

if (insn_completed)
m_core->warp_inst_complete(mf_next->get_inst());
}

//For write hit in WB policy
Expand Down