/* * Copyright (c) 2025 Paul Irofti * * 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. */ #ifndef CLccubes_H__ #define CLccubes_H__ #include #include "cl_setup.h" #ifndef _MSC_VER #include #else #include #endif #define ROW_DIM 0 #define COL_DIM 1 struct ccubes_context { struct cl_uctx *clctx; cl_program ccubes_program; cl_kernel ccubes_task; /* internal memory sizes */ int k; int ninputs; int posrows; int negrows; int implicant_words; int value_bit_width; int value_bit_mask; int pichart_words; int estimPI; /* INPUTS */ cl_mem nofvalues; 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 redundant; cl_mem coverage; cl_mem fixed_bits; cl_mem value_bits; cl_mem pichart_values; /* Host outputs */ // bool *h_redundant; 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 */ size_t goff; /* global offset */ }; struct ccubes_context * ccubes_create(); int ccubes_do_tasks(struct ccubes_context *ccubesctx, int n_tasks, int n_tasks_off, int k, int ninputs, int posrows, int negrows, int implicant_words, int value_bit_width, int value_bit_mask, int pichart_words, int estimPI, int *nofvalues, /* IN: RC */ int *ON_set, /* IN: RC */ int *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 *redundant, /* OUT: RW */ bool *coverage, /* OUT: RW */ unsigned int *fixed_bits, /* OUT: RW */ unsigned int *value_bits, /* OUT: RW */ unsigned int *pichart_values /* OUT: RW */ ); void ccubes_clean_up(struct ccubes_context *ctx); void ccubes_destroy(struct ccubes_context *ctx); #endif