Skip to content

[SYCL] vec abi unification and trivially copyable #9492

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 30 commits into from
Aug 2, 2023

Conversation

cperkinsintel
Copy link
Contributor

@cperkinsintel cperkinsintel commented May 17, 2023

adapted from #6816

sycl::vec now uses std::array on host in all cases, but device access is via ext_vector_type so as to not lose performance. Alignment is set the same as the size to a maximum of 64 bytes, which aligns with an upcoming spec change proposal. In the cases where the size is greater than 64 we use std::array on the device. We no longer need to emit a pragma on Windows and we can use alignas() on all platforms.

@cperkinsintel cperkinsintel requested a review from romanovvlad May 17, 2023 02:06
@cperkinsintel cperkinsintel temporarily deployed to aws May 17, 2023 02:12 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws May 17, 2023 16:53 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws May 17, 2023 17:29 — with GitHub Actions Inactive
@cperkinsintel
Copy link
Contributor Author

cperkinsintel commented May 17, 2023

Hmm - am getting an internal error on Linux when it's trying to preprocess the builtins macros. But I can't reproduce this error locally. The CI is using GCC 11.3.0 , but that works for me. I also tested GCC 9.4 and Clang 17.0, both worked as well. Even tried a debug build using GCC 11.3.0, worked fine.

2023-05-17T17:29:36.6656716Z FAILED: tools/sycl/source/CMakeFiles/sycl_object.dir/detail/builtins_relational.cpp.o 
2023-05-17T17:29:36.6660930Z CCACHE_DIR=/__w//build_cache_default CCACHE_MAXSIZE=8G CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++ -DCL_TARGET_OPENCL_VERSION=300 -DENABLE_OPAQUE_POINTERS=1 -DSYCL2020_DISABLE_DEPRECATION_WARNINGS -DXPTI_ENABLE_INSTRUMENTATION -DXPTI_STATIC_LIBRARY -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__SYCL_INTERNAL_API -I/__w/llvm/llvm/build/tools/sycl/source -I/__w/llvm/llvm/src/sycl/source -I/__w/llvm/llvm/build/include -I/__w/llvm/llvm/src/llvm/include -I/__w/llvm/llvm/src/xpti/include -I/__w/llvm/llvm/src/sycl/include -I/__w/llvm/llvm/build/_deps/ocl-headers-src -I/__w/llvm/llvm/src/sycl-fusion/jit-compiler/include -I/__w/llvm/llvm/src/sycl-fusion/common/include -I/__w/llvm/llvm/build/_deps/vc-intrinsics-src/GenXIntrinsics/include -I/__w/llvm/llvm/build/_deps/vc-intrinsics-build/GenXIntrinsics/lib/GenXIntrinsics/../../include -I/__w/llvm/llvm/build/_deps/vc-intrinsics-build/GenXIntrinsics/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wextra -Wno-deprecated-declarations -Werror -O3 -DNDEBUG -UNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -Wno-psabi -std=c++17 -MD -MT tools/sycl/source/CMakeFiles/sycl_object.dir/detail/builtins_relational.cpp.o -MF tools/sycl/source/CMakeFiles/sycl_object.dir/detail/builtins_relational.cpp.o.d -o tools/sycl/source/CMakeFiles/sycl_object.dir/detail/builtins_relational.cpp.o -c /__w/llvm/llvm/src/sycl/source/detail/builtins_relational.cpp
2023-05-17T17:29:36.6664050Z In file included from /__w/llvm/llvm/src/sycl/source/detail/builtins_relational.cpp:12:
2023-05-17T17:29:36.6664817Z /__w/llvm/llvm/src/sycl/source/detail/builtins_relational.cpp: In function 'sycl::_V1::vec<int, 4> __host_std::sycl_host_SignBitSet(sycl::_V1::vec<float, 4>)':
2023-05-17T17:29:36.6665251Z /__w/llvm/llvm/src/sycl/source/detail/builtins_helper.hpp:24:3: error: unrecognizable insn:
2023-05-17T17:29:36.6665521Z    24 |   }
2023-05-17T17:29:36.6665695Z       |   ^
2023-05-17T17:29:36.6666233Z /__w/llvm/llvm/src/sycl/source/detail/builtins_helper.hpp:121:3: note: in expansion of macro '__MAKE_1V'
2023-05-17T17:29:36.6666589Z   121 |   __MAKE_1V(Fun, Call, 4, Ret, Arg1)                                           \
2023-05-17T17:29:36.6666813Z       |   ^~~~~~~~~
2023-05-17T17:29:36.6667239Z /__w/llvm/llvm/src/sycl/source/detail/builtins_relational.cpp:470:1: note: in expansion of macro 'MAKE_1V_FUNC'
2023-05-17T17:29:36.6667620Z   470 | MAKE_1V_FUNC(sycl_host_SignBitSet, __vSignBitSet, s::cl_int, s::cl_float)
2023-05-17T17:29:36.6667874Z       | ^~~~~~~~~~~~
2023-05-17T17:29:36.6668091Z (insn 10 7 11 2 (set (reg:V4SI 82 [ vect__17.61304 ])
2023-05-17T17:29:36.6668569Z         (lshiftrt:V4SI (subreg:V4SI (subreg:V4SF (reg/v:TI 88 [ x ]) 0) 0)
2023-05-17T17:29:36.6668941Z             (const_int 31 [0x1f]))) "/usr/include/c++/11/cmath":662:29 -1
2023-05-17T17:29:36.6669170Z      (nil))
2023-05-17T17:29:36.6669355Z during RTL pass: vregs
2023-05-17T17:29:36.6669677Z /__w/llvm/llvm/src/sycl/source/detail/builtins_helper.hpp:24:3: internal compiler error: in extract_insn, at recog.c:2770
2023-05-17T17:29:36.6669975Z    24 |   }
2023-05-17T17:29:36.6670138Z       |   ^
2023-05-17T17:29:36.6670541Z /__w/llvm/llvm/src/sycl/source/detail/builtins_helper.hpp:121:3: note: in expansion of macro '__MAKE_1V'
2023-05-17T17:29:36.6670878Z   121 |   __MAKE_1V(Fun, Call, 4, Ret, Arg1)                                           \
2023-05-17T17:29:36.6671095Z       |   ^~~~~~~~~
2023-05-17T17:29:36.6671514Z /__w/llvm/llvm/src/sycl/source/detail/builtins_relational.cpp:470:1: note: in expansion of macro 'MAKE_1V_FUNC'
2023-05-17T17:29:36.6671886Z   470 | MAKE_1V_FUNC(sycl_host_SignBitSet, __vSignBitSet, s::cl_int, s::cl_float)
2023-05-17T17:29:36.6672132Z       | ^~~~~~~~~~~~
2023-05-17T17:29:36.6672340Z 0xe3320d internal_error(char const*, ...)
2023-05-17T17:29:36.6672545Z 	???:0
2023-05-17T17:29:36.6672759Z 0xe29d35 fancy_abort(char const*, int, char const*)
2023-05-17T17:29:36.6672963Z 	???:0
2023-05-17T17:29:36.6673208Z 0xb017cc _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
2023-05-17T17:29:36.6673462Z 	???:0
2023-05-17T17:29:36.6673693Z 0xb017ee _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
2023-05-17T17:29:36.6673927Z 	???:0
2023-05-17T17:29:36.6674124Z Please submit a full bug report,
2023-05-17T17:29:36.6674369Z with preprocessed source if appropriate.
2023-05-17T17:29:36.6674657Z Please include the complete backtrace with any bug report.
2023-05-17T17:29:36.6675072Z See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.

