Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyasa committed Dec 10, 2024
1 parent 5fb7d89 commit a17ea8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
17 changes: 6 additions & 11 deletions icicle/backend/cpu/src/field/cpu_vec_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,29 +841,24 @@ eIcicleError cpu_highest_non_zero_idx(

REGISTER_HIGHEST_NON_ZERO_IDX_BACKEND("CPU", cpu_highest_non_zero_idx<scalar_t>);



/*********************************** Execute program ***********************************/
template <typename T>
eIcicleError cpu_execute_program(
std::vector<T*>& data,
Program<T>& program,
uint64_t size,
const VecOpsConfig& config)
eIcicleError cpu_execute_program(std::vector<T*>& data, Program<T>& program, uint64_t size, const VecOpsConfig& config)
{
if (data.size() != program.m_nof_parameters) {
ICICLE_LOG_ERROR << "Program has " << program.m_nof_parameters << " while data has " << data.size() << " parameters";
ICICLE_LOG_ERROR << "Program has " << program.m_nof_parameters << " while data has " << data.size()
<< " parameters";
return eIcicleError::INVALID_ARGUMENT;
}
}
const uint64_t total_nof_operations = size * config.batch_size;
CpuProgramExecutor prog_executor(program);
// init prog_executor to point to data vectors
for (int param_idx = 0; param_idx<program.m_nof_parameters; ++ param_idx) {
for (int param_idx = 0; param_idx < program.m_nof_parameters; ++param_idx) {
prog_executor.m_variable_ptrs[param_idx] = data[param_idx];
}

// run over all elements in the arrays and execute the program
for (uint64_t i = 0; i < total_nof_operations; i ++) {
for (uint64_t i = 0; i < total_nof_operations; i++) {
prog_executor.execute();
for (auto& var_ptr : prog_executor.m_variable_ptrs) {
var_ptr++;
Expand Down
9 changes: 2 additions & 7 deletions icicle/include/icicle/vec_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,19 +364,14 @@ namespace icicle {
*
* @tparam T Type of the elements in the vectors.
* @param data_vec vector of arrays. Those arrays contains the parameters for the program.
* @param program a class that decribes the functionality to run on each set of entries at the vectors.
* @param program a class that describes the functionality to run on each set of entries at the vectors.
* @param size Size of each arrays. The program will be executed size times
* @param config Configuration for the operation.
* @return eIcicleError Error code indicating success or failure.
*/

template <typename T>
eIcicleError execute_program(
std::vector<T*>& data,
Program<T>& program,
uint64_t size,
const VecOpsConfig& config);

eIcicleError execute_program(std::vector<T*>& data, Program<T>& program, uint64_t size, const VecOpsConfig& config);

/**
* @brief Evaluates a polynomial at given domain points.
Expand Down

0 comments on commit a17ea8c

Please sign in to comment.