mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-19 11:34:59 -04:00
Merge pull request #238 from vortexgpgpu/bug_fixes
workaroud fix for opencl kernel include in POCL
This commit is contained in:
commit
9929c42417
1 changed files with 18 additions and 17 deletions
|
@ -17,10 +17,11 @@
|
|||
#ifndef __VX_INTRINSICS_H__
|
||||
#define __VX_INTRINSICS_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <VX_types.h>
|
||||
|
||||
typedef __SIZE_TYPE__ word_t;
|
||||
|
||||
#if defined(__clang__)
|
||||
#define __UNIFORM__ __attribute__((annotate("vortex.uniform")))
|
||||
#else
|
||||
|
@ -37,13 +38,13 @@ extern "C" {
|
|||
#define RISCV_CUSTOM3 0x7B
|
||||
|
||||
#define csr_read(csr) ({ \
|
||||
size_t __r; \
|
||||
word_t __r; \
|
||||
__asm__ __volatile__ ("csrr %0, %1" : "=r" (__r) : "i" (csr) : "memory"); \
|
||||
__r; \
|
||||
})
|
||||
|
||||
#define csr_write(csr, val) ({ \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrw %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -51,8 +52,8 @@ extern "C" {
|
|||
})
|
||||
|
||||
#define csr_swap(csr, val) ({ \
|
||||
size_t __r; \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __r; \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrrw %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -61,8 +62,8 @@ extern "C" {
|
|||
})
|
||||
|
||||
#define csr_read_set(csr, val) ({ \
|
||||
size_t __r; \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __r; \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrrs %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -71,7 +72,7 @@ extern "C" {
|
|||
})
|
||||
|
||||
#define csr_set(csr, val) ({ \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrs %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -79,8 +80,8 @@ extern "C" {
|
|||
})
|
||||
|
||||
#define csr_read_clear(csr, val) ({ \
|
||||
size_t __r; \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __r; \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrrc %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -89,7 +90,7 @@ extern "C" {
|
|||
})
|
||||
|
||||
#define csr_clear(csr, val) ({ \
|
||||
size_t __v = (size_t)(val); \
|
||||
word_t __v = (word_t)(val); \
|
||||
if (__builtin_constant_p(val) && __v < 32) \
|
||||
__asm__ __volatile__ ("csrc %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
|
||||
else \
|
||||
|
@ -222,21 +223,21 @@ inline void vx_fence() {
|
|||
}
|
||||
|
||||
//Matrix load
|
||||
inline void vx_matrix_load(unsigned dest, unsigned addr)
|
||||
inline void vx_matrix_load(unsigned dest, unsigned addr)
|
||||
{
|
||||
asm volatile (".insn i 0x7b, 0, x0, %0(%1)" :: "i"(dest), "r"(addr));
|
||||
__asm__ volatile (".insn i 0x7b, 0, x0, %0(%1)" :: "i"(dest), "r"(addr));
|
||||
}
|
||||
|
||||
//Matrix Store
|
||||
inline void vx_matrix_store(unsigned addr)
|
||||
inline void vx_matrix_store(unsigned addr)
|
||||
{
|
||||
asm volatile (".insn i 0x7b, 1, x0, 0(%0)" :: "r"(addr));
|
||||
__asm__ volatile (".insn i 0x7b, 1, x0, 0(%0)" :: "r"(addr));
|
||||
}
|
||||
|
||||
//Matrix Mul
|
||||
inline void vx_matrix_mul()
|
||||
inline void vx_matrix_mul()
|
||||
{
|
||||
asm volatile (".insn i 0x7b, 2, x0, 0(x0)");
|
||||
__asm__ volatile (".insn i 0x7b, 2, x0, 0(x0)");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Reference in a new issue