…on errors. also remove old conjunction code for std::conjunction
@cperkinsintel cperkinsintel temporarily deployed to aws May 19, 2023 20:31 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws May 22, 2023 18:55 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 13, 2023 02:44 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 13, 2023 19:02 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 27, 2023 19:37 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 27, 2023 20:15 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 28, 2023 18:42 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 28, 2023 19:19 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 31, 2023 18:21 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws July 31, 2023 18:59 — with GitHub Actions Inactive
@cperkinsintel
Copy link
Contributor Author

Ping to reviewers,

I believe I've addressed all the concerns, either here or in conversations offline. They are holding the ABI-breaking window open for this PR, so I'd like keep the process moving along. Let me know if you need anything else.

Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

@cperkinsintel cperkinsintel temporarily deployed to aws August 1, 2023 21:34 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws August 1, 2023 22:45 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws August 1, 2023 23:16 — with GitHub Actions Inactive
@cperkinsintel cperkinsintel temporarily deployed to aws August 1, 2023 23:56 — with GitHub Actions Inactive
@againull againull merged commit 531aabf into intel:sycl Aug 2, 2023
@steffenlarsen
Copy link
Contributor

Post-commit found that the redirected call will cause a recursion as the double overload is defined later than the call to it. To avoid this #10652 moves said overload definition.

dm-vodopyanov pushed a commit that referenced this pull request Aug 9, 2023
The recent sycl::vec changes (#9492)
broke they unary operations. This PR fixes them and adds some testing to
avoid that in the future.
cperkinsintel added a commit to cperkinsintel/llvm that referenced this pull request Oct 17, 2023
mdtoguchi pushed a commit to mdtoguchi/llvm that referenced this pull request Oct 18, 2023
adapted from intel#6816   

sycl::vec now uses std::array on host in all cases, but device access is
via `ext_vector_type` so as to not lose performance. Alignment is set
the same as the size to a maximum of 64 bytes, which aligns with an
upcoming spec change proposal. In the cases where the size is greater
than 64 we use std::array on the device. We no longer need to emit a
pragma on Windows and we can use `alignas()` on all platforms.
mdtoguchi pushed a commit to mdtoguchi/llvm that referenced this pull request Oct 18, 2023
The recent sycl::vec changes (intel#9492)
broke they unary operations. This PR fixes them and adds some testing to
avoid that in the future.
cperkinsintel added a commit to cperkinsintel/llvm that referenced this pull request Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants