mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 13:57:17 -04:00
Added extra test cases
This commit is contained in:
parent
b293397c01
commit
a51fb03d5c
3 changed files with 97 additions and 27 deletions
|
@ -263,12 +263,72 @@ inline void vx_shfl() {
|
|||
".insn i %0, 3, x14, x13, 1067" :: "i"(RISCV_CUSTOM2)); //(c(01)+b(00001)+membermask(address(01011)))
|
||||
//".insn i opcode6, func3, rd, rs1, simm12"
|
||||
}
|
||||
|
||||
|
||||
inline void vx_tile(unsigned int tile_mask, int thread_count) {
|
||||
__asm__ volatile (
|
||||
".insn r %0, 1, 0, x0, %1, %2" :: "i"(RISCV_CUSTOM3),"r"(tile_mask),"r"(thread_count));
|
||||
}
|
||||
|
||||
// mode: 0:ALL, 1:ANY, 2:UNI, 3:BALLOT
|
||||
inline int vx_vote_sync(int pred,
|
||||
int neg,
|
||||
int mode,
|
||||
int threadMask)
|
||||
{
|
||||
int func3 = ((neg & 0x1) << 2) | (mode & 0x3);
|
||||
|
||||
int rs1 = pred;
|
||||
|
||||
int rd;
|
||||
|
||||
__asm__ volatile (
|
||||
"addi a2, %[tm], 0\n\t"
|
||||
".insn i %[opcode], %[f3], %[rd], %[rs1], 12\n\t"
|
||||
: [rd] "=r" (rd)
|
||||
: [tm] "r" (threadMask),
|
||||
[opcode] "i" (RISCV_CUSTOM1),
|
||||
[f3] "i" (func3),
|
||||
[rs1] "r" (rs1)
|
||||
: "a2"
|
||||
);
|
||||
|
||||
return rd;
|
||||
}
|
||||
|
||||
|
||||
inline int vx_shfl_sync(int offset, int mode, int val, int threadMask)
|
||||
{
|
||||
int func3 = mode & 0x3;
|
||||
|
||||
int rs1 = val;
|
||||
|
||||
int rd;
|
||||
|
||||
int imm12 = (11) | ((offset & 0x1F) << 5) | (1 << 10);
|
||||
|
||||
int c = -1;
|
||||
|
||||
__asm__ volatile (
|
||||
"addi a1, %[tm], 0\n\t" // Load immediate value 15 into a1(x11) register (membermask)
|
||||
"addi a2, %[c], 0\n\t" // Load immediate value 15 into a2(x12) register (c)
|
||||
".insn i %[opcode], %[f3], %[rd], %[rs], %[imm]\n\t"
|
||||
: "=r"(rd)
|
||||
: [tm] "r"(threadMask),
|
||||
[c] "r"(c),
|
||||
[opcode] "i"(RISCV_CUSTOM2),
|
||||
[f3] "i"(func3),
|
||||
[rd] "r"(rd),
|
||||
[rs] "r"(rs1),
|
||||
[imm] "i"(imm12)
|
||||
:
|
||||
"a1", "a2"
|
||||
);
|
||||
|
||||
return rd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,8 @@ all:
|
|||
$(MAKE) -C vote
|
||||
$(MAKE) -C shfl
|
||||
$(MAKE) -C coop
|
||||
$(MAKE) -C cg_mse_cm_hw
|
||||
$(MAKE) -C cg_mse_tm_hw
|
||||
|
||||
run-simx:
|
||||
$(MAKE) -C basic run-simx
|
||||
|
@ -36,6 +38,8 @@ run-simx:
|
|||
$(MAKE) -C vote run-simx
|
||||
$(MAKE) -C shfl run-simx
|
||||
$(MAKE) -C coop run-simx
|
||||
$(MAKE) -C cg_mse_cm_hw run-simx
|
||||
$(MAKE) -C cg_mse_tm_hw run-simx
|
||||
|
||||
run-rtlsim:
|
||||
$(MAKE) -C basic run-rtlsim
|
||||
|
@ -54,6 +58,8 @@ run-rtlsim:
|
|||
$(MAKE) -C vote run-rtlsim
|
||||
$(MAKE) -C shfl run-rtlsim
|
||||
$(MAKE) -C coop run-rtlsim
|
||||
$(MAKE) -C cg_mse_cm_hw run-rtlsim
|
||||
$(MAKE) -C cg_mse_tm_hw run-rtlsim
|
||||
|
||||
run-opae:
|
||||
$(MAKE) -C basic run-opae
|
||||
|
@ -72,6 +78,8 @@ run-opae:
|
|||
$(MAKE) -C vote run-opae
|
||||
$(MAKE) -C shfl run-opae
|
||||
$(MAKE) -C coop run-opae
|
||||
$(MAKE) -C cg_mse_cm_hw run-opae
|
||||
$(MAKE) -C cg_mse_tm_hw run-opae
|
||||
|
||||
clean:
|
||||
$(MAKE) -C basic clean
|
||||
|
@ -89,4 +97,6 @@ clean:
|
|||
$(MAKE) -C sgemm2x clean
|
||||
$(MAKE) -C vote clean
|
||||
$(MAKE) -C shfl clean
|
||||
$(MAKE) -C coop clean
|
||||
$(MAKE) -C coop clean
|
||||
$(MAKE) -C cg_mse_cm_hw clean
|
||||
$(MAKE) -C cg_mse_tm_hw clean
|
|
@ -27,30 +27,30 @@ void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
|
|||
// vx_tile(0b10000000,32); // default config
|
||||
|
||||
// //CASE 2
|
||||
// int i = vx_thread_id();
|
||||
// vx_printf("A (thread %d)\n", i);
|
||||
int i = vx_thread_id();
|
||||
vx_printf("A (thread %d)\n", i);
|
||||
|
||||
// vx_tile(0b10001000,16);
|
||||
vx_tile(0b10001000,16);
|
||||
|
||||
// vx_tile(0b00001000,16);
|
||||
// {
|
||||
// vx_printf("B (thread %d)\n", i);
|
||||
// vx_barrier(0,0b00001000);
|
||||
// vx_printf("C (thread %d)\n", i);
|
||||
// }
|
||||
// vx_tile(0b10000000,16);
|
||||
// {
|
||||
// vx_printf("D (thread %d)\n", i);
|
||||
// }
|
||||
vx_tile(0b00001000,16);
|
||||
{
|
||||
vx_printf("B (thread %d)\n", i);
|
||||
vx_barrier(0,0b00001000);
|
||||
vx_printf("C (thread %d)\n", i);
|
||||
}
|
||||
vx_tile(0b10000000,16);
|
||||
{
|
||||
vx_printf("D (thread %d)\n", i);
|
||||
}
|
||||
|
||||
|
||||
// vx_tile(0b10001000,16);
|
||||
// if(i%16 == 0)
|
||||
// {
|
||||
// vx_printf("E (thread %d)\n", i);
|
||||
// }
|
||||
vx_tile(0b10001000,16);
|
||||
if(i%16 == 0)
|
||||
{
|
||||
vx_printf("E (thread %d)\n", i);
|
||||
}
|
||||
|
||||
// vx_tile(0b10000000,32); //default config
|
||||
vx_tile(0b10000000,32); //default config
|
||||
|
||||
// //CASE 3
|
||||
|
||||
|
@ -164,17 +164,17 @@ void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
|
|||
|
||||
// //CASE 9
|
||||
|
||||
// vx_printf("A (thread %d)\n", vx_thread_id());
|
||||
vx_printf("A (thread %d)\n", vx_thread_id());
|
||||
|
||||
// vx_tile(0b10101010,8);
|
||||
vx_tile(0b10101010,8);
|
||||
|
||||
// vx_printf("B (thread %d)\n", vx_thread_id());
|
||||
vx_printf("B (thread %d)\n", vx_thread_id());
|
||||
|
||||
// vx_barrier(0,0b10101010);
|
||||
vx_barrier(0,0b10101010);
|
||||
|
||||
// vx_printf("C (thread %d)\n", vx_thread_id());
|
||||
vx_printf("C (thread %d)\n", vx_thread_id());
|
||||
|
||||
// vx_tile(0b10000000,32); //default config
|
||||
vx_tile(0b10000000,32); //default config
|
||||
|
||||
// //CASE 10
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue