Skip to content

[SYCL][LIBCLC] Add memory/control barrier, sqrt, sin and cos builtins #4091

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
Jul 16, 2021

Conversation

jchlanda
Copy link
Contributor

No description provided.

Copy link
Contributor

@Naghasan Naghasan left a comment

Choose a reason for hiding this comment

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

Beside the mem_fence function name, LGTM

@jchlanda jchlanda force-pushed the builtins branch 2 times, most recently from 90a711a to d9964c1 Compare July 13, 2021 11:28
@jchlanda jchlanda changed the title Builtins [SYCL][LIBCLC] Add memory/control barrier, sqrt, sin and cos builtins Jul 13, 2021
@jchlanda jchlanda marked this pull request as ready for review July 13, 2021 11:34
@jchlanda jchlanda requested a review from bader as a code owner July 13, 2021 11:34
@bader
Copy link
Contributor

bader commented Jul 13, 2021

@jchlanda, unfortunately ROCm plugin is not validated by CI system, so I have to clarify - there some in-tree tests or llvm-test-suite tests covering these built-ins. Right?

@jchlanda
Copy link
Contributor Author

@jchlanda, unfortunately ROCm plugin is not validated by CI system, so I have to clarify - there some in-tree tests or llvm-test-suite tests covering these built-ins. Right?

@bader, yes there are tests for each built-in already in the repo, see ControlBarrier, or sqrt, admittedly, not the most robust.

@bader
Copy link
Contributor

bader commented Jul 13, 2021

@jchlanda, unfortunately ROCm plugin is not validated by CI system, so I have to clarify - there some in-tree tests or llvm-test-suite tests covering these built-ins. Right?

@bader, yes there are tests for each built-in already in the repo, see ControlBarrier, or sqrt, admittedly, not the most robust.

AFAIK, libclc project lit tests are not executed in CI. :(
Buildbot CI builds checl-llvm, check-clang, checl-llvm-spirv and check-sycl targets. E.g. http://ci.llvm.intel.com:8010/#/builders/37/builds/9881.
Jenkins CI runs Khronos SYCL-CTS and SYCL tests from llvm-test-suite in addition BuildBot's list.

@Naghasan
Copy link
Contributor

@jchlanda, unfortunately ROCm plugin is not validated by CI system, so I have to clarify - there some in-tree tests or llvm-test-suite tests covering these built-ins. Right?

@bader, yes there are tests for each built-in already in the repo, see ControlBarrier, or sqrt, admittedly, not the most robust.

AFAIK, libclc project lit tests are not executed in CI. :(
Buildbot CI builds checl-llvm, check-clang, checl-llvm-spirv and check-sycl targets. E.g. http://ci.llvm.intel.com:8010/#/builders/37/builds/9881.
Jenkins CI runs Khronos SYCL-CTS and SYCL tests from llvm-test-suite in addition BuildBot's list.

libclc lit tests only checks the binding produced will match what is expected from an SYCL perspective.
I added these libclc lit test mainly as sanity check before running the SYCL tests. Upstream libclc don't have one per say (unless it change since). The SYCL test suite is what ensures they work as expected.

Given the situation I agree it is better than nothing, but libclc tests are close to worthless anyhow (understand, you won't replace running on an actual device).

@bader
Copy link
Contributor

bader commented Jul 14, 2021

I see that llvm-test-suite covers all these built-ins already (e.g. https://github.com/intel/llvm-test-suite/blob/intel/SYCL/DeviceLib/built-ins/scalar_math.cpp, https://github.com/intel/llvm-test-suite/blob/intel/SYCL/DeviceLib/cmath_test.cpp, ...).

@jchlanda, clang-format-check has failed. Will you apply clang-format to the patch or you have reasons to commit as is?

@jchlanda
Copy link
Contributor Author

I see that llvm-test-suite covers all these built-ins already (e.g. https://github.com/intel/llvm-test-suite/blob/intel/SYCL/DeviceLib/built-ins/scalar_math.cpp, https://github.com/intel/llvm-test-suite/blob/intel/SYCL/DeviceLib/cmath_test.cpp, ...).

@jchlanda, clang-format-check has failed. Will you apply clang-format to the patch or you have reasons to commit as is?

@bader that was in a macro that I took from an existing file, my bad for not checking. Fixed now.

bader
bader previously approved these changes Jul 14, 2021
Comment on lines 3 to 6
_CLC_OVERLOAD _CLC_DEF _CLC_CONVERGENT void
__spirv_ControlBarrier(unsigned int scope, unsigned int memory,
unsigned int semantics);

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need SPIR-V built-in declarations? IIRC, @Naghasan added compiler support for these functions as compiler built-ins (can be enabled via clang's flag), so that they can be used w/o explicit declaration.

Copy link
Contributor

@Naghasan Naghasan Jul 14, 2021

Choose a reason for hiding this comment

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

Do we need SPIR-V built-in declarations?

You are right, clang generates the builtin prototype internally, so this is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, required a tweak to the way it's built (adding -Xclang -fdeclare-spirv-builtins).

bader
bader previously approved these changes Jul 14, 2021
@jchlanda
Copy link
Contributor Author

@bader I can't access Jenkins/Precommit link, is that something that this patch has broken, or unrelated?

@bader
Copy link
Contributor

bader commented Jul 15, 2021

It's not related.
@Naghasan, you've requested some changes. Does it look good to you now?

Copy link
Contributor

@Naghasan Naghasan left a comment

Choose a reason for hiding this comment

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

@Naghasan, you've requested some changes. Does it look good to you now?

yep, LGTM

@bader bader merged commit f7aa2bf into intel:sycl Jul 16, 2021
@bader bader added libclc libclc project related issues hip Issues related to execution on HIP backend. labels Aug 2, 2021
@jchlanda jchlanda deleted the builtins branch December 6, 2021 18:56
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.

3 participants