Skip to content

[libclc] Add new function implementations in math. #4849

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

Closed
wants to merge 1 commit into from
Closed

[libclc] Add new function implementations in math. #4849

wants to merge 1 commit into from

Conversation

GYDmedwin
Copy link
Contributor

Add some new function implementations in the math package, so that the operator can run normally

@GYDmedwin GYDmedwin requested a review from bader as a code owner October 29, 2021 05:06
@bader bader changed the title [libclc]Add new function implementations in math. [libclc] Add new function implementations in math. Oct 29, 2021
@bader bader added hip Issues related to execution on HIP backend. libclc libclc project related issues labels Oct 29, 2021
int##HALF_VEC_LEN ep_lo; \
int##HALF_VEC_LEN ep_hi; \
GENTYPE res = (GENTYPE)(__spirv_ocl_frexp(x.lo, &ep_lo), \
__spirv_ocl_frexp(x.hi, &ep_lo)); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__spirv_ocl_frexp(x.hi, &ep_lo)); \
__spirv_ocl_frexp(x.hi, &ep_hi)); \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment on lines +17 to +22
// #include <math/unary_builtin.inc>

//#include <spirv/spirv.h>

#include "tables.h"
//#include <clcmacro.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more commented code.

Comment on lines +1 to +12
// #include <spirv/spirv.h>

// double __clc_remainder(double, double);
// float __clc_remainderf(float, float);
// #ifdef cl_khr_fp16
// #pragma OPENCL EXTENSION cl_khr_fp16 : enable
// half __clc_remainderf(half, half);
// #endif
// #define __CLC_FUNCTION __spirv_ocl_remainder
// #define __CLC_BUILTIN __clc_remainder
// #define __CLC_BUILTIN_F __CLC_XCONCAT(__CLC_BUILTIN, f)
// #include <math/binary_builtin.inc>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More commented code.

Comment on lines +1 to +11
//#include <spirv/spirv.h>
//#include <clcmacro.h>

// double __ocml_sincos_f64(double,double);
// float __ocml_sincos_f32(float,float);

// #define __CLC_FUNCTION __spirv_ocl_sincos
// #define __CLC_BUILTIN __ocml_sincos
// #define __CLC_BUILTIN_F __CLC_XCONCAT(__CLC_BUILTIN, _f32)
// #define __CLC_BUILTIN_D __CLC_XCONCAT(__CLC_BUILTIN, _f64)
// #include <math/binary_builtin.inc>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry,I delete my repository by mistake, and I forked again. But I don't know how to update this request now, should I close this one ,and create a new pull request?

math/logb.cl
math/log2.cl
math/log1p.cl
math/rsqrt.cl
workitem/get_global_size.cl
workitem/get_local_size.cl
workitem/get_num_groups.cl
workitem/get_max_sub_group_size.cl
workitem/get_num_sub_groups.cl
workitem/get_sub_group_id.cl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why workitem/get_sub_group_local_id.cl and misc/sub_group_shuffle.cl are removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the wrong file was selected when submitting, new submission has modified this.

@@ -0,0 +1,11 @@
#include <spirv/spirv.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add this comment to all new files:

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry,I delete my repository by mistake, and I forked again. But I don't know how to update this request now, should I close this one ,and create a new pull request?

#define __CLC_FUNC __spirv_ocl_remainder
#define __CLC_SW_FUNC __clc_remainder
#define __CLC_BODY <clc_sw_binary.inc>
#include <clc/math/gentype.inc>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <clc/math/gentype.inc>
#include <clc/math/gentype.inc>


double __ocml_asin_f64(double);
float __ocml_asin_f32(float);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please unify the white spaces so the files have the same layout?

//===----------------------------------------------------------------------===//
#include <utils.h>

_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if that's really needed, as only used once?


double __ocml_log2_f64(double);
float __ocml_log2_f32(float);
half __ocml_log2_f16(half);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be hidden behind an ifdef?

Also: below clang format and further down commented out code.

#include <clcmacro.h>

double __ocml_modf_f64(double, double *);
float __ocml_modf_f32(float, float *);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line, to keep it in line with other files?

#include <spirv/spirv.h>
#include <clcmacro.h>

double __ocml_nextafter_f64(double,double);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format here and the next line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry,I delete my repository by mistake, and I forked again. But I don't know how to update this request now, should I close this one ,and create a new pull request?

@GYDmedwin
Copy link
Contributor Author

Sorry,I delete my repository by mistake, and I forked again. But I don't know how to update this request now, should I close this one ,and create a new pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hip Issues related to execution on HIP backend. libclc libclc project related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants