Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vector dot product with SYCL esimd intrinsic functions #3682

Unanswered
mathbird asked this question in Q&A
Discussion options

Hi, is there a code sample for vector dot product, using SYCL esimd intrinsic functions?

Thanks,

D.

You must be logged in to vote

Replies: 3 comments 3 replies

Comment options

@mathbird do you mean dp4a intrinsic? There's a test case for that: https://github.com/intel/llvm-test-suite/blob/intel/SYCL/ESIMD/dp4a.cpp

You must be logged in to vote
2 replies
Comment options

I mean this:

let
A=(a_1,a_2,..., a_n)
B=(b_1,b_2,..., b_n)

do the calculation: sum =dot(A, B) = a_1 * b_2 + a_1 * b_2 + ... + a_n * b_n.

I would like to see how ESIMD uses shared local memory in the calculation.

In other words, how to rewrite the following program with SYCL ESIMD:

#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <iostream>
#define N 1<<10
int main(int argc, char *argv[] )
{
 double *A = new double[N];
 double *B = new double[N];
 for(int i = 0; i < N; i++){
 A[i] = 0.1;
 B[i] = 0.2;
 }
 double sum = 0.0;
 for(int i = 0; i < N; i++){
 sum += A[i]*B[i];
 }
 std::cout << " sum =" << sum << std::endl;
 delete []A;
 delete []B;
 return 0;
}
Comment options

Tagging @kbobrovs and @DenisBakhvalov here to help answering the question

Comment options

Looks like you are basically looking how to do a reduction in ESIMD using SLM. Good example is https://github.com/intel/llvm-test-suite/blob/intel/SYCL/ESIMD/histogram_256_slm.cpp, look for slm_init, slm_load, slm_atomic, slm_store.

You must be logged in to vote
0 replies
Comment options

Is SYCL ESMID portable (e.g. NVIDIA GPUs) ?

Is the dp4a example specific to Intel GPUs ?
https://github.com/intel/llvm-test-suite/blob/intel/SYCL/ESIMD/dp4a.cpp

You must be logged in to vote
1 reply
Comment options

@jinz2014, it is not portable to other devices (even Intel CPUs).

It is documented as intel extension: https://github.com/intel/llvm/tree/sycl/sycl/doc/extensions/supported/sycl_ext_intel_esimd which generally means that it won't/can't be supported on HW from other vendors.

And it also explicitly states that this is an interface to Intel GPU HW capabilities:

The main motivation for introducing the "Explicit SIMD" SYCL extension (or simply "ESIMD") is enabling efficient low-level programming for Intel graphics architectures.

Essentially, it is not portable because it almost directly maps to Intel GPU ISA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /