[llvm] [SPIRV]Added support for extension SPV_INTEL_arbitrary_precision_fixed_point (PR #136085)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 06:49:03 PDT 2025
================
@@ -0,0 +1,563 @@
+; SYCL source (compiled with -S -emit-llvm -fsycl-device-only):
+; template <int W, int rW, bool S, int I, int rI>
+; void sqrt() {
+; ap_int<W> a;
+; auto ap_fixed_Sqrt = __spirv_FixedSqrtINTEL<W,rW>(a, S, I, rI);
+; ap_int<rW> b;
+; auto ap_fixed_Sqrt_b = __spirv_FixedSqrtINTEL<rW, W>(b, S, I, rI);
+; ap_int<rW> c;
+; auto ap_fixed_Sqrt_c = __spirv_FixedSqrtINTEL<rW, W>(c, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void recip() {
+; ap_int<W> a;
+; auto ap_fixed_Recip = __spirv_FixedRecipINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void rsqrt() {
+; ap_int<W> a;
+; auto ap_fixed_Rsqrt = __spirv_FixedRsqrtINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void sin() {
+; ap_int<W> a;
+; auto ap_fixed_Sin = __spirv_FixedSinINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void cos() {
+; ap_int<W> a;
+; auto ap_fixed_Cos = __spirv_FixedCosINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void sin_cos() {
+; ap_int<W> a;
+; auto ap_fixed_SinCos = __spirv_FixedSinCosINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void sin_pi() {
+; ap_int<W> a;
+; auto ap_fixed_SinPi = __spirv_FixedSinPiINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void cos_pi() {
+; ap_int<W> a;
+; auto ap_fixed_CosPi = __spirv_FixedCosPiINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void sin_cos_pi() {
+; ap_int<W> a;
+; auto ap_fixed_SinCosPi = __spirv_FixedSinCosPiINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void log() {
+; ap_int<W> a;
+; auto ap_fixed_Log = __spirv_FixedLogINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <int W, int rW, bool S, int I, int rI>
+; void exp() {
+; ap_int<W> a;
+; auto ap_fixed_Exp = __spirv_FixedExpINTEL<W,rW>(a, S, I, rI);
+; }
+
+; template <typename name, typename Func>
+; __attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
+; kernelFunc();
+; }
+
+; int main() {
+; kernel_single_task<class kernel_function>([]() {
+; sqrt<13, 5, false, 2, 2>();
+; recip<3, 8, true, 4, 4>();
+; rsqrt<11, 10, false, 8, 6>();
+; sin<17, 11, true, 7, 5>();
+; cos<35, 28, false, 9, 3>();
+; sin_cos<31, 20, true, 10, 12>();
+; sin_pi<60, 5, false, 2, 2>();
+; cos_pi<28, 16, false, 8, 5>();
+; sin_cos_pi<13, 5, false, 2, 2>();
+; log<64, 44, true, 24, 22>();
+; exp<44, 34, false, 20, 20>();
+; exp<68, 68, false, 20, 20>();
+; });
+; return 0;
+; }
----------------
MrSidims wrote:
It's good, that you are checking with the existing tests from llvm-spirv, but lets do some modifications to it here in SPIR-V backend :)
So lets remove this comment as SYCL FE is not a part of LLVM and in general make the test a bit shorted, see below.
https://github.com/llvm/llvm-project/pull/136085
More information about the llvm-commits
mailing list