Skip to content

Commit

Permalink
Simplify jitc_submit_cpu() interface
Browse files Browse the repository at this point in the history
Following preceding changes, we're no longer using two of the parameters
of this (complicated) function, let's remove them.
  • Loading branch information
wjakob committed Dec 3, 2023
1 parent c0a8423 commit b13496a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ const char *reduction_name[(int) ReduceOp::Count] = { "none", "sum", "mul",
/// Helper function: enqueue parallel CPU task (synchronous or asynchronous)
template <typename Func>
void jitc_submit_cpu(KernelType type, Func &&func, uint32_t width,
uint32_t size = 1, bool release_prev = true,
bool always_async = false) {
uint32_t size = 1) {

struct Payload { Func f; };
Payload payload{ std::forward<Func>(func) };
Expand All @@ -38,7 +37,7 @@ void jitc_submit_cpu(KernelType type, Func &&func, uint32_t width,
Task *new_task = task_submit_dep(
nullptr, &jitc_task, 1, size,
[](uint32_t index, void *payload) { ((Payload *) payload)->f(index); },
&payload, sizeof(Payload), nullptr, (int) always_async);
&payload, sizeof(Payload), nullptr, 0);

if (unlikely(jit_flag(JitFlag::LaunchBlocking)))
task_wait(new_task);
Expand All @@ -55,9 +54,7 @@ void jitc_submit_cpu(KernelType type, Func &&func, uint32_t width,
state.kernel_history.append(entry);
}

if (release_prev)
task_release(jitc_task);

task_release(jitc_task);
jitc_task = new_task;
}

Expand Down

0 comments on commit b13496a

Please sign in to comment.