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

@@ -10,7 +10,7 @@ CFLAGS += -I./include -I../hw
PROJECT = libvortexrt
SRCS = ./src/vx_start.S ./src/vx_print.S ./src/vx_print.c ./src/vx_spawn.c ./src/vx_tex.c
SRCS = ./src/vx_start.S ./src/vx_print.S ./src/vx_print.c ./src/vx_spawn.c
OBJS := $(addsuffix .o, $(notdir $(SRCS)))

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
}

Binary file not shown.

View File

@@ -1028,46 +1028,3 @@ Disassembly of section .riscv.attributes:
1c: 326d jal fffff9c6 <.L50+0xfffff79e>
1e: 3070 fld fa2,224(s0)
20: 665f 7032 0030 0x307032665f
vx_tex.c.o: file format elf32-littleriscv
Disassembly of section .text.vx_tex:
00000000 <vx_tex>:
0: 00869693 slli a3,a3,0x8
4: 00a6e6b3 or a3,a3,a0
8: 00000513 li a0,0
c: 6ac5d56b 0x6ac5d56b
10: 00008067 ret
Disassembly of section .comment:
00000000 <.comment>:
0: 4700 lw s0,8(a4)
2: 203a4343 fmadd.s ft6,fs4,ft3,ft4,rmm
6: 4728 lw a0,72(a4)
8: 554e lw a0,240(sp)
a: 2029 jal 14 <vx_tex+0x14>
c: 2e39 jal 32a <vx_tex+0x32a>
e: 2e32 fld ft8,264(sp)
10: 0030 addi a2,sp,8
Disassembly of section .riscv.attributes:
00000000 <.riscv.attributes>:
0: 2541 jal 680 <vx_tex+0x680>
2: 0000 unimp
4: 7200 flw fs0,32(a2)
6: 7369 lui t1,0xffffa
8: 01007663 bgeu zero,a6,14 <vx_tex+0x14>
c: 0000001b 0x1b
10: 1004 addi s1,sp,32
12: 7205 lui tp,0xfffe1
14: 3376 fld ft6,376(sp)
16: 6932 flw fs2,12(sp)
18: 7032 flw ft0,44(sp)
1a: 5f30 lw a2,120(a4)
1c: 326d jal fffff9c6 <vx_tex+0xfffff9c6>
1e: 3070 fld fa2,224(s0)
20: 665f 7032 0030 0x307032665f

View File

@@ -1,9 +0,0 @@
#include <VX_config.h>
@ .type vx_tex_ld, @function
@ .global vx_tex_ld
@ vx_tex_ld:
@ slli a1,a1,0x8
@ or a1,a1,a0
@ .word 0x5ae7952b
@ ret

View File

@@ -1,13 +0,0 @@
#include <vx_tex.h>
#include <vx_intrinsics.h>
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_CORES_MAX 32
int vx_tex(unsigned t, unsigned u, unsigned v, unsigned lod){
return vx_tex_ld(t,u,v,lod);
}

Binary file not shown.