[clang-tools-extra] [mlir] [llvm] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-13 Thread Christian Ulmann via cfe-commits


@@ -0,0 +1,56 @@
+// RUN: mlir-opt %s 
-pass-pipeline='builtin.module(spirv-attach-target{ver=v1.0 
caps=Addresses,Int64,Kernel},convert-gpu-to-spirv{use-64bit-index=true},gpu.module(spirv.module(spirv-lower-abi-attrs,spirv-update-vce)),func.func(llvm-request-c-wrappers),convert-scf-to-cf,convert-cf-to-llvm,convert-arith-to-llvm,convert-math-to-llvm,convert-func-to-llvm,gpu-to-llvm{use-bare-pointers-for-kernels=true},gpu-module-to-binary,expand-strided-metadata,lower-affine,finalize-memref-to-llvm,reconcile-unrealized-casts)'
 \
+// RUN: | mlir-cpu-runner \
+// RUN:   --shared-libs=%mlir_sycl_runtime \
+// RUN:   --shared-libs=%mlir_runner_utils \
+// RUN:   --entry-point-result=void \
+// RUN: | FileCheck %s
+
+module @add attributes {gpu.container_module} {
+  memref.global "private" constant @__constant_2x2x2xf32_0 : memref<2x2x2xf32> 
= dense<[[[1.1, 2.2], [3.3, 4.4]], [[5.5, 6.6], [7.7, 8.8 ]]]>
+  memref.global "private" constant @__constant_2x2x2xf32 : memref<2x2x2xf32> = 
dense<[[[1.2, 2.3], [4.5, 5.8]], [[7.2, 8.3], [10.5, 11.8]]]>
+  func.func @main() {
+%0 = memref.get_global @__constant_2x2x2xf32 : memref<2x2x2xf32>
+%1 = memref.get_global @__constant_2x2x2xf32_0 : memref<2x2x2xf32>
+%2 = call @test(%0, %1) : (memref<2x2x2xf32>, memref<2x2x2xf32>) -> 
memref<2x2x2xf32>
+%cast = memref.cast %2 : memref<2x2x2xf32> to memref<*xf32>
+call @printMemrefF32(%cast) : (memref<*xf32>) -> ()
+return
+  }
+  func.func private @printMemrefF32(memref<*xf32>)
+  func.func @test(%arg0: memref<2x2x2xf32>, %arg1: memref<2x2x2xf32>) -> 
memref<2x2x2xf32> {

Dinistro wrote:

Ultra nit drive by comment: Could you indent the body of this function as you 
did for the other function bodies?

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-10 Thread Christian Ulmann via cfe-commits

https://github.com/Dinistro commented:

This is missing tests for the LLVM import and export. I suspect that this is 
currently still part of the function's passthrough dictionary, which should be 
changed.

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-10 Thread Christian Ulmann via cfe-commits

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-10 Thread Christian Ulmann via cfe-commits


@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
   }
 
   // TODO: Add target specific flags, ABI, mtune option etc.
+  if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native") == 0)

Dinistro wrote:

Nit: `strcmp` is a C function. I assume that `A->getValue()` returns a 
StringRef, or something else that supports normal `==` comparison. 

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-10 Thread Christian Ulmann via cfe-commits


@@ -58,6 +58,15 @@ def FramePointerKindAttr : LLVM_Attr<"FramePointerKind", 
"framePointerKind"> {
   let assemblyFormat = "`<` $framePointerKind `>`";
 }
 
+//===--===//
+// TuneCPUAttr
+//===--===//
+
+//def TuneCPUAttr : LLVM_Attr<"TuneCPU", "tuneCPU"> {
+  //let parameters = (ins "tuneCPU::tuneCPU":$tuneCPU);
+  //let assemblyFormat = "`<` $tuneCPU `>`";
+//}

Dinistro wrote:

Dead code?

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-17 Thread Christian Ulmann via cfe-commits


@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"

Dinistro wrote:

Can you add a check that ensures that this is not also placed in the 
passthrough dictionary? I don't see any part in the code that would avoid this. 
Adding it to the `ExplicitAttributes` set in `ModuleImport.cpp` should be 
enough.

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-17 Thread Christian Ulmann via cfe-commits


@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
   }
 
   // TODO: Add target specific flags, ABI, mtune option etc.
