many fixes

This commit is contained in:
Blaise Tine
2021-03-27 20:58:12 -04:00
parent 2d48fe13c8
commit 39a8579c27
34 changed files with 5021 additions and 515 deletions

View File

@@ -74,16 +74,9 @@ inline void vx_join() {
// Warp Barrier
inline void vx_barrier(unsigned barried_id, unsigned num_warps) {
asm volatile (".insn s 0x6b, 4, %1, 0cd (%0)" :: "r"(barried_id), "r"(num_warps));
asm volatile (".insn s 0x6b, 4, %1, 0(%0)" :: "r"(barried_id), "r"(num_warps));
}
// Texture load
#define vx_tex_ld(unit, u, v, lod) ({ \
register unsigned result; \
asm volatile (".insn r4 0x6b, 5, " __ASM_STR(unit) ", %0, %1, %2, %3" :: "r"(result), "r"(u), "r"(v), "r"(lod)); \
result; \
})
// Return active warp's thread id
inline int vx_thread_id() {
int result;

View File

@@ -1,14 +1,16 @@
#ifndef VX_API_H
#define VX_API_H
#include <stdint.h>
#include <stdio.h>
#ifndef VX_TEX_H
#define VX_TEX_H
#ifdef __cplusplus
extern "C" {
#endif
int vx_tex(unsigned t, unsigned u, unsigned v, unsigned lod);
unsigned vx_tex(unsigned unit, unsigned u, unsigned v, unsigned lod) {
unsigned result;
unsigned lod_unit = (unit << 24) | lod;
asm volatile (".insn r4 0x6b, 5, 0, %0, %1, %2, %3" : "=r"(result) : "r"(u), "r"(v), "r"(lod_unit));
return result;
}
#ifdef __cplusplus
}