2025-03-26 11:50:07 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025 Paul Irofti <paul@irofti.net>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2025-03-20 19:32:25 +02:00
|
|
|
#ifndef CLccubes_H__
|
|
|
|
#define CLccubes_H__
|
|
|
|
|
2025-03-26 11:35:52 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2025-03-20 19:32:25 +02:00
|
|
|
#include "cl_setup.h"
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
#include <stdint.h>
|
|
|
|
#else
|
|
|
|
#include <stdint_msvc.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ROW_DIM 0
|
|
|
|
#define COL_DIM 1
|
|
|
|
|
|
|
|
struct ccubes_context {
|
|
|
|
struct cl_uctx *clctx;
|
|
|
|
|
2025-03-21 18:52:41 +02:00
|
|
|
cl_program ccubes_program;
|
2025-03-20 19:32:25 +02:00
|
|
|
cl_kernel ccubes_task;
|
2025-03-25 23:03:40 +02:00
|
|
|
|
2025-03-26 11:34:01 +02:00
|
|
|
/* internal memory sizes */
|
|
|
|
int k;
|
|
|
|
int ninputs;
|
|
|
|
int posrows;
|
|
|
|
int negrows;
|
|
|
|
int implicant_words;
|
|
|
|
int value_bit_width;
|
|
|
|
int pichart_words;
|
2025-03-26 11:41:28 +02:00
|
|
|
int estimPI;
|
2025-03-26 11:34:01 +02:00
|
|
|
|
2025-03-25 23:03:40 +02:00
|
|
|
/* INPUTS */
|
2025-03-26 11:34:01 +02:00
|
|
|
cl_mem nofvalues;
|
2025-03-25 23:03:40 +02:00
|
|
|
cl_mem ON_set;
|
|
|
|
cl_mem OFF_set;
|
|
|
|
cl_mem p_implicants_pos;
|
|
|
|
cl_mem p_implicants_val;
|
|
|
|
cl_mem last_index;
|
|
|
|
cl_mem p_covered;
|
|
|
|
cl_mem p_pichart_pos;
|
|
|
|
|
|
|
|
/* OUTPUTS */
|
|
|
|
cl_mem coverage;
|
|
|
|
cl_mem fixed_bits;
|
|
|
|
cl_mem value_bits;
|
|
|
|
cl_mem pichart_values;
|
2025-03-26 11:34:01 +02:00
|
|
|
|
|
|
|
/* Host outputs */
|
|
|
|
bool *h_coverage;
|
|
|
|
unsigned int *h_fixed_bits;
|
|
|
|
unsigned int *h_value_bits;
|
|
|
|
unsigned int *h_pichart_values;
|
|
|
|
|
|
|
|
/* ND-Range */
|
|
|
|
size_t gws; /* global work size */
|
2025-03-20 19:32:25 +02:00
|
|
|
};
|
|
|
|
|
2025-03-26 11:41:28 +02:00
|
|
|
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 */
|
|
|
|
);
|
2025-03-21 18:52:41 +02:00
|
|
|
|
2025-03-20 19:32:25 +02:00
|
|
|
int
|
|
|
|
clccubes(struct ccubes_context *ccubesctx, cl_mem alpha0, cl_mem G, size_t signals,
|
|
|
|
size_t atoms, uint32_t sparsity, uint32_t pcoding, cl_mem gamma, cl_uint
|
|
|
|
num_events_in_wait_list, const cl_event *event_wait_list, cl_event *ev_ccubes);
|
|
|
|
|
|
|
|
#endif
|