+  if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+if (strcmp(A->getValue(), "native") == 0)

Dinistro wrote:

A few lines further up, the string literal get's wrapped into a `StringRef`, 
which seems to work. 

`if (A->getValue() == StringRef{"Accelerate"})`

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-21 Thread Christian Ulmann via cfe-commits

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

The MLIR side looks good to me % one remaining nit comment. Thanks for 
addressing the comments.

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-21 Thread Christian Ulmann via cfe-commits

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


[clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

2024-06-21 Thread Christian Ulmann via cfe-commits


@@ -0,0 +1,9 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK-LABEL: llvm.func @tune_cpu()
+; CHECK-SAME: tune_cpu = "pentium4"

Dinistro wrote:

Given that we are both not entirely sure what happens, it might be sensible to 
check for that, just to be sure 🙂 

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


[clang] [llvm] [mlir] Remove the `x86_mmx` IR type. (PR #98505)

2024-07-22 Thread Christian Ulmann via cfe-commits

Dinistro wrote:

The MLIR side is looking good, but I cannot say something about the rest.

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


[clang] fix(clang/**.py): fix comparison to None (PR #94014)

2024-08-28 Thread Christian Ulmann via cfe-commits

https://github.com/Dinistro commented:

That seems a reasonable change. LGTM!

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


[clang] fix(clang/**.py): fix comparison to None (PR #94014)

2024-08-28 Thread Christian Ulmann via cfe-commits

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


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


[clang] fix(clang/**.py): fix comparison to None (PR #94014)

2024-09-16 Thread Christian Ulmann via cfe-commits

Dinistro wrote:

Do you have commit rights to land this or should I do it?

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


[clang] [flang] [lldb] [llvm] [mlir] Fix typo "instrinsic" (PR #112899)

2024-10-18 Thread Christian Ulmann via cfe-commits

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

LGTM, thanks for the fixes 😄 

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


[clang] fix(clang/**.py): fix comparison to None (PR #94014)

2024-09-19 Thread Christian Ulmann via cfe-commits

Dinistro wrote:

Then I'll merge it for you.

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


[clang] fix(clang/**.py): fix comparison to None (PR #94014)

2024-09-19 Thread Christian Ulmann via cfe-commits

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


[clang] [llvm] [LLVM][IR] Use splat syntax when printing Constant[Data]Vector. (PR #112548)

2024-11-18 Thread Christian Ulmann via cfe-commits

Dinistro wrote:

We have a, temporary, odd use-case where we need to feed the textual IR back to 
a tool that is built with LLVM 17. For now, we were able to bypass all 
incompatibilities by simple workarounds on either the LLVM head, or on the LLVM 
17 side. Unfortunately, this change seems the first change that leads to a 
non-trivial breakage that we cannot temporary circumvent.

I'm aware that our use case is not officially supported, I just wanted to check 
what is supposed to happen. We will find a way to deal with this.

Either way, thanks for the quick answer and thanks for working on improvements 
like these 🙂 

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


[clang] [llvm] [LLVM][IR] Use splat syntax when printing Constant[Data]Vector. (PR #112548)

2024-11-18 Thread Christian Ulmann via cfe-commits

Dinistro wrote:

I stumbled over this change while trying to integrate LLVM head into our 
downstream project. Is there any way to enforce that this still prints textual 
IR in the old format, i.e., without "splat"? I found the following flags, but 
they do not seem to provide the expected behavior.

```
--use-constant-int-for-fixed-length-splat
--use-constant-fp-for-fixed-length-splat
--use-constant-int-for-scalable-splat
--use-constant-fp-for-scalable-splat
```

What I would require is some way of forcing `opt` to roundtrip on the following 
IR file **without** transforming this to splat syntax:

```
define <2 x double> @test(<2 x double> %in) {
  %res = fmul <2 x double> %in, 
  ret <2 x double> %res
}
```

Ofc., we can find other kinds of workarounds, but I wanted to first to confirm 
that this is indeed expected behavior or not.

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