[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-19 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd created 
https://github.com/llvm/llvm-project/pull/78729

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*

>From d5a823584487d9f6b3e9bebc8976c7891243f470 Mon Sep 17 00:00:00 2001
From: Mariusz Sikora 
Date: Fri, 19 Jan 2024 16:29:46 +0100
Subject: [PATCH] [AMDGPU][GFX12] Add tests for unsupported builtins

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*
---
 ...ltins-amdgcn-error-unsupported-on-gfx12.cl | 105 ++
 1 file changed, 105 insertions(+)
 create mode 100644 
clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl

diff --git 
a/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl 
b/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl
new file mode 100644
index 00..3e290f76017ffa
--- /dev/null
+++ b/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl
@@ -0,0 +1,105 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1200 -verify -S -o - %s
+
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void test(global v32f*out_v32f,
+  global v16f*out_v16f,
+ global v4f* out_v4f,
+ global v32i*out_v32i,
+ global v16i*out_v16i,
+ global v4i* out_v4i,
+ global v4d* out_v4d,
+ global double*  out_double,
+ double a_double , double b_double , double c_double,
+  float a_float   , float  b_float  , float  c_float,
+ int   a_int , intb_int, intc_int,
+ long  a_long, long   b_long   , long   c_long,
+ v4d   a_v4d , v4db_v4d, v4dc_v4d,
+ v8s   a_v8s , v8sb_v8s, v8sc_v8s,
+ v4s   a_v4s , v4sb_v4s, v4sc_v4s,
+ v2s   a_v2s , v2sb_v2s, v2sc_v2s,
+ v2i   a_v2i , v2ib_v2i, v2ic_v2i,
+ v16i  a_v16i, v16i   b_v16i   , v16i   c_v16i,
+ v32i  a_v32i, v32i   b_v32i   , v32i   c_v32i,
+ v4i   a_v4i , v4ib_v4i, v4ic_v4i,
+ v2f   a_v2f , v2fb_v2f, v2fc_v2f,
+ v4f   a_v4f , v4fb_v4f, v4fc_v4f,
+ v16f  a_v16f, v16f   b_v16f   , v16f   c_v16f,
+ v32f  a_v32f, v32f   b_v32f   , v32f   c_v32f,
+ v4h   a_v4h , v4hb_v4h, v4hc_v4h,
+ v8h   a_v8h , v8hb_v8h, v8hc_v8h,
+ int   idx) {
+  *out_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, b_float, c_v32f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs 
target feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, b_float, c_v16f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs 
target feature mai-insts}}
+  *out_v4f =  __builtin_amdgcn_mfma_f32_4x4x1f32(a_float, b_float, c_v4f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_4x4x1f32' needs target 
feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_32x32x2f32(a_float, b_float, c_v16f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x2f32' needs 
target feature mai-insts}}
+  *out_v4f =  __builtin_amdgcn_mfma_f32_16x16x4f32(a_float, b_float, c_v4f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f32' needs target 
feature mai-insts}}
+  *out_v32f = __builtin_amdgcn_mfma_f32_32x32x4f16(a_v4h, b_v4h, c_v32f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x4f16' needs target 
feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_16x16x4f16(a_v4h, b_v4h, c_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f16' needs target 
feature mai-insts}}
+  *out_v4f = __builtin_amdgcn_mfma_f32_4x4x4f16(a_v4h, b_v4h, c_v4f, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_f32_4x4x4f16' needs target feature 
mai-insts}}
+  *

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-19 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Mariusz Sikora (mariusz-sikora-at-amd)


Changes

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*

---
Full diff: https://github.com/llvm/llvm-project/pull/78729.diff


1 Files Affected:

- (added) clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl 
(+105) 


``diff
diff --git 
a/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl 
b/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl
new file mode 100644
index 000..3e290f76017ffa4
--- /dev/null
+++ b/clang/test/SemaOpenCL/builtins-amdgcn-error-unsupported-on-gfx12.cl
@@ -0,0 +1,105 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1200 -verify -S -o - %s
+
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void test(global v32f*out_v32f,
+  global v16f*out_v16f,
+ global v4f* out_v4f,
+ global v32i*out_v32i,
+ global v16i*out_v16i,
+ global v4i* out_v4i,
+ global v4d* out_v4d,
+ global double*  out_double,
+ double a_double , double b_double , double c_double,
+  float a_float   , float  b_float  , float  c_float,
+ int   a_int , intb_int, intc_int,
+ long  a_long, long   b_long   , long   c_long,
+ v4d   a_v4d , v4db_v4d, v4dc_v4d,
+ v8s   a_v8s , v8sb_v8s, v8sc_v8s,
+ v4s   a_v4s , v4sb_v4s, v4sc_v4s,
+ v2s   a_v2s , v2sb_v2s, v2sc_v2s,
+ v2i   a_v2i , v2ib_v2i, v2ic_v2i,
+ v16i  a_v16i, v16i   b_v16i   , v16i   c_v16i,
+ v32i  a_v32i, v32i   b_v32i   , v32i   c_v32i,
+ v4i   a_v4i , v4ib_v4i, v4ic_v4i,
+ v2f   a_v2f , v2fb_v2f, v2fc_v2f,
+ v4f   a_v4f , v4fb_v4f, v4fc_v4f,
+ v16f  a_v16f, v16f   b_v16f   , v16f   c_v16f,
+ v32f  a_v32f, v32f   b_v32f   , v32f   c_v32f,
+ v4h   a_v4h , v4hb_v4h, v4hc_v4h,
+ v8h   a_v8h , v8hb_v8h, v8hc_v8h,
+ int   idx) {
+  *out_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, b_float, c_v32f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs 
target feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, b_float, c_v16f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs 
target feature mai-insts}}
+  *out_v4f =  __builtin_amdgcn_mfma_f32_4x4x1f32(a_float, b_float, c_v4f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_4x4x1f32' needs target 
feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_32x32x2f32(a_float, b_float, c_v16f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x2f32' needs 
target feature mai-insts}}
+  *out_v4f =  __builtin_amdgcn_mfma_f32_16x16x4f32(a_float, b_float, c_v4f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f32' needs target 
feature mai-insts}}
+  *out_v32f = __builtin_amdgcn_mfma_f32_32x32x4f16(a_v4h, b_v4h, c_v32f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x4f16' needs target 
feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_16x16x4f16(a_v4h, b_v4h, c_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f16' needs target 
feature mai-insts}}
+  *out_v4f = __builtin_amdgcn_mfma_f32_4x4x4f16(a_v4h, b_v4h, c_v4f, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_f32_4x4x4f16' needs target feature 
mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_32x32x8f16(a_v4h, b_v4h, c_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x8f16' needs target 
feature mai-insts}}
+  *out_v4f = __builtin_amdgcn_mfma_f32_16x16x16f16(a_v4h, b_v4h, c_v4f, 0, 0, 

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-19 Thread Jay Foad via cfe-commits


@@ -0,0 +1,105 @@
+// REQUIRES: amdgpu-registered-target

jayfoad wrote:

Maybe just add these to `test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl` 
instead of a new file?

https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-22 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd updated 
https://github.com/llvm/llvm-project/pull/78729

>From eb04956ce8ad84206a95789885003dd6c6f60d2e Mon Sep 17 00:00:00 2001
From: Mariusz Sikora 
Date: Fri, 19 Jan 2024 16:29:46 +0100
Subject: [PATCH] [AMDGPU][GFX12] Add tests for unsupported builtins

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*
---
 .../builtins-amdgcn-gfx12-err.cl  | 106 +-
 1 file changed, 105 insertions(+), 1 deletion(-)

diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
index bcaea9a2482d186..413212909701c19 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
@@ -4,10 +4,114 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(global v32f*out_v32f,
+  global v16f*out_v16f,
+  global v4f* out_v4f,
+  global v32i*out_v32i,
+  global v16i*out_v16i,
+  global v4i* out_v4i,
+  global v4d* out_v4d,
+  global double*  out_double,
+  double a_double , double b_double , double 
c_double,
+  float a_float   , float  b_float  , float  
c_float,
+  int   a_int , intb_int, intc_int,
+  long  a_long, long   b_long   , long   
c_long,
+  v4d   a_v4d , v4db_v4d, v4dc_v4d,
+  v8s   a_v8s , v8sb_v8s, v8sc_v8s,
+  v4s   a_v4s , v4sb_v4s, v4sc_v4s,
+  v2s   a_v2s , v2sb_v2s, v2sc_v2s,
+  v2i   a_v2i , v2ib_v2i, v2ic_v2i,
+  v16i  a_v16i, v16i   b_v16i   , v16i   
c_v16i,
+  v32i  a_v32i, v32i   b_v32i   , v32i   
c_v32i,
+  v4i   a_v4i , v4ib_v4i, v4ic_v4i,
+  v2f   a_v2f , v2fb_v2f, v2fc_v2f,
+  v4f   a_v4f , v4fb_v4f, v4fc_v4f,
+  v16f  a_v16f, v16f   b_v16f   , v16f   
c_v16f,
+  v32f  a_v32f, v32f   b_v32f   , v32f   
c_v32f,
+  v4h   a_v4h , v4hb_v4h, v4hc_v4h,
+  v8h   a_v8h , v8hb_v8h, v8hc_v8h,
+  int   idx,
+
+  uint a, uint b) {
+
   __builtin_amdgcn_ds_gws_init(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_init' needs target feature gws}}
   __builtin_amdgcn_ds_gws_barrier(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_barrier' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_v(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_v' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_br(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_br' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_p(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_p' needs target feature gws}}
+
+  *out_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, b_float, c_v32f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs 
target feature mai-insts}}
+  *out_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, b_float, c_v16f, 
0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs 
target feature mai-insts}}
+ 

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-24 Thread Mariusz Sikora via cfe-commits

