runtime static library
This commit is contained in:
64
runtime/include/vx_intrinsics.h
Normal file
64
runtime/include/vx_intrinsics.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef VX_INTRINSICS_H
|
||||
#define VX_INTRINSICS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Spawn warps
|
||||
void vx_wspawn(int num_warps, unsigned func_ptr);
|
||||
|
||||
// Set thread mask
|
||||
void vx_tmc(int num_threads);
|
||||
|
||||
// Warp Barrier
|
||||
void vx_barrier(int barried_id, int num_warps);
|
||||
|
||||
// Split on a predicate
|
||||
void vx_split(int predicate);
|
||||
|
||||
// Join
|
||||
void vx_join();
|
||||
|
||||
// Return the warp's unique thread id
|
||||
int vx_thread_id();
|
||||
|
||||
// Return the core's unique warp id
|
||||
int vx_warp_id();
|
||||
|
||||
// Return processsor unique core id
|
||||
int vx_core_id();
|
||||
|
||||
// Return processsor global thread id
|
||||
int vx_thread_gid();
|
||||
|
||||
// Return processsor global warp id
|
||||
int vx_warp_gid();
|
||||
|
||||
// Return the number of threads in a warp
|
||||
int vx_num_threads();
|
||||
|
||||
// Return the number of warps in a core
|
||||
int vx_num_warps();
|
||||
|
||||
// Return the number of cores in the processsor
|
||||
int vx_num_cores();
|
||||
|
||||
// Return the number of cycles
|
||||
int vx_num_cycles();
|
||||
|
||||
// Return the number of instructions
|
||||
int vx_num_instrs();
|
||||
|
||||
#define __if(b) vx_split(b); \
|
||||
if (b)
|
||||
|
||||
#define __else else
|
||||
|
||||
#define __endif vx_join();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
20
runtime/include/vx_print.h
Normal file
20
runtime/include/vx_print.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef VX_IO_H
|
||||
#define VX_IO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void vx_print_hex(unsigned);
|
||||
void vx_printf(const char *, unsigned);
|
||||
|
||||
void vx_print_str(const char *);
|
||||
void vx_printc(unsigned, char c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
38
runtime/include/vx_spawn.h
Normal file
38
runtime/include/vx_spawn.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef VX_API_H
|
||||
#define VX_API_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*func_t)(void *);
|
||||
|
||||
void vx_spawn_warps(int num_warps, int num_threads, func_t func_ptr , void * args);
|
||||
|
||||
struct context_t {
|
||||
uint32_t num_groups[3];
|
||||
uint32_t global_offset[3];
|
||||
uint32_t local_size[3];
|
||||
char * printf_buffer;
|
||||
uint32_t *printf_buffer_position;
|
||||
uint32_t printf_buffer_capacity;
|
||||
uint32_t work_dim;
|
||||
};
|
||||
|
||||
/* The default work-group function prototype as generated by Workgroup.cc. */
|
||||
typedef void (*vx_pocl_workgroup_func) (const void * /* args */,
|
||||
const struct context_t * /* context */,
|
||||
uint32_t /* group_x */,
|
||||
uint32_t /* group_y */,
|
||||
uint32_t /* group_z */);
|
||||
|
||||
void pocl_spawn(struct context_t * ctx, vx_pocl_workgroup_func pfn, const void * args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user