================
@@ -0,0 +1,184 @@
+// Negative tests for diagnostic paths.
+//
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown \
+// RUN: -cl-std=CL2.0 -cl-ext=+cl_khr_cooperative_matrix \
+// RUN: -finclude-default-header -fsyntax-only -verify %s
+
+#define SCOPE memory_scope_sub_group
+#define USE_A CLK_COOPERATIVE_MATRIX_A
+#define USE_B CLK_COOPERATIVE_MATRIX_B
+#define USE_C CLK_COOPERATIVE_MATRIX_ACCUMULATOR
+#define ROW_MAJOR CLK_COOPERATIVE_MATRIX_LAYOUT_ROW_MAJOR
+
+// Use of cooperative matrix type without specifying pragma
+typedef float __attribute__((coop_mat(SCOPE, 16, 16, USE_A))) MatX_t; //
expected-error {{cooperative matrix types require OpenCL extension
'cl_khr_cooperative_matrix' to be enabled via pragma}}
+
+#pragma OPENCL EXTENSION cl_khr_cooperative_matrix : enable
+
+typedef float __attribute__((coop_mat(SCOPE, 16, 16, USE_A))) MatA_t; //
expected-note {{declared here}}
+typedef float __attribute__((coop_mat(SCOPE, 16, 16, USE_B))) MatB_t;
+typedef int __attribute__((coop_mat(SCOPE, 16, 16, USE_C))) MatC_int_t;
+
+// Invalid 'scope' test
+typedef float __attribute__((coop_mat(0, 16, 16, USE_A))) MatBadScope; //
expected-error {{invalid 'scope' argument of cooperative matrix attribute}}
+
+// Invalid 'use' test
+typedef float __attribute__((coop_mat(SCOPE, 16, 16, 99))) MatBadUse; //
expected-error {{invalid 'use' argument of cooperative matrix attribute}}
+
+// Mismatched element types in coop_mat_mulAdd
+kernel void test_muladd_type_mismatch(__global float *fptr,
+ __global int *iptr) {
+ MatA_t a;
+ MatB_t b;
+ MatC_int_t c;
+ a = coop_mat_load(fptr, ROW_MAJOR, 16);
+ b = coop_mat_load(fptr, ROW_MAJOR, 16);
+ c = coop_mat_load(iptr, ROW_MAJOR, 16);
+
+ MatC_int_t result;
+ result = coop_mat_mulAdd(a, b, c); // expected-error {{inconsistent
cooperative matrix element types}}
----------------
asudarsa-qti wrote:
We discussed this and it does not look like we have any restrictions on the
element types and their combinations here. I have removed the diagnostics,
checks and the associated negative tests.
Thanks for pointing this out.
https://github.com/llvm/llvm-project/pull/221328
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits