1717#ifndef __VX_INTRINSICS_H__
1818#define __VX_INTRINSICS_H__
1919
20- #include <stdint .h>
20+ #include <stddef .h>
2121#include <VX_types.h>
2222
23- #if __riscv_xlen == 64
24- typedef unsigned long size_t ; // 64-bit RISC-V
25- #elif __riscv_xlen == 32
26- typedef unsigned int size_t ; // 32-bit RISC-V
27- #else
28- #error "Unknown RISC-V architecture"
29- #endif
30-
3123#if defined(__clang__ )
3224#define __UNIFORM__ __attribute__((annotate("vortex.uniform")))
3325#else
@@ -38,12 +30,6 @@ typedef unsigned int size_t; // 32-bit RISC-V
3830extern "C" {
3931#endif
4032
41- #ifdef __ASSEMBLY__
42- #define __ASM_STR (x ) x
43- #else
44- #define __ASM_STR (x ) #x
45- #endif
46-
4733#define RISCV_CUSTOM0 0x0B
4834#define RISCV_CUSTOM1 0x2B
4935#define RISCV_CUSTOM2 0x5B
@@ -110,7 +96,7 @@ extern "C" {
11096})
11197
11298// Set thread mask
113- inline void vx_tmc (size_t thread_mask ) {
99+ inline void vx_tmc (int thread_mask ) {
114100 __asm__ volatile (".insn r %0, 0, 0, x0, %1, x0" :: "i" (RISCV_CUSTOM0 ), "r" (thread_mask ));
115101}
116102
@@ -139,20 +125,20 @@ inline void vx_pred_n(int condition, int thread_mask) {
139125
140126// Spawn warps
141127typedef void (* vx_wspawn_pfn )();
142- inline void vx_wspawn (size_t num_warps , vx_wspawn_pfn func_ptr ) {
128+ inline void vx_wspawn (int num_warps , vx_wspawn_pfn func_ptr ) {
143129 __asm__ volatile (".insn r %0, 1, 0, x0, %1, %2" :: "i" (RISCV_CUSTOM0 ), "r" (num_warps ), "r" (func_ptr ));
144130}
145131
146132// Split on a predicate
147133inline int vx_split (int predicate ) {
148- size_t ret ;
134+ int ret ;
149135 __asm__ volatile (".insn r %1, 2, 0, %0, %2, x0" : "=r" (ret ) : "i" (RISCV_CUSTOM0 ), "r" (predicate ));
150136 return ret ;
151137}
152138
153139// Split on a not predicate
154140inline int vx_split_n (int predicate ) {
155- size_t ret ;
141+ int ret ;
156142 __asm__ volatile (".insn r %1, 2, 0, %0, %2, x1" : "=r" (ret ) : "i" (RISCV_CUSTOM0 ), "r" (predicate ));
157143 return ret ;
158144}
0 commit comments