Skip to content

[libclc] Move round to CLC library #128721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libclc/clc/include/clc/math/clc_round.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef __CLC_MATH_CLC_ROUND_H__
#define __CLC_MATH_CLC_ROUND_H__

#define __CLC_BODY <clc/math/unary_decl.inc>
#define __CLC_FUNCTION __clc_round

#include <clc/math/gentype.inc>

#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif // __CLC_MATH_CLC_ROUND_H__
1 change: 1 addition & 0 deletions libclc/clc/lib/generic/SOURCES
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ math/clc_modf.cl
math/clc_nan.cl
math/clc_nextafter.cl
math/clc_rint.cl
math/clc_round.cl
math/clc_sw_fma.cl
math/clc_trunc.cl
relational/clc_all.cl
Expand Down
6 changes: 6 additions & 0 deletions libclc/clc/lib/generic/math/clc_round.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <clc/internal/clc.h>

#undef __CLC_FUNCTION
#define __CLC_FUNCTION __clc_round
#define __CLC_BUILTIN __builtin_elementwise_round
#include <clc/math/unary_builtin.inc>
7 changes: 2 additions & 5 deletions libclc/generic/lib/math/round.cl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <clc/clc.h>

// Map the llvm intrinsic to an OpenCL function.
#define __CLC_FUNCTION __clc_round
#define __CLC_INTRINSIC "llvm.round"
#include <clc/math/unary_intrin.inc>
#include <clc/clcmacro.h>
#include <clc/math/clc_round.h>

#undef __CLC_FUNCTION
#define __CLC_FUNCTION round
Expand Down