Skip to content
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
4 changes: 1 addition & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ cc_library(
# These are NOT public headers and should not be included from other targets.
textual_hdrs = INTERNAL_HDRS,
visibility = ["//visibility:public"],
deps = [
"@FXdiv",
] + select({
deps = [] + select({
":linux_arm": ["@cpuinfo"],
":linux_armeabi": ["@cpuinfo"],
":linux_armhf": ["@cpuinfo"],
Expand Down
602 changes: 301 additions & 301 deletions src/fastpath.c

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions src/legacy-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stddef.h>

/* Dependencies */
#include <fxdiv.h>
#include "threadpool-utils.h"

/* Public library header */
#include <pthreadpool.h>
Expand Down Expand Up @@ -55,8 +55,8 @@ void pthreadpool_compute_2d_tiled(pthreadpool_t threadpool,
struct compute_3d_tiled_context {
pthreadpool_function_3d_tiled_t function;
void* argument;
struct fxdiv_divisor_size_t tile_range_j;
struct fxdiv_divisor_size_t tile_range_k;
struct pthreadpool_divisor_size_t tile_range_j;
struct pthreadpool_divisor_size_t tile_range_k;
size_t range_i;
size_t range_j;
size_t range_k;
Expand All @@ -67,12 +67,12 @@ struct compute_3d_tiled_context {

static void compute_3d_tiled(const struct compute_3d_tiled_context* context,
size_t linear_index) {
const struct fxdiv_divisor_size_t tile_range_k = context->tile_range_k;
const struct fxdiv_result_size_t tile_index_ij_k =
fxdiv_divide_size_t(linear_index, tile_range_k);
const struct fxdiv_divisor_size_t tile_range_j = context->tile_range_j;
const struct fxdiv_result_size_t tile_index_i_j =
fxdiv_divide_size_t(tile_index_ij_k.quotient, tile_range_j);
const struct pthreadpool_divisor_size_t tile_range_k = context->tile_range_k;
const struct pthreadpool_div_result tile_index_ij_k =
pthreadpool_divide_with_divisor(linear_index, tile_range_k);
const struct pthreadpool_divisor_size_t tile_range_j = context->tile_range_j;
const struct pthreadpool_div_result tile_index_i_j =
pthreadpool_divide_with_divisor(tile_index_ij_k.quotient, tile_range_j);
const size_t max_tile_i = context->tile_i;
const size_t max_tile_j = context->tile_j;
const size_t max_tile_k = context->tile_k;
Expand Down Expand Up @@ -110,8 +110,8 @@ void pthreadpool_compute_3d_tiled(pthreadpool_t threadpool,
struct compute_3d_tiled_context context = {
.function = function,
.argument = argument,
.tile_range_j = fxdiv_init_size_t(tile_range_j),
.tile_range_k = fxdiv_init_size_t(tile_range_k),
.tile_range_j = pthreadpool_init_divisor(tile_range_j),
.tile_range_k = pthreadpool_init_divisor(tile_range_k),
.range_i = range_i,
.range_j = range_j,
.range_k = range_k,
Expand All @@ -127,9 +127,9 @@ void pthreadpool_compute_3d_tiled(pthreadpool_t threadpool,
struct compute_4d_tiled_context {
pthreadpool_function_4d_tiled_t function;
void* argument;
struct fxdiv_divisor_size_t tile_range_kl;
struct fxdiv_divisor_size_t tile_range_j;
struct fxdiv_divisor_size_t tile_range_l;
struct pthreadpool_divisor_size_t tile_range_kl;
struct pthreadpool_divisor_size_t tile_range_j;
struct pthreadpool_divisor_size_t tile_range_l;
size_t range_i;
size_t range_j;
size_t range_k;
Expand All @@ -142,15 +142,15 @@ struct compute_4d_tiled_context {

static void compute_4d_tiled(const struct compute_4d_tiled_context* context,
size_t linear_index) {
const struct fxdiv_divisor_size_t tile_range_kl = context->tile_range_kl;
const struct fxdiv_result_size_t tile_index_ij_kl =
fxdiv_divide_size_t(linear_index, tile_range_kl);
const struct fxdiv_divisor_size_t tile_range_j = context->tile_range_j;
const struct fxdiv_result_size_t tile_index_i_j =
fxdiv_divide_size_t(tile_index_ij_kl.quotient, tile_range_j);
const struct fxdiv_divisor_size_t tile_range_l = context->tile_range_l;
const struct fxdiv_result_size_t tile_index_k_l =
fxdiv_divide_size_t(tile_index_ij_kl.remainder, tile_range_l);
const struct pthreadpool_divisor_size_t tile_range_kl = context->tile_range_kl;
const struct pthreadpool_div_result tile_index_ij_kl =
pthreadpool_divide_with_divisor(linear_index, tile_range_kl);
const struct pthreadpool_divisor_size_t tile_range_j = context->tile_range_j;
const struct pthreadpool_div_result tile_index_i_j =
pthreadpool_divide_with_divisor(tile_index_ij_kl.quotient, tile_range_j);
const struct pthreadpool_divisor_size_t tile_range_l = context->tile_range_l;
const struct pthreadpool_div_result tile_index_k_l =
pthreadpool_divide_with_divisor(tile_index_ij_kl.remainder, tile_range_l);
const size_t max_tile_i = context->tile_i;
const size_t max_tile_j = context->tile_j;
const size_t max_tile_k = context->tile_k;
Expand Down Expand Up @@ -196,9 +196,9 @@ void pthreadpool_compute_4d_tiled(pthreadpool_t threadpool,
struct compute_4d_tiled_context context = {
.function = function,
.argument = argument,
.tile_range_kl = fxdiv_init_size_t(tile_range_k * tile_range_l),
.tile_range_j = fxdiv_init_size_t(tile_range_j),
.tile_range_l = fxdiv_init_size_t(tile_range_l),
.tile_range_kl = pthreadpool_init_divisor(tile_range_k * tile_range_l),
.tile_range_j = pthreadpool_init_divisor(tile_range_j),
.tile_range_l = pthreadpool_init_divisor(tile_range_l),
.range_i = range_i,
.range_j = range_j,
.range_k = range_k,
Expand Down
Loading
Loading