Merge branch 'master' into graphics

This commit is contained in:
Blaise Tine
2021-10-15 19:32:11 -07:00
542 changed files with 124552 additions and 18682 deletions

View File

@@ -118,8 +118,13 @@ extern "C" {
})
// Set thread mask
inline void vx_tmc(unsigned num_threads) {
asm volatile (".insn s 0x6b, 0, x0, 0(%0)" :: "r"(num_threads));
inline void vx_tmc(unsigned thread_mask) {
asm volatile (".insn s 0x6b, 0, x0, 0(%0)" :: "r"(thread_mask));
}
// Set thread predicate
inline void vx_pred(unsigned condition) {
asm volatile (".insn s 0x6b, 0, x1, 0(%0)" :: "r"(condition));
}
typedef void (*vx_wspawn_pfn)();
@@ -186,6 +191,13 @@ inline int vx_core_id() {
return result;
}
// Return current threadk mask
inline int vx_thread_mask() {
int result;
asm volatile ("csrr %0, %1" : "=r"(result) : "i"(CSR_TMASK));
return result;
}
// Return the number of threads in a warp
inline int vx_num_threads() {
int result;

View File

@@ -9,7 +9,10 @@ extern "C" {
int vx_vprintf(const char* format, va_list va);
int vx_printf(const char * format, ...);
int vx_putchar(int c);
void vx_putchar(int c);
void vx_putint(int value, int base);
void vx_putfloat(float value, int precision);
#ifdef __cplusplus
}

View File

@@ -8,7 +8,7 @@
extern "C" {
#endif
struct context_t {
typedef struct {
uint32_t num_groups[3];
uint32_t global_offset[3];
uint32_t local_size[3];
@@ -16,11 +16,11 @@ struct context_t {
uint32_t *printf_buffer_position;
uint32_t printf_buffer_capacity;
uint32_t work_dim;
};
} context_t;
typedef void (*vx_spawn_kernel_cb) (
const void * /* arg */,
const struct context_t * /* context */,
const context_t * /* context */,
uint32_t /* group_x */,
uint32_t /* group_y */,
uint32_t /* group_z */
@@ -28,9 +28,9 @@ typedef void (*vx_spawn_kernel_cb) (
typedef void (*vx_spawn_tasks_cb)(int task_id, void *arg);
typedef void (*vx_serial_cb)(int task_id, void *arg);
typedef void (*vx_serial_cb)(void *arg);
void vx_spawn_kernel(struct context_t * ctx, vx_spawn_kernel_cb callback, void * arg);
void vx_spawn_kernel(context_t * ctx, vx_spawn_kernel_cb callback, void * arg);
void vx_spawn_tasks(int num_tasks, vx_spawn_tasks_cb callback, void * arg);