-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Fix using some of math built-ins when ESIMD is included (#14793)
ESIMD headers declare some of `__spirv_ocl_*` built-ins as template functions, but those built-ins are also automatically declared by the compiler implicitly when used. On Windows, redeclarations in headers cause compilation issues, because by some reason they take priority, but template arguments for them couldn't be inferred. This commit effectively introduces new tests to cover affected scenarios and reverts a couple of ESIMD commits to fix the issue: - #14020 is completely reverted - #13383 is partially reverted to preserve new interfaces and tests, but stop declaring `__spirv_ocl_*` built-ins I suppose that both PRs were made in attempt to move away from custom ESIMD intrinsic to standard SPIR-V ones, but that should be done without manually declaring the latter. A bigger refactoring might be needed to use auto-declared SPIR-V built-ins in ESIMD because of presence and usage of single-element vectors in ESIMD (which do not exist in SPIR-V).
- Loading branch information
1 parent
619185f
commit 0228c23
Showing
14 changed files
with
163 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<int, 8> call_abs_vec(sycl::vec<int, 8> input) { | ||
return sycl::abs(input); | ||
} | ||
|
||
SYCL_EXTERNAL int call_abs_scalar(int input) { return sycl::abs(input); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<int, 8> call_clz_vec(sycl::vec<int, 8> input) { | ||
return sycl::clz(input); | ||
} | ||
|
||
SYCL_EXTERNAL int call_clz_scalar(int input) { return sycl::clz(input); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<int, 8> call_ctz_vec(sycl::vec<int, 8> input) { | ||
return sycl::ctz(input); | ||
} | ||
|
||
SYCL_EXTERNAL int call_ctz_scalar(int input) { return sycl::ctz(input); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<float, 8> call_fabs_vec(sycl::vec<float, 8> input) { | ||
return sycl::fabs(input); | ||
} | ||
|
||
SYCL_EXTERNAL float call_fabs_scalar(float input) { return sycl::fabs(input); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<float, 8> call_fma_vec(sycl::vec<float, 8> a, | ||
sycl::vec<float, 8> b, | ||
sycl::vec<float, 8> c) { | ||
return sycl::fma(a, b, c); | ||
} | ||
|
||
SYCL_EXTERNAL float call_fma_scalar(float a, float b, float c) { | ||
return sycl::fma(a, b, c); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<float, 8> call_fmax_vec(sycl::vec<float, 8> a, | ||
sycl::vec<float, 8> b) { | ||
return sycl::fmax(a, b); | ||
} | ||
|
||
SYCL_EXTERNAL float call_fmax_scalar(float a, float b) { | ||
return sycl::fmax(a, b); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<float, 8> call_fmin_vec(sycl::vec<float, 8> a, | ||
sycl::vec<float, 8> b) { | ||
return sycl::fmin(a, b); | ||
} | ||
|
||
SYCL_EXTERNAL float call_fmin_scalar(float a, float b) { | ||
return sycl::fmin(a, b); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
#include <sycl/ext/intel/esimd.hpp> | ||
|
||
SYCL_EXTERNAL sycl::vec<int, 8> call_popcount_vec(sycl::vec<int, 8> input) { | ||
return sycl::popcount(input); | ||
} | ||
|
||
SYCL_EXTERNAL int call_popcount_scalar(int input) { | ||
return sycl::popcount(input); | ||
} |