Skip to content

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

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 4 commits into from
Nov 19, 2021
Merged

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

merged 4 commits into from
Nov 19, 2021

Conversation

GYDmedwin
Copy link
Contributor

@GYDmedwin GYDmedwin commented Nov 1, 2021

In the math package, there are only atan.cl, cbrt.cl, cos.cl, sin.cl, and sqrt.cl files initially. The other files in the math package I submitted this time are all newly implemented. We are using the SYCL-CTS test set for testing, one of which is the math_builtin_api test. Only when these files are newly added can it be compiled and passed.

@GYDmedwin GYDmedwin requested a review from bader as a code owner November 1, 2021 11:13
@GYDmedwin GYDmedwin closed this Nov 4, 2021
@GYDmedwin GYDmedwin reopened this Nov 8, 2021
@dm-vodopyanov dm-vodopyanov added the libclc libclc project related issues label Nov 8, 2021
@GYDmedwin
Copy link
Contributor Author

@bader Excuse me to interrupt, can you please see if the new request meets the requirements?

@GYDmedwin
Copy link
Contributor Author

@jchlanda Excuse me to interrupt, can you please see if the new request meets the requirements?

@GYDmedwin
Copy link
Contributor Author

@t4c1 Excuse me to interrupt, can you please see if the new request meets the requirements?

Copy link
Contributor

@t4c1 t4c1 left a comment

Choose a reason for hiding this comment

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

LGTM.

@bader
Copy link
Contributor

bader commented Nov 16, 2021

The description doesn't really help reviewers.

Made some changes based on the last suggestion.

Could you clarify what suggestion do you mean here?

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

Which function implementations were added and what is "the operator"? Could you provide more context, please?

@GYDmedwin
Copy link
Contributor Author

@bader Sorry to trouble you, I mean the suggestions made by you and other reviewers in the last request, including removing redundant comment codes, adding open source information in the code, and modifying the newly added names in the SOURCE file Arrange lexicographically, etc.

@GYDmedwin
Copy link
Contributor Author

@bader In the math package, there are only atan.cl, cbrt.cl, cos.cl, sin.cl, and sqrt.cl files initially. The other files in the math package I submitted this time are all newly implemented. We are using the SYCL-CTS test set for testing, one of which is the math_builtin_api test. Only when these files are newly added can it be compiled and passed. I'm sorry for not being able to describe clearly before, thank you for your patience to advise me.

@bader
Copy link
Contributor

bader commented Nov 16, 2021

the last request

Do you refer to #4849?

@bader
Copy link
Contributor

bader commented Nov 16, 2021

@bader In the math package, there are only atan.cl, cbrt.cl, cos.cl, sin.cl, and sqrt.cl files initially. The other files in the math package I submitted this time are all newly implemented. We are using the SYCL-CTS test set for testing, one of which is the math_builtin_api test. Only when these files are newly added can it be compiled and passed. I'm sorry for not being able to describe clearly before, thank you for your patience to advise me.

Thanks. Please, add this information to the pull request description.

@bader
Copy link
Contributor

bader commented Nov 19, 2021

@GYDmedwin, could you fix formatting, please?

Comment on lines +9 to +10
#include <clcmacro.h>
#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.

Interesting... clang-format doesn't complain here - all code except the first comment block is shifted by 2 spaces.

@bader
Copy link
Contributor

bader commented Nov 19, 2021

/summary:run

@bader bader merged commit 789ec8b into intel:sycl Nov 19, 2021
@zjin-lcf
Copy link
Contributor

zjin-lcf commented Nov 19, 2021

I listed the source files that are not found.

CMake Error at /path/to/llvm/libclc/cmake/modules/AddLibclc.cmake:54 (add_library):
Cannot find source file:

/path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/fma.cl
/path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/ilogb.cl
/path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/sinh.cl

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
Call Stack (most recent call first):
/path/to/llvm/libclc/CMakeLists.txt:368 (add_libclc_builtin_set)

@GYDmedwin
Copy link
Contributor Author

@zjin-lcf Sorry, this is an error, you can delete the file name directly in the SOURCE file.

@zjin-lcf
Copy link
Contributor

I appreciate very much your effort of adding many math functions for the HIP support!

@GYDmedwin
Copy link
Contributor Author

@zjin-lcf Thank you for your appreciation, and I am also very grateful to you and other reviewers for your suggestions to me, which allowed me to learn a lot of new knowledge.

@zjin-lcf
Copy link
Contributor

@GYDmedwin I have a question. Are 'fma', 'ilogb', and 'sinh' the last three un-implemented math functions ?

@GYDmedwin
Copy link
Contributor Author

@zjin-lcf In my test,‘ilogb’, ‘log2’, ‘remainder’ the last three un-implemented math functions. I am trying to implement them, but there are still some problems. I did not encounter ‘fma’, it may be my handwriting wrong. The ‘sinh’ source file was dropped, I will upload it now. I am currently repairing ‘ilogb’ and have been testing it. I forgot to delete its name in the SOURCE file. Thank you for your careful inspection, I will correct it immediately.

@zjin-lcf
Copy link
Contributor

@GYDmedwin No problem. I am building the repository with the Python script and observed some errors that abort the compilation.
Thanks for your great work.

In file included from /path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/ldexp.cl:10:
/path/to/llvm/libclc/generic/include/config.h:23:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_subnormals_disabled();
^
/path/to/llvm/libclc/generic/include/config.h:24:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp16_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:25:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp32_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:26:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp64_subnormals_supported();
^
In file included from /path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/ldexp.cl:11:
In file included from /path/to/llvm/libclc/generic/include/math/math.h:13:
/path/to/llvm/libclc/generic/include/config.h:23:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_subnormals_disabled();
^
/path/to/llvm/libclc/generic/include/config.h:24:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp16_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:25:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp32_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:26:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp64_subnormals_supported();
^
In file included from /path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/ldexp.cl:10:
/path/to/llvm/libclc/generic/include/config.h:23:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_subnormals_disabled();
^
/path/to/llvm/libclc/generic/include/config.h:24:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp16_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:25:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp32_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:26:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp64_subnormals_supported();
^
In file included from /path/to/llvm/libclc/amdgcn-amdhsa/libspirv/math/ldexp.cl:11:
In file included from /path/to/llvm/libclc/generic/include/math/math.h:13:
/path/to/llvm/libclc/generic/include/config.h:23:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_subnormals_disabled();
^
/path/to/llvm/libclc/generic/include/config.h:24:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp16_subnormals_supported();
^
/path/to/sycl-space/llvm/libclc/generic/include/config.h:25:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp32_subnormals_supported();
^
/path/to/llvm/libclc/generic/include/config.h:26:1: error: unknown type name '_CLC_DECL'
_CLC_DECL bool __clc_fp64_subnormals_supported();
^

@GYDmedwin
Copy link
Contributor Author

@zjin-lcf Sorry, I did not encounter this problem when compiling, I will take time to look at this problem later, thank you.

@zjin-lcf
Copy link
Contributor

I will try again. Thanks.

@zjin-lcf
Copy link
Contributor

I needed to comment the lines in the ldexp.cl so that the compile script in Python would not report compile error shown above.
#include <config.h>
#include <math/math.h>

@zjin-lcf
Copy link
Contributor

@GYDmedwin

I tried an example and got the following error. Is it reproducible ? If not, I will build again. Thanks.

lld: error: undefined hidden symbol: __spirv_ocl_frexp(float, int*)

@zjin-lcf
Copy link
Contributor

@FMarno
Copy link
Contributor

FMarno commented Jan 18, 2022

@GYDmedwin I've been able to reproduce the error that @zjin-lcf got so I will look into it.

@FMarno
Copy link
Contributor

FMarno commented Jan 24, 2022

@zjin-lcf I've put up a PR here that should fix frexp #5377.
There will likely be similar problems with modf and sincos since they both also use pointers.

@bader
Copy link
Contributor

bader commented Jan 24, 2022

@FMarno, can we fix modf and sincos in #5377 too?

@FMarno
Copy link
Contributor

FMarno commented Jan 24, 2022

@bader Sure, I just need to get my head around the macros first!

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

Successfully merging this pull request may close these issues.

7 participants