mariusz-sikora-at-amd wrote:

ping

https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-24 Thread Jay Foad via cfe-commits

https://github.com/jayfoad edited 
https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-24 Thread Jay Foad via cfe-commits

https://github.com/jayfoad approved this pull request.

LGTM.

https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-24 Thread Jay Foad via cfe-commits


@@ -4,10 +4,114 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(global v32f*out_v32f,
+  global v16f*out_v16f,
+  global v4f* out_v4f,
+  global v32i*out_v32i,
+  global v16i*out_v16i,
+  global v4i* out_v4i,
+  global v4d* out_v4d,
+  global double*  out_double,
+  double a_double , double b_double , double 
c_double,

jayfoad wrote:

Nit: you don't really need separate out/a/b/c versions of all these types. You 
could just test expressions like:
```
x_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(x_float, x_float, x_v32f, 0, 0, 
0);
```

https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-24 Thread Mariusz Sikora via cfe-commits


@@ -4,10 +4,114 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(global v32f*out_v32f,
+  global v16f*out_v16f,
+  global v4f* out_v4f,
+  global v32i*out_v32i,
+  global v16i*out_v16i,
+  global v4i* out_v4i,
+  global v4d* out_v4d,
+  global double*  out_double,
+  double a_double , double b_double , double 
c_double,

mariusz-sikora-at-amd wrote:

Thanks, I will update these.

https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-25 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd updated 
https://github.com/llvm/llvm-project/pull/78729

>From 56cf06f1b530d5ec62de1cc3818bf2f76dfd Mon Sep 17 00:00:00 2001
From: Mariusz Sikora 
Date: Fri, 19 Jan 2024 16:29:46 +0100
Subject: [PATCH] [AMDGPU][GFX12] Add tests for unsupported builtins

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*
---
 .../builtins-amdgcn-gfx12-err.cl  | 86 ++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
index bcaea9a2482d186..f91fea17145102a 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
@@ -4,10 +4,94 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(double a_double, float a_float,
+  int a_int, long  a_long,
+  v4d a_v4d,
+  v2s a_v2s, v4s a_v4s, v8s a_v8s,
+  v2i a_v2i, v4i a_v4i, v16i a_v16i, v32i a_v32i,
+  v2f a_v2f, v4f a_v4f, v16f a_v16f, v32f  a_v32f,
+  v4h a_v4h, v8h a_v8h,
+
+  uint a, uint b) {
+
   __builtin_amdgcn_ds_gws_init(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_init' needs target feature gws}}
   __builtin_amdgcn_ds_gws_barrier(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_barrier' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_v(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_v' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_br(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_br' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_p(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_p' needs target feature gws}}
+
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, a_float, a_v32f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_4x4x1f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_4x4x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x2f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x2f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_16x16x4f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f32' needs target 
feature mai-insts}}
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x4f16(a_v4h, a_v4h, a_v32f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x4f16' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x4f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_4x4x4f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); // 
expected-error {{'__builtin_amdgcn_mfma_f32_4x4x4f16' needs target feature 
mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x8f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x8f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_16x16x16f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_f32_16x16x16f16' needs target 
feature mai-insts}}
+  a_v32i = __builtin_amdgcn_mfma_i32_32x32x4i8(a_int, a_int, a_v32i, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_i32_32x32x4i8' needs 

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-25 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd updated 
https://github.com/llvm/llvm-project/pull/78729

>From 19e0554bcebf739f7ad500f64efe62b38781f7a1 Mon Sep 17 00:00:00 2001
From: Mariusz Sikora 
Date: Fri, 19 Jan 2024 16:29:46 +0100
Subject: [PATCH] [AMDGPU][GFX12] Add tests for unsupported builtins

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*
---
 .../builtins-amdgcn-gfx12-err.cl  | 86 ++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
index bcaea9a2482d186..f91fea17145102a 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
@@ -4,10 +4,94 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(double a_double, float a_float,
+  int a_int, long  a_long,
+  v4d a_v4d,
+  v2s a_v2s, v4s a_v4s, v8s a_v8s,
+  v2i a_v2i, v4i a_v4i, v16i a_v16i, v32i a_v32i,
+  v2f a_v2f, v4f a_v4f, v16f a_v16f, v32f  a_v32f,
+  v4h a_v4h, v8h a_v8h,
+
+  uint a, uint b) {
+
   __builtin_amdgcn_ds_gws_init(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_init' needs target feature gws}}
   __builtin_amdgcn_ds_gws_barrier(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_barrier' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_v(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_v' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_br(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_br' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_p(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_p' needs target feature gws}}
+
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, a_float, a_v32f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_4x4x1f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_4x4x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x2f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x2f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_16x16x4f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f32' needs target 
feature mai-insts}}
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x4f16(a_v4h, a_v4h, a_v32f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x4f16' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x4f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_4x4x4f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); // 
expected-error {{'__builtin_amdgcn_mfma_f32_4x4x4f16' needs target feature 
mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x8f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x8f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_16x16x16f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_f32_16x16x16f16' needs target 
feature mai-insts}}
+  a_v32i = __builtin_amdgcn_mfma_i32_32x32x4i8(a_int, a_int, a_v32i, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_i32_32x32x4i8' needs 

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-31 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd updated 
https://github.com/llvm/llvm-project/pull/78729

>From cc492d4134e4aa0aab56d01b21ec85937e49acfd Mon Sep 17 00:00:00 2001
From: Mariusz Sikora 
Date: Fri, 19 Jan 2024 16:29:46 +0100
Subject: [PATCH] [AMDGPU][GFX12] Add tests for unsupported builtins

__builtin_amdgcn_mfma* and __builtin_amdgcn_smfmac*
---
 .../builtins-amdgcn-gfx12-err.cl  | 86 ++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
index bcaea9a2482d1..f91fea1714510 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx12-err.cl
@@ -4,10 +4,94 @@
 
 typedef unsigned int uint;
 
-kernel void test_builtins_amdgcn_gws_insts(uint a, uint b) {
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+
+typedef float  v2f   __attribute__((ext_vector_type(2)));
+typedef float  v4f   __attribute__((ext_vector_type(4)));
+typedef float  v16f  __attribute__((ext_vector_type(16)));
+typedef float  v32f  __attribute__((ext_vector_type(32)));
+typedef half   v4h   __attribute__((ext_vector_type(4)));
+typedef half   v8h   __attribute__((ext_vector_type(8)));
+typedef half   v16h  __attribute__((ext_vector_type(16)));
+typedef half   v32h  __attribute__((ext_vector_type(32)));
+typedef intv2i   __attribute__((ext_vector_type(2)));
+typedef intv4i   __attribute__((ext_vector_type(4)));
+typedef intv16i  __attribute__((ext_vector_type(16)));
+typedef intv32i  __attribute__((ext_vector_type(32)));
+typedef short  v2s   __attribute__((ext_vector_type(2)));
+typedef short  v4s   __attribute__((ext_vector_type(4)));
+typedef short  v8s   __attribute__((ext_vector_type(8)));
+typedef short  v16s  __attribute__((ext_vector_type(16)));
+typedef short  v32s  __attribute__((ext_vector_type(32)));
+typedef double v4d   __attribute__((ext_vector_type(4)));
+
+void builtin_test_unsupported(double a_double, float a_float,
+  int a_int, long  a_long,
+  v4d a_v4d,
+  v2s a_v2s, v4s a_v4s, v8s a_v8s,
+  v2i a_v2i, v4i a_v4i, v16i a_v16i, v32i a_v32i,
+  v2f a_v2f, v4f a_v4f, v16f a_v16f, v32f  a_v32f,
+  v4h a_v4h, v8h a_v8h,
+
+  uint a, uint b) {
+
   __builtin_amdgcn_ds_gws_init(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_init' needs target feature gws}}
   __builtin_amdgcn_ds_gws_barrier(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_barrier' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_v(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_v' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_br(a, b); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_br' needs target feature gws}}
   __builtin_amdgcn_ds_gws_sema_p(a); // expected-error 
{{'__builtin_amdgcn_ds_gws_sema_p' needs target feature gws}}
+
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x1f32(a_float, a_float, a_v32f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x1f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x1f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_4x4x1f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_4x4x1f32' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x2f32(a_float, a_float, a_v16f, 0, 
0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x2f32' needs target 
feature mai-insts}}
+  a_v4f =  __builtin_amdgcn_mfma_f32_16x16x4f32(a_float, a_float, a_v4f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f32' needs target 
feature mai-insts}}
+  a_v32f = __builtin_amdgcn_mfma_f32_32x32x4f16(a_v4h, a_v4h, a_v32f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x4f16' needs target 
feature mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_16x16x4f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x4f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_4x4x4f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); // 
expected-error {{'__builtin_amdgcn_mfma_f32_4x4x4f16' needs target feature 
mai-insts}}
+  a_v16f = __builtin_amdgcn_mfma_f32_32x32x8f16(a_v4h, a_v4h, a_v16f, 0, 0, 
0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x8f16' needs target 
feature mai-insts}}
+  a_v4f = __builtin_amdgcn_mfma_f32_16x16x16f16(a_v4h, a_v4h, a_v4f, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_f32_16x16x16f16' needs target 
feature mai-insts}}
+  a_v32i = __builtin_amdgcn_mfma_i32_32x32x4i8(a_int, a_int, a_v32i, 0, 0, 0); 
// expected-error {{'__builtin_amdgcn_mfma_i32_32x32x4i8' needs targ

[clang] [AMDGPU][GFX12] Add tests for unsupported builtins (PR #78729)

2024-01-31 Thread Mariusz Sikora via cfe-commits

https://github.com/mariusz-sikora-at-amd closed 
https://github.com/llvm/llvm-project/pull/78729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits