SAITPublic / PIMSimulator

Processing-In-Memory (PIM) Simulator
Other
131 stars 44 forks source link

Where are the compute cycles simulated? #15

Open prapti02 opened 6 months ago

prapti02 commented 6 months ago

Look at the following code fragment in PIMBenchTestCases.h:

uint64_t measureCycle(bool ispim = false) { cout << "Inside uint64_t measureCycle(bool ispim = false). 1" << endl; // cin.get(); uint64_t cycle = 0; uint64_t starting_addr = 0;

    if (is_pim_ == true)
    {
        cout << "Inside if (usePIM). "<<endl;
        kernel_->executeEltwise(dim_data_->output_npbst_.getTotalDim(), pimBankType::ALL_BANK,
                                kernel_type_, input_row0_, result_row_, input_row1_);
        kernel_->runPIM();
        cycle = kernel_->getCycle();
    }
    else
    {
        cout << "Inside else (usePIM). "<<endl;
        uint32_t input_data_size_in_byte =
            dim_data_->getDataSize(dim_data_->input_dim_, dim_data_->batch_size_);
        uint32_t input1_data_size_in_byte =
            dim_data_->getDataSize(dim_data_->input_dim_, dim_data_->batch_size_);
        uint32_t output_data_size_in_byte =
            dim_data_->getDataSize(dim_data_->output_dim_, dim_data_->batch_size_);
        starting_addr = genMemTraffic(mem_, false, input_data_size_in_byte, starting_addr);
        starting_addr = genMemTraffic(mem_, false, input1_data_size_in_byte, starting_addr);
        run(mem_, &cycle);
        genMemTraffic(mem_, true, output_data_size_in_byte, starting_addr);  // result-vec
        run(mem_, &cycle);
    }

    Where is it simulating the compute cycles in this code? The run() adds memory cycles in its implementation. How are we comparing cycles taken with and without PIM without taking in account the compute cycles?
iamshcha commented 6 months ago

This is a similar question to another issue. Please See https://github.com/SAITPublic/PIMSimulator/issues/10

prapti02 commented 2 months ago

I have a follow-up question. Is this code considering the data transfer time to the CPU for non-PIM cases? I see that the PIM-enabled cycles are more than the PIM-disabled cycles. I am adding compute cycles to the PIM disabled case. Even after that the cycles are less than that of the PIM enabled case.