Skip to content

Commit

Permalink
Fixes missing float conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
doe300 committed Feb 25, 2018
1 parent 8ba7862 commit 0cf109f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion include/_async.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
return event; \
}

//Since it doesn't affect the functional behavior, the implementation is a no-op
#define PREFETCH(type) \
INLINE void prefetch(const __global type * ptr, size_t num_entries) OVERLOADABLE \
{ \
Expand Down
12 changes: 6 additions & 6 deletions include/_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,27 @@
}

#define CONVERT_FLOAT_TO_FLOAT(saturation, rounding) \
INLINE float convert_##destType##saturation##rounding(float val) OVERLOADABLE CONST \
INLINE float convert_float##saturation##rounding(float val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
} \
INLINE float##2 convert_##destType##2##saturation##rounding(float##2 val) OVERLOADABLE CONST \
INLINE float##2 convert_float2##saturation##rounding(float##2 val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
} \
INLINE float##3 convert_##destType##3##saturation##rounding(float##3 val) OVERLOADABLE CONST \
INLINE float##3 convert_float3##saturation##rounding(float##3 val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
} \
INLINE float##4 convert_##destType##4##saturation##rounding(float##4 val) OVERLOADABLE CONST \
INLINE float##4 convert_float4##saturation##rounding(float##4 val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
} \
INLINE float##8 convert_##destType##8##saturation##rounding(float##8 val) OVERLOADABLE CONST \
INLINE float##8 convert_float8##saturation##rounding(float##8 val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
} \
INLINE float##16 convert_##destType##16##saturation##rounding(float##16 val) OVERLOADABLE CONST \
INLINE float##16 convert_float16##saturation##rounding(float##16 val) OVERLOADABLE CONST \
{ \
return ROUND_TO_INTEGER(rounding, val); \
}
Expand Down
3 changes: 3 additions & 0 deletions include/_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ VECTOR_STORE(uint)
VECTOR_STORE(int)
VECTOR_STORE(float)

//TODO vload(a)_half, vload(a)_halfn (+rounding) (load half and return converted to float, possible with unpack-modes)
//TODO vstore(a)_half, vstore(a)_halfn (+rounding) (store float as half in memory, possible with pack modes)

/*
* TODO shuffle2, but LLVM fails, since the indices for the __builtin intrinsic need to be constant integers!
VECTOR_SHUFFLE_2(uchar, uchar)
Expand Down
10 changes: 10 additions & 0 deletions include/_work_items.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ INLINE size_t get_local_linear_id() OVERLOADABLE CONST
return vc4cl_mul24(vc4cl_mul24(vc4cl_local_id(2), vc4cl_local_size(1), VC4CL_UNSIGNED), vc4cl_bitcast_uint(vc4cl_local_size(0)), VC4CL_UNSIGNED) + vc4cl_mul24(vc4cl_local_id(1), vc4cl_local_size(0), VC4CL_UNSIGNED) + vc4cl_local_id(0);
}

/*
* Returns the work-items 1-dimensional global ID.
*/
size_t get_global_linear_id(void) CONST; // prototype
size_t get_global_linear_id(void) OVERLOADABLE CONST
{
return ((get_global_id(2) - get_global_offset(2)) * get_global_size(1) * get_global_size(0)) +
((get_global_id(1) - get_global_offset(1)) * get_global_size(0)) +
(get_global_id(0) - get_global_offset(0));
}

#endif /* VC4CL_WORK_ITEMS_H */

0 comments on commit 0cf109f

Please sign in to comment.