Skip to content

[ESIMD] Improve simd::replicate API#3782

Merged
kbobrovs merged 5 commits into
intel:syclfrom
DenisBakhvalov:esimd_apis3
Jun 9, 2021
Merged

[ESIMD] Improve simd::replicate API#3782
kbobrovs merged 5 commits into
intel:syclfrom
DenisBakhvalov:esimd_apis3

Conversation

@DenisBakhvalov

Copy link
Copy Markdown
Contributor

This patch deprecates two error-prone versions of simd::replicate API:

  • auto v0_rep = v0.replicate<2, 4, 2>(1);
  • auto v0_rep = v0.replicate<2, 4, 2, 2>(1);

To replace them, we introduce a struct of compile-time arguments, which user can fill with:

  simd<int, 8> v0(0, 1);
  using v0_type = decltype(v0);
  using RepOpts = typename v0_type::ReplicateOptsBuilder<2>::
                                    template vstride<4>::
                                    template width<2>::
                                    template hstride<2>::type;
  auto v0_rep = v0.replicate<RepOpts>(1);

@DenisBakhvalov

Copy link
Copy Markdown
Contributor Author

I think we can keep the first two (simple) versions of simd::replicate API:

  • auto v0_rep = v0.replicate<1>();
  • auto v0_rep = v0.replicate<4, 2>(2);

Otherwise, it becomes too much of a boilerplate to type.
Also, the version with two template parameters is tricky. The second template parameter sets two arguments at the same time: Width and Vstride.

@DenisBakhvalov

Copy link
Copy Markdown
Contributor Author

We discussed that with @rolandschulz and @kbobrovs and agreed that this way would be too verbose.
The alternative that we agreed to provide is to reflect the order of the template arguments in the name of the API:

template <int Rep> replicate
template <int Rep, int W> replicate_w
template <int Rep, int VS, int W>replicate_vs_w
template <int Rep, int VS, int W, int HS> replicate_vs_w_hs

@DenisBakhvalov

Copy link
Copy Markdown
Contributor Author

I updated the PR according to what we agreed.
@kbobrovs, please review.

llvm-test-suite patch is in progress.

Comment thread sycl/include/sycl/ext/intel/experimental/esimd/esimd.hpp Outdated
Comment thread sycl/include/sycl/ext/intel/experimental/esimd/esimd.hpp Outdated
Comment thread sycl/include/sycl/ext/intel/experimental/esimd/esimd.hpp Outdated
Comment thread sycl/test/esimd/simd_replicate_deprecated.cpp Outdated

@kbobrovs kbobrovs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@DenisBakhvalov, please add E2E test to llvm-test-suite too.

@kbobrovs

kbobrovs commented Jun 5, 2021

Copy link
Copy Markdown
Contributor

@rolandschulz, we've got informal approval from you when discussing it, but a formal one here from you would be appreciated.

@kbobrovs

kbobrovs commented Jun 9, 2021

Copy link
Copy Markdown
Contributor

@rolandschulz, merging this one - let us know if you have comments.

@kbobrovs
kbobrovs merged commit e45408a into intel:sycl Jun 9, 2021
iclsrc pushed a commit that referenced this pull request Jul 17, 2026
- Split FloatConversionsINTEL (6215) into FloatConversionsFtoFINTEL (6215) and FloatConversionsFtoSINTEL (6216).
- Drop OpClampConvertFToFINTEL and OpClampStochasticRoundFToFINTEL.
Their behavior is now expressed as OpFConvert / OpStochasticRoundFToFINTEL decorated with SaturatedToLargestFloat8NormalConversionEXT (fp8) or unconditionally clamped (fp4).
- Drop ClampConvert\*ToE2M1INTEL builtins - fp4 saturation is unconditional, so they collapse into Convert*ToE2M1INTEL.

Spec:
https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_fp_conversions.asciidoc

AI-assisted: Claude Opus 4.7 (commercial SaaS)

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@8edb4243a4be261
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.

2 participants