Fix compilation errors.

This commit is contained in:
Paul Irofti 2025-03-26 11:41:28 +02:00
parent fb60e6a04e
commit 158923d4e3
2 changed files with 65 additions and 26 deletions

View file

@ -10,6 +10,25 @@
#include "logging.h"
unsigned long int
nchoosek(int n, int k)
{
if (k == 0 || k == n) return 1;
if (k == 1) return n;
unsigned long int result = 1;
if (k > n - k) {
k = n - k;
}
for (int i = 0; i < k; i++) {
result = result * (n - i) / (i + 1);
}
return result;
}
int
ccubes_init(struct ccubes_context *ctx,
int k,
@ -114,14 +133,14 @@ err:
int
ccubes_alloc(struct ccubes_context *ctx,
const real *nofvalues, /* IN: RC */
const real *ON_set, /* IN: RC */
const real *OFF_set, /* IN: RC */
const unsigned int *p_implicants_pos, /* IN: RC */
const unsigned int *p_implicants_val, /* IN: RC */
const int *last_index, /* IN: RC */
const int *p_covered, /* IN: RC */
const int *p_pichart_pos, /* IN: RC */
real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */
@ -276,8 +295,8 @@ ccubes_run(struct ccubes_context *ctx)
}
rc = clEnqueueNDRangeKernel(ctx->clctx->gpu_queue, ctx->ccubes_task,
1, NULL, ctx->gws, NULL,
0, NULL, &ev_ksvd[1]);
1, NULL, &ctx->gws, NULL,
0, NULL, NULL);
if (rc != CL_SUCCESS) {
log_error("clccubes", "NDRange failed (%d)", rc);
goto err;
@ -328,7 +347,7 @@ err:
return rc;
}
void
int
ccubes_unmap(struct ccubes_context *ctx)
{
int rc = 0;
@ -370,18 +389,18 @@ ccubes(int k,
int value_bit_width,
int pichart_words,
int estimPI,
const real *nofvalues, /* IN: RC */
const real *ON_set, /* IN: RC */
const real *OFF_set, /* IN: RC */
const unsigned int *p_implicants_pos, /* IN: RC */
const unsigned int *p_implicants_val, /* IN: RC */
const int *last_index, /* IN: RC */
const int *p_covered, /* IN: RC */
const int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */
unsigned int *pichart_values /* OUT: RW */
real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */
unsigned int *pichart_values /* OUT: RW */
)
{
int rc = 0;
@ -425,8 +444,7 @@ ccubes(int k,
coverage,
fixed_bits,
value_bits,
pichart_values
)
pichart_values);
if (rc != CL_SUCCESS) {
log_error("clccubes", "ccubes_alloc failed (%d)", rc);
goto err;

View file

@ -28,6 +28,7 @@ struct ccubes_context {
int implicant_words;
int value_bit_width;
int pichart_words;
int estimPI;
/* INPUTS */
cl_mem nofvalues;
@ -55,7 +56,27 @@ struct ccubes_context {
size_t gws; /* global work size */
};
int ccubes(void);
int ccubes(int k,
int ninputs,
int posrows,
int negrows,
int implicant_words,
int value_bit_width,
int pichart_words,
int estimPI,
real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */
unsigned int *pichart_values /* OUT: RW */
);
int
clccubes(struct ccubes_context *ccubesctx, cl_mem alpha0, cl_mem G, size_t